/* =====================================================================
   Painel administrativo
   ===================================================================== */
body.admin { min-height: 100vh; }
code { font-family: var(--mono); background: rgba(0, 0, 0, .06); padding: .05em .35em; border-radius: 4px; font-size: .9em; }

/* ---------- Login ---------- */
.login-fundo { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: linear-gradient(160deg, var(--azul-900), var(--azul-700)); }
.login-caixa { width: 100%; max-width: 420px; }
.login-marca { display: flex; gap: .8rem; align-items: center; margin-bottom: 1.4rem; }
.login-marca > span { width: 48px; height: 48px; border-radius: 12px; background: var(--azul-800); color: #fff; display: grid; place-items: center; }
.login-marca .icone { width: 26px; height: 26px; }
.login-marca strong { display: block; font-size: 1.2rem; color: var(--azul-900); }
.login-marca small { color: var(--texto-suave); }
.login-aviso { margin-top: 1rem; font-size: .85rem; }
.rodape-login { text-align: center; color: var(--texto-suave); font-size: .82rem; margin: 1rem 0 0; }
.largura-total { width: 100%; }

/* ---------- Estrutura ---------- */
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - 30px); background: linear-gradient(to right, var(--azul-900) 250px, transparent 250px); }
.menu { background: var(--azul-900); color: #c9d6ea; padding: 1rem .7rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.menu-marca { display: flex; gap: .7rem; align-items: center; padding: .3rem .5rem 1.2rem; border-bottom: 1px solid rgba(255, 255, 255, .1); margin-bottom: .8rem; }
.menu-marca > span { width: 40px; height: 40px; border-radius: 10px; background: var(--azul-700); color: #fff; display: grid; place-items: center; }
.menu-marca strong { display: block; color: #fff; }
.menu-marca small { color: #94a8c6; }
.menu nav button {
  display: flex; align-items: center; gap: .7rem; width: 100%; border: 0; background: none; color: inherit;
  font: inherit; padding: .65rem .75rem; border-radius: 8px; cursor: pointer; text-align: left; font-weight: 500;
}
.menu nav button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.menu nav button.ativo { background: var(--azul-700); color: #fff; font-weight: 700; }
.menu nav .grupo { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #7d93b5; padding: .9rem .75rem .3rem; }

.conteudo { display: flex; flex-direction: column; min-width: 0; }
.topo-admin { display: flex; align-items: center; gap: 1rem; padding: .8rem 1.5rem; background: #fff; border-bottom: 1px solid var(--borda); position: sticky; top: 0; z-index: 20; }
.topo-titulo { flex: 1; font-weight: 700; color: var(--azul-900); font-size: 1.05rem; }
.topo-usuario { display: flex; align-items: center; gap: .6rem; }
.menu-botao { display: none; }
.vista { padding: 1.5rem; flex: 1; outline: none; max-width: 1400px; width: 100%; }
.rodape-admin { text-align: center; padding: 1rem; color: var(--texto-suave); font-size: .85rem; border-top: 1px solid var(--borda); background: #fff; }

/* ---------- Componentes das telas ---------- */
.cab-vista { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.cab-vista h1 { margin: 0; }
.cab-vista p { margin: .2rem 0 0; color: var(--texto-suave); }
.acoes { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filtros { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; background: #fff; border: 1px solid var(--borda); border-radius: var(--raio); padding: .9rem 1rem; margin-bottom: 1rem; }
.filtros .campo { margin: 0; min-width: 160px; }
.filtros .campo.largo { min-width: 240px; flex: 1; }

.indicadores { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.indicador { background: #fff; border: 1px solid var(--borda); border-radius: var(--raio); padding: .9rem 1rem; box-shadow: var(--sombra); }
.indicador span { display: block; font-size: .78rem; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.indicador strong { display: block; font-size: 1.55rem; color: var(--azul-900); font-variant-numeric: tabular-nums; margin-top: .15rem; }
.indicador small { color: var(--texto-suave); }
.indicador.verde strong { color: var(--verde); }
.indicador.vermelho strong { color: var(--vermelho); }
.indicador.ambar strong { color: var(--ambar); }

.secao { margin-bottom: 1.5rem; }
.secao > h2 { display: flex; align-items: center; gap: .5rem; }
.duas-colunas { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.2rem; }

.abas { display: flex; gap: .3rem; border-bottom: 2px solid var(--borda); margin-bottom: 1.2rem; overflow-x: auto; }
.abas button { border: 0; background: none; font: inherit; font-weight: 600; padding: .7rem 1rem; color: var(--texto-suave); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.abas button.ativo { color: var(--azul-800); border-bottom-color: var(--azul-700); }

.marcas-dia { display: flex; flex-wrap: wrap; gap: .25rem; }
.marca { font-family: var(--mono); font-size: .8rem; background: var(--azul-50); border: 1px solid #d4e0f1; border-radius: 5px; padding: .05rem .35rem; white-space: nowrap; }
.marca.correcao { background: var(--ambar-claro); border-color: #f0d58a; }
.marca.vazia { background: none; border-style: dashed; color: #9aa4b2; }
.ocorr { font-size: .8rem; display: block; color: var(--texto-suave); min-width: 170px; }
.ocorr.vermelho { color: var(--vermelho); font-weight: 600; }
.ocorr.ambar { color: #8a5a0b; }

.memoria { background: #f7f9fc; border-left: 3px solid var(--azul-600); padding: .6rem .9rem; font-size: .85rem; margin: .2rem 0; }
.memoria li { margin-bottom: .2rem; }
tr.detalhe td { background: #fbfcfe; }
tr.clicavel { cursor: pointer; }

.lista-chave { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .9rem; }
.lista-chave dt { color: var(--texto-suave); }
.lista-chave dd { margin: 0; word-break: break-word; }

.dias-semana { display: grid; gap: .4rem; }
.linha-dia { display: grid; grid-template-columns: 110px repeat(4, minmax(0, 1fr)); gap: .4rem; align-items: center; }
.linha-dia input { min-height: 36px; padding: .3em .4em; }
.linha-escala { display: grid; grid-template-columns: 90px 120px minmax(0, 1fr); gap: .5rem; align-items: center; padding: .3rem 0; border-bottom: 1px solid #f0f2f6; }
.caixa-rolagem { max-height: 340px; overflow-y: auto; padding-right: .3rem; }

.status-lista { list-style: none; padding: 0; margin: 0; }
.status-lista li { display: flex; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid #eef1f5; align-items: flex-start; }
.status-lista .etiqueta { min-width: 92px; justify-content: center; }

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; background: none; }
  .menu { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .2s; height: 100vh; }
  .menu.aberto { transform: none; box-shadow: var(--sombra-forte); }
  .menu-botao { display: inline-flex; }
  .vista { padding: 1rem; }
  .topo-admin { padding: .6rem 1rem; }
  .topo-usuario .etiqueta { display: none; }
  .linha-dia { grid-template-columns: 1fr 1fr; }
  .linha-dia > :first-child { grid-column: 1 / -1; }
}

/* ---------- Impressão de relatórios ---------- */
@media print {
  .menu, .topo-admin, .filtros, .acoes, .faixa-prototipo, .rodape-admin, .toast-area, .aviso.info { display: none !important; }
  .layout { display: block; }
  .vista { padding: 0; }
  body { background: #fff; font-size: 11px; }
  .tabela-rolagem { overflow: visible; border: 0; }
  th { position: static; }
  .indicador { box-shadow: none; }
}

.barra-cartoes { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.barra-cartoes strong { display: inline-flex; gap: .4rem; align-items: center; color: var(--azul-900); }

/* ---------- Fotos ---------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--azul-700); color: #fff; display: inline-grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.avatar-foto { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: #dfe5ee; }
.avatar.mini, .avatar-foto.mini { width: 36px; height: 36px; font-size: .8rem; }
.func-linha { display: flex; gap: .6rem; align-items: center; }
.campo-foto { display: flex; gap: 1rem; align-items: center; background: var(--azul-50); border: 1px solid #c9d8ee; border-radius: var(--raio-p); padding: .8rem; margin-bottom: 1rem; }
.foto-preview .avatar, .foto-preview .avatar-foto { width: 96px; height: 96px; border-radius: 14px; font-size: 1.8rem; }
.comparar { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.comparar figure { margin: 0; text-align: center; }
.comparar img, .comparar .vazia { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: #e9edf3; display: grid; place-items: center; color: var(--texto-suave); font-size: .8rem; }
.comparar figcaption { font-size: .75rem; color: var(--texto-suave); margin-top: .2rem; }
.grade-fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.cartao-foto { background: #fff; border: 1px solid var(--borda); border-radius: var(--raio); padding: .8rem; box-shadow: var(--sombra); }
.cartao-foto header { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; font-size: .9rem; }

/* ---------- Logotipo ---------- */
.logo-preview { min-width: 120px; min-height: 60px; display: grid; place-items: center; background: #fff; border: 1px dashed var(--borda); border-radius: 8px; padding: .4rem; }
.logo-preview img { max-width: 200px; max-height: 90px; object-fit: contain; }
.cab-relatorio { display: flex; align-items: center; gap: 1rem; padding-bottom: .8rem; margin-bottom: 1rem; border-bottom: 2px solid var(--azul-900); }
.cab-relatorio img { max-height: 56px; max-width: 160px; object-fit: contain; }
.cab-relatorio > div { flex: 1; }
.cab-relatorio-data { color: var(--texto-suave); }
.menu-marca img { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; background: #fff; padding: 2px; }
@media print { .cab-relatorio { border-bottom-color: #000; } }

.texto-vermelho { color: var(--vermelho) !important; }
