/* Up Life · demonstração — mesmo idioma visual dos painéis FlamaTech (Meu Piazza / Meu Living) */
:root {
  --fundo: #111111; --lateral: #1c1c1c; --topo: #13201b; --cartao: #1c1c1c; --cartao2: #232323; --borda: #2c2c2c;
  --texto: #e1e1e1; --sec: #9b9b9b; --marca: #12c48f; --marca-esc: #0b7a59;
  --azul: #039be5; --ambar: #ffa000; --vermelho: #ef4444; --verde: #22c55e; --roxo: #9c6ade; --ciano: #00bcd4; --laranja: #ff7043;
  --raio: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--fundo); color: var(--texto); font: 14px/1.45 Roboto, 'Segoe UI', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
a { color: var(--marca); }
.lat-item, .aba, a.btn { text-decoration: none; display: inline-block; }
.lat-item, .aba { display: flex; }
.mdi { width: 24px; height: 24px; fill: currentColor; flex: none; }

/* ---------- casca ---------- */
.casca { display: grid; grid-template-columns: 256px 1fr; height: 100vh; }
.lateral { background: var(--lateral); border-right: 1px solid #000; display: flex; flex-direction: column; overflow-y: auto; }
.lat-topo { height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 12px 0 16px; border-bottom: 1px solid #000; }
.lat-topo .nome { font-size: 19px; line-height: 1.1; }
.lat-topo .by { font-size: 12px; color: var(--marca); font-weight: 500; }
.lat-item { display: flex; align-items: center; gap: 22px; margin: 4px 6px; padding: 10px 12px; border-radius: 6px; cursor: pointer; color: #cfcfcf; font-weight: 500; border: 0; background: none; text-align: left; width: calc(100% - 12px); }
.lat-item:hover { background: #262626; }
.lat-item.ativo { background: rgba(18,196,143,.12); color: var(--marca); }
.lat-item .mdi { color: #8f8f8f; }
.lat-item.ativo .mdi { color: var(--marca); }
.lat-sep { height: 1px; background: #000; margin: 6px 0; }
.lat-rodape { margin-top: auto; padding: 12px 16px; font-size: 11px; color: #777; }
.demo-chip { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: rgba(255,160,0,.15); color: var(--ambar); font-weight: 500; }

.principal { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topo { height: 64px; background: var(--topo); display: flex; align-items: center; padding: 0 8px; gap: 4px; border-bottom: 1px solid #000; flex: none; }
.topo .menu-btn { display: none; }
.abas { display: flex; overflow-x: auto; scrollbar-width: none; flex: 1; }
.abas::-webkit-scrollbar { display: none; }
.aba { height: 64px; padding: 0 18px; display: flex; align-items: center; gap: 8px; border: 0; background: none; color: #c8c8c8; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.aba.ativa { color: #fff; border-bottom-color: #fff; }
.aba .mdi { width: 22px; height: 22px; }
.ico-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: none; display: grid; place-items: center; cursor: pointer; color: #ddd; }
.ico-btn:hover { background: rgba(255,255,255,.08); }
.conteudo { flex: 1; overflow-y: auto; padding: 20px 20px 80px; }

/* ---------- seções (layout "sections" do painel) ---------- */
.secoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 24px 20px; max-width: 1600px; margin: 0 auto; align-items: start; }
.secao { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; }
.secao.larga { grid-column: 1 / -1; }
.secao > *, .secao > [data-r] > * { grid-column: span 12; }
.secao .c6 { grid-column: span 6 !important; }
.secao .c4 { grid-column: span 4 !important; }
.secao .c3 { grid-column: span 3 !important; }
.titulo { display: flex; align-items: center; gap: 10px; padding: 6px 4px 2px; font-size: 16px; font-weight: 500; min-height: 40px; }
.titulo .mdi { color: #bdbdbd; width: 22px; }
.titulo .badges { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px 2px 6px; height: 26px; border-radius: 13px; background: var(--cartao2); border: 1px solid var(--borda); font-size: 12px; color: var(--sec); }
.badge .mdi { width: 16px; height: 16px; }
.sub { color: var(--sec); font-size: 13px; padding: 0 4px; }

.cartao { background: var(--cartao); border: 1px solid var(--borda); border-radius: var(--raio); padding: 14px; position: relative; }
.opcional { position: relative; }
.opcional::after { content: 'OPCIONAL · aditivo'; position: absolute; top: -8px; right: 10px; font-size: 10px; letter-spacing: .4px; font-weight: 700; padding: 2px 8px; border-radius: 8px; background: #3b2a00; color: var(--ambar); border: 1px solid rgba(255,160,0,.5); z-index: 2; }
.opcional-tag { font-size: 10px; letter-spacing: .4px; font-weight: 700; padding: 2px 8px; border-radius: 8px; background: #3b2a00; color: var(--ambar); border: 1px solid rgba(255,160,0,.5); }
body.sem-opcionais .opcional, body.sem-opcionais .so-opcional { display: none !important; }

/* tile */
.tile { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 56px; background: var(--cartao); border: 1px solid var(--borda); border-radius: var(--raio); cursor: pointer; user-select: none; transition: background .15s; }
.tile:hover { background: #222; }
.tile .ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.06); color: #9a9a9a; flex: none; transition: all .2s; }
.tile .ic .mdi { width: 20px; height: 20px; }
.tile .tx { min-width: 0; }
.tile .nm { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.tile .st { color: var(--sec); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.on .ic { background: color-mix(in srgb, var(--cor, var(--ambar)) 22%, transparent); color: var(--cor, var(--ambar)); }
.tile.alerta .ic { background: rgba(239,68,68,.2); color: var(--vermelho); }
.tile.alerta .st { color: var(--vermelho); }

/* botão grande (portões, button-card) */
.botao { border-radius: var(--raio); padding: 16px 14px; border: 1px solid rgba(var(--rgb), .45); background: linear-gradient(160deg, rgba(var(--rgb), .30), rgba(var(--rgb), .08)); cursor: pointer; text-align: center; user-select: none; transition: transform .1s, box-shadow .2s; min-height: 118px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.botao:active { transform: scale(.97); }
.botao .mdi { width: 44px; height: 44px; color: rgb(var(--rgb)); }
.botao .nm { font-weight: 700; font-size: 15px; }
.botao .st { font-size: 12px; color: #cfcfcf; }
.botao.aberto { box-shadow: 0 0 0 2px rgb(var(--rgb)), 0 0 22px rgba(var(--rgb), .45); animation: pulsa 1.2s infinite; }
@keyframes pulsa { 50% { box-shadow: 0 0 0 2px rgb(var(--rgb)), 0 0 6px rgba(var(--rgb), .2); } }

/* saudação */
.saudacao { border-radius: 18px; padding: 22px 24px; background: linear-gradient(110deg, #1f3f8f, #1689d6 60%, #0ea5e9); color: #fff; }
.saudacao h2 { margin: 0 0 6px; font-size: 24px; }
.saudacao p { margin: 0; opacity: .95; }

/* indicador (estilo da aba Rede) */
.ind { background: #161b22; border: 1px solid #262c36; border-left: 4px solid var(--cor, var(--verde)); border-radius: 14px; padding: 12px 14px; }
.ind .rot { display: flex; align-items: center; gap: 8px; color: #a9b1bb; font-size: 12px; letter-spacing: .6px; text-transform: uppercase; }
.ind .rot .mdi { width: 16px; height: 16px; }
.ind .val { font-size: 28px; font-weight: 700; color: var(--cor, var(--verde)); margin: 2px 0; }
.ind .det { color: #a9b1bb; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* lista de eventos */
.eventos { display: flex; flex-direction: column; max-height: 380px; overflow-y: auto; }
.ev { display: grid; grid-template-columns: 52px 28px 1fr; gap: 8px; align-items: center; padding: 7px 4px; border-bottom: 1px solid #262626; font-size: 13px; }
.ev:last-child { border-bottom: 0; }
.ev .h { color: var(--sec); font-variant-numeric: tabular-nums; }
.ev .mdi { width: 18px; height: 18px; }
.ev.novo { animation: entra .6s; }
@keyframes entra { from { background: rgba(18,196,143,.18); } }

/* tabela */
.tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela th { text-align: left; color: var(--sec); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--borda); }
.tabela td { padding: 7px 8px; border-bottom: 1px solid #252525; }
.tabela tr:last-child td { border-bottom: 0; }
.ponto { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--verde); margin-right: 6px; }
.ponto.off { background: var(--vermelho); }
.ponto.av { background: var(--ambar); }

/* câmeras */
.cams { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.cam { position: relative; border-radius: 10px; overflow: hidden; background: #000; aspect-ratio: 16/9; cursor: pointer; border: 1px solid #222; }
.cam canvas { width: 100%; height: 100%; display: block; }
.cam .rot { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 6px; background: linear-gradient(transparent, rgba(0,0,0,.8)); font-size: 12px; display: flex; justify-content: space-between; }
.cam .vivo { position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 700; background: rgba(239,68,68,.9); padding: 1px 6px; border-radius: 4px; }
.cam .opcional-tag { position: absolute; top: 28px; right: 8px; }
.filtro { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pilula { border: 1px solid var(--borda); background: var(--cartao2); border-radius: 20px; padding: 7px 14px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.pilula.ativa { background: linear-gradient(90deg, #0b6fbf, #06a6d1); border-color: transparent; color: #fff; }

/* barra */
.barra { height: 6px; background: #2b2f36; border-radius: 3px; overflow: hidden; }
.barra > i { display: block; height: 100%; background: var(--cor, var(--verde)); border-radius: 3px; transition: width .6s; }

/* topologia */
.topologia { width: 100%; height: auto; display: block; }

/* modal */
.modal-fundo { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: none; place-items: center; z-index: 50; padding: 16px; }
.modal-fundo.aberto { display: grid; }
.modal { background: #1e1e1e; border: 1px solid var(--borda); border-radius: 18px; width: min(900px, 100%); max-height: 92vh; overflow: auto; }
.modal header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--borda); font-weight: 500; font-size: 16px; }
.modal header .ico-btn { margin-left: auto; }
.modal .corpo { padding: 16px; }

/* toast */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; align-items: center; pointer-events: none; }
.toast { background: #323232; color: #fff; padding: 12px 18px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.5); animation: entra .3s; max-width: 90vw; }

/* Niva */
.niva-fab { position: fixed; right: 22px; bottom: 22px; width: 58px; height: 58px; border-radius: 50%; border: 0; background: linear-gradient(140deg, #12c48f, #0b8f9e); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 8px 24px rgba(18,196,143,.35); z-index: 40; }
.niva-fab .mdi { width: 28px; height: 28px; }
.niva { position: fixed; right: 22px; bottom: 92px; width: min(380px, calc(100vw - 32px)); height: min(540px, calc(100vh - 140px)); background: #1b1f22; border: 1px solid #2b3438; border-radius: 18px; display: none; flex-direction: column; z-index: 41; box-shadow: 0 16px 50px rgba(0,0,0,.6); }
.niva.aberta { display: flex; }
.niva header { padding: 12px 14px; border-bottom: 1px solid #2b3438; display: flex; align-items: center; gap: 10px; }
.niva header b { color: var(--marca); }
.niva .msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 85%; padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; }
.msg.eu { align-self: flex-end; background: #0b6f58; border-bottom-right-radius: 4px; }
.msg.ela { align-self: flex-start; background: #2a3135; border-bottom-left-radius: 4px; }
.niva form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #2b3438; }
.niva input { flex: 1; background: #111; border: 1px solid #333; border-radius: 20px; padding: 10px 14px; color: #fff; font: inherit; }
.sugestoes { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 12px 8px; }
.sugestoes button { border: 1px solid #335; background: #1f2630; border-radius: 14px; padding: 5px 10px; font-size: 12px; cursor: pointer; color: #cfe; }

/* celular (Meu Up Life) */
.celular-moldura { width: 390px; max-width: 100%; margin: 0 auto; border-radius: 40px; border: 10px solid #000; outline: 2px solid #333; background: #0f1214; overflow: hidden; height: 780px; display: flex; flex-direction: column; }
.cel-topo { padding: 16px 18px 10px; background: linear-gradient(160deg, #0c4b3d, #0f1214); }
.cel-topo h3 { margin: 4px 0 0; font-size: 22px; }
.cel-corpo { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.cel-grade { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.faixa { border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.faixa.amarela { background: rgba(255,160,0,.15); border: 1px solid rgba(255,160,0,.5); color: #ffd27a; }
.faixa.vermelha { background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.5); color: #ffb3b3; }

/* login */
.login-pagina { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 30% 20%, #10372c, #0b0f12 60%); }
.login { width: min(400px, 100%); background: #171b1e; border: 1px solid #263036; border-radius: 22px; padding: 28px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.login img { width: 100%; max-width: 260px; display: block; margin: 0 auto 18px; border-radius: 10px; }
.login h1 { font-size: 22px; margin: 0 0 4px; text-align: center; }
.login p { text-align: center; color: var(--sec); margin: 0 0 20px; }
.login label { display: block; font-size: 13px; color: var(--sec); margin: 12px 0 4px; }
.login input, .campo { width: 100%; padding: 12px 14px; background: #0f1214; border: 1px solid #2c3439; border-radius: 10px; color: #fff; font: inherit; }
.login input:focus, .campo:focus { outline: 2px solid var(--marca); border-color: transparent; }
.btn { border: 0; border-radius: 10px; padding: 12px 16px; background: var(--marca); color: #04261c; font-weight: 700; cursor: pointer; }
.btn.sec { background: #2a2f33; color: #ddd; font-weight: 500; }
.btn.perigo { background: #5a1d1d; color: #ffb4b4; font-weight: 500; }
.btn.peq { padding: 6px 10px; font-size: 12px; }
.login .btn { width: 100%; margin-top: 20px; }
.erro { color: #ff8a8a; text-align: center; min-height: 20px; margin-top: 10px; }
.aviso-legal { font-size: 11px; color: #6f7a80; text-align: center; margin-top: 16px; }

/* ---------- celular ---------- */
@media (max-width: 860px) {
  .casca { grid-template-columns: 1fr; }
  .lateral { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 45; transform: translateX(-100%); transition: transform .2s; }
  .lateral.aberta { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.5); }
  .topo .menu-btn { display: grid; }
  .conteudo { padding: 14px 12px 90px; }
  .secao .c3, .secao .c4 { grid-column: span 6 !important; }
  .celular-moldura { border: 0; outline: 0; border-radius: 0; height: auto; min-height: 70vh; }
}

/* guia da Niva */
.niva-rotulo { position: fixed; right: 88px; bottom: 36px; background: #12c48f; color: #04261c; font-weight: 700; padding: 6px 12px; border-radius: 14px; z-index: 40; box-shadow: 0 6px 18px rgba(0,0,0,.4); animation: entra .5s; cursor: pointer; }
.niva-guia { background: #20272b; border: 1px solid #2f3a40; border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.niva-guia h4 { margin: 8px 0 4px; font-size: 13px; color: #8ff0c9; }
.niva-guia button { display: block; text-align: left; width: 100%; border: 0; background: none; color: #cfe; padding: 3px 0; cursor: pointer; font-size: 13px; }
.niva-guia button:hover { color: #fff; text-decoration: underline; }
.niva-guia .nota { color: #8b98a8; font-size: 11px; margin-top: 8px; }
