/* Painel administrativo */
:root {
  --azul: #184465; --azul-escuro: #0e2b42; --azul-claro: #e8f0f6; --ouro: #e39b18;
  --texto: #1f2a33; --suave: #5b6873; --fundo: #f3f5f7; --borda: #dfe5ea; --branco: #fff;
  --ok: #2e8b57; --perigo: #c0392b; --raio: 10px;
  --sombra: 0 1px 2px rgba(14, 43, 66, .06), 0 3px 12px rgba(14, 43, 66, .06);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 var(--sans); color: var(--texto); background: var(--fundo); }
a { color: var(--azul); }
h1 { font-size: 1.5rem; margin: 0 0 .4em; color: var(--azul-escuro); }
h2 { font-size: 1.1rem; margin: 0 0 .8em; color: var(--azul-escuro); }
img { max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--ouro); outline-offset: 2px; }

/* barra superior */
.barra { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; height: 56px; padding: 0 18px; background: var(--azul-escuro); color: #fff; }
.barra a { color: #fff; text-decoration: none; }
.barra__marca { font-weight: 700; font-size: 1.05rem; }
.barra__marca span { font-weight: 400; color: #ffd27a; margin-left: .3em; }
.barra__usuario { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: .9rem; }
.barra__usuario form { margin: 0; }
.barra__menu { display: none; background: none; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; }
.link { background: none; border: 0; color: #fff; font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }

.estrutura { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100vh - 56px); }
.lateral { background: var(--branco); border-right: 1px solid var(--borda); padding: 14px 10px 30px; }
.lateral a { display: block; padding: .5em .8em; border-radius: 8px; text-decoration: none; color: var(--texto); }
.lateral a:hover { background: var(--fundo); }
.lateral a.ativo { background: var(--azul-claro); color: var(--azul-escuro); font-weight: 600; }
.lateral__grupo { margin: 1.1em .8em .3em; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--suave); }
.principal { padding: 26px clamp(14px, 3vw, 36px) 60px; max-width: 1200px; width: 100%; }

/* componentes */
.cabecalho { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cabecalho h1 { margin: 0; }
.subtitulo, .contagem, .log, .ajuda { color: var(--suave); }
.contagem { font-size: .9rem; margin: 0 0 8px; }
.log { font-size: .85rem; margin-top: 18px; }
.ajuda { font-size: .85rem; margin: .3em 0 0; }
.trilha { margin: 0 0 6px; font-size: .9rem; }
.trilha a { text-decoration: none; }
.vazio { color: var(--suave); background: var(--branco); border: 1px dashed var(--borda); border-radius: var(--raio); padding: 18px; text-align: center; }
.obrig { color: var(--perigo); }

.botao { display: inline-flex; align-items: center; gap: .4em; background: var(--azul); color: #fff; border: 0; border-radius: 8px; padding: .6em 1.1em; font: 600 .95rem var(--sans); cursor: pointer; text-decoration: none; white-space: nowrap; }
.botao:hover { background: var(--azul-escuro); color: #fff; }
.botao--secundario { background: var(--azul-claro); color: var(--azul-escuro); }
.botao--secundario:hover { background: #d3e2ed; color: var(--azul-escuro); }
.botao--perigo { background: #fbe9e7; color: var(--perigo); }
.botao--perigo:hover { background: var(--perigo); color: #fff; }
.botao--ok { background: #e3f4ea; color: var(--ok); }
.botao--ok:hover { background: var(--ok); color: #fff; }
.botao--pequeno { padding: .35em .75em; font-size: .85rem; }
.botao--largo { width: 100%; justify-content: center; padding: .8em; }

.alerta { border-radius: 8px; padding: .8em 1em; margin-bottom: 14px; border-left: 5px solid; background: var(--branco); }
.alerta--ok { background: #eaf7ee; border-color: var(--ok); color: #1d5c39; }
.alerta--erro { background: #fdecec; border-color: var(--perigo); color: #85261c; }
.alerta--aviso { background: #fff6e0; border-color: var(--ouro); color: #6d4a06; }

.etiqueta { display: inline-block; padding: .1em .55em; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.etiqueta--ok { background: #e3f4ea; color: var(--ok); }
.etiqueta--pendente { background: #fff1d6; color: #8a5a00; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin: 18px 0; }
.card { background: var(--branco); border-radius: var(--raio); box-shadow: var(--sombra); padding: 16px 18px; text-decoration: none; color: var(--texto); border-top: 4px solid var(--azul-claro); }
.card--destaque { border-top-color: var(--ouro); }
.card__valor { display: block; font-size: 2rem; font-weight: 700; color: var(--azul-escuro); line-height: 1.1; }
.card__rotulo { font-size: .9rem; color: var(--suave); }
.colunas { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.painel-caixa { background: var(--branco); border-radius: var(--raio); box-shadow: var(--sombra); padding: 18px 20px; margin-bottom: 16px; }
.lista-simples { list-style: none; padding: 0; margin: 0 0 10px; }
.lista-simples li { padding: .45em 0; border-bottom: 1px solid var(--fundo); }
.lista-simples a { text-decoration: none; }
.atalhos { display: flex; flex-wrap: wrap; gap: 10px; }
.atalhos form { margin: 0; }

/* filtros e tabela */
.filtros { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filtros input[type=search] { flex: 1 1 260px; }
.tabela-rolagem { overflow-x: auto; background: var(--branco); border-radius: var(--raio); box-shadow: var(--sombra); }
.tabela { width: 100%; border-collapse: collapse; }
.tabela th, .tabela td { padding: .65em .8em; text-align: left; border-bottom: 1px solid var(--fundo); vertical-align: middle; }
.tabela th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); background: #fafbfc; white-space: nowrap; }
.tabela th a { color: inherit; text-decoration: none; }
.tabela tbody tr:hover { background: #fafcfd; }
.tabela td a { text-decoration: none; font-weight: 600; }
.tabela .acoes { text-align: right; white-space: nowrap; }
.tabela .acoes form { display: inline; margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.mini { max-height: 48px; max-width: 120px; border-radius: 4px; display: block; }
.sem-imagem { font-size: .8rem; color: var(--suave); }

.paginacao ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 16px 0 0; justify-content: center; }
.paginacao a, .paginacao span { display: block; padding: .35em .75em; border: 1px solid var(--borda); border-radius: 8px; background: var(--branco); text-decoration: none; }
.paginacao span[aria-current] { background: var(--azul); border-color: var(--azul); color: #fff; }

/* formulários */
.formulario { background: var(--branco); border-radius: var(--raio); box-shadow: var(--sombra); padding: 22px; }
.formulario fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.formulario h2 { margin-top: 1.4em; }
.grade-campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px 20px; }
.campo--cheio { grid-column: 1 / -1; }
.campo > label, .campo legend { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .35em; }
.campo label.sub { font-weight: 400; margin-top: .6em; font-size: .85rem; color: var(--suave); }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: .55em .7em; font: 15px var(--sans); color: var(--texto); background: #fff; border: 1px solid #c8d1d9; border-radius: 8px;
}
.filtros input, .filtros select { width: auto; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px rgba(24, 68, 101, .15); }
input:disabled, select:disabled, textarea:disabled { background: var(--fundo); }
.campo--erro input, .campo--erro select, .campo--erro textarea, .campo--erro .tox-tinymce { border-color: var(--perigo) !important; }
.erro-campo { color: var(--perigo); font-size: .85rem; margin: .3em 0 0; font-weight: 600; }
.opcoes { border: 0; padding: 0; margin: 0; }
.opcao { display: inline-flex; align-items: center; gap: .35em; margin-right: 1.2em; font-weight: 400 !important; cursor: pointer; }
.direitos { border: 1px solid var(--borda); border-radius: 8px; padding: 10px 14px; }
.direitos__linha { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: .4em 0; border-bottom: 1px solid var(--fundo); }
.direitos__linha > span { width: 130px; font-weight: 600; font-size: .9rem; }
.imagem-atual { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; font-size: .85rem; }
.imagem-atual img { max-height: 100px; border-radius: 6px; border: 1px solid var(--borda); }
.previa { display: block; max-height: 120px; margin-top: 8px; border-radius: 6px; }
.barra-acoes { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--fundo); }
.barra-acoes--topo { margin: 0 0 12px; padding: 0; border: 0; }

/* fotos */
.zona-envio { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px; border: 2px dashed #b9c7d3; border-radius: var(--raio); text-align: center; cursor: pointer; background: #fafcfd; }
.zona-envio.arrastando { border-color: var(--azul); background: var(--azul-claro); }
.zona-envio input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.zona-envio small { color: var(--suave); }
.fila-envio { list-style: none; padding: 0; margin: 12px 0 0; }
.fila-envio li { display: grid; grid-template-columns: 1fr 160px 140px; gap: 10px; align-items: center; padding: .35em 0; font-size: .9rem; border-bottom: 1px solid var(--fundo); }
.fila-envio li.ok .fila__status { color: var(--ok); font-weight: 600; }
.fila-envio li.erro .fila__status { color: var(--perigo); font-weight: 600; }
.fila-envio progress { width: 100%; }
.fila__nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grade-admin { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.grade-admin label { position: relative; display: block; background: var(--branco); border-radius: 8px; box-shadow: var(--sombra); overflow: hidden; cursor: pointer; }
.grade-admin img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.grade-admin input { position: absolute; top: 8px; left: 8px; width: 20px; height: 20px; }
.grade-admin span { display: block; font-size: .75rem; padding: .3em .5em; color: var(--suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grade-admin input:checked ~ span { background: #fbe9e7; color: var(--perigo); }

/* login */
.tela-login { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(160deg, var(--azul-escuro), var(--azul)); padding: 16px; }
.login { background: var(--branco); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.25); padding: 28px; width: 100%; max-width: 400px; }
.login__logo { display: block; margin: 0 auto 14px; border-radius: 6px; }
.login h1 { text-align: center; font-size: 1.25rem; }
.login label { display: block; font-weight: 600; margin-bottom: 14px; font-size: .9rem; }
.login input { margin-top: .3em; }
.login__voltar { text-align: center; margin: 14px 0 0; font-size: .9rem; }

@media (max-width: 860px) {
  .barra__menu { display: block; }
  .barra__usuario a[target] { display: none; }
  .estrutura { grid-template-columns: 1fr; }
  .lateral { display: none; position: fixed; top: 56px; left: 0; bottom: 0; width: 260px; z-index: 15; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
  .menu-aberto .lateral { display: block; }
  /* tabela vira cartões */
  .tabela thead { display: none; }
  .tabela, .tabela tbody, .tabela tr, .tabela td { display: block; width: 100%; }
  .tabela tr { border-bottom: 6px solid var(--fundo); padding: 6px 0; }
  .tabela td { border: 0; padding: .3em .9em; }
  .tabela td[data-rotulo]::before { content: attr(data-rotulo) ": "; font-size: .75rem; color: var(--suave); text-transform: uppercase; }
  .tabela .acoes { text-align: left; white-space: normal; }
  .fila-envio li { grid-template-columns: 1fr; gap: 2px; }
}
