/* ==========================================================================
   CartazPRO — estilos do painel
   ========================================================================== */
:root {
  --cor: #e11d48;
  --cor-rgb: 225, 29, 72;
  --cor-escura: #9f1239;
  --navy-1: #0b1533;
  --navy-2: #1b2d63;
  --texto: #1c2333;
  --suave: #6b7487;
  --linha: #e6e9f0;
  --fundo: #f4f6fa;
  --fundo-alt: #eceff5;
  --branco: #ffffff;
  --ok: #16a34a;
  --alerta: #d97706;
  --erro: #dc2626;
  --raio: 14px;
  --sombra: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
}

html, body { overflow-x: hidden; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--texto);
  background: var(--fundo);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cor); text-decoration: none; }
a:hover { color: var(--cor-escura); }
.ico { flex-shrink: 0; vertical-align: middle; }
h1, h2, h3, h4, h5 { font-weight: 800; letter-spacing: -.01em; }

/* ---------- Botões ---------- */
.btn { font-weight: 700; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.btn-cor { background: var(--cor); border-color: var(--cor); color: #fff; }
.btn-cor:hover, .btn-cor:focus { background: var(--cor-escura); border-color: var(--cor-escura); color: #fff; }
.btn-claro { background: #fff; border: 1px solid var(--linha); color: var(--texto); }
.btn-claro:hover { background: var(--fundo-alt); color: var(--texto); }
.btn-icone { width: 38px; height: 38px; padding: 0; }
.btn-sm.btn-icone { width: 32px; height: 32px; }
.form-control, .form-select { border-radius: 10px; border-color: #d9dee8; padding: .6rem .8rem; }
.form-control:focus, .form-select:focus { border-color: var(--cor); box-shadow: 0 0 0 .2rem rgba(var(--cor-rgb), .15); }
.form-label { font-weight: 700; font-size: .85rem; color: #3a4357; margin-bottom: .3rem; }
.form-text { color: var(--suave); }
.form-check-input:checked { background-color: var(--cor); border-color: var(--cor); }

/* ---------- Layout do painel ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 258px; z-index: 1040;
  background: linear-gradient(180deg, var(--navy-1) 0%, var(--navy-2) 100%);
  color: #c9d3ee; display: flex; flex-direction: column; padding: 18px 14px;
  transition: transform .25s ease;
}
.marca { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; color: #fff; }
.marca:hover { color: #fff; }
.monograma {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--cor); color: #fff; font-weight: 800; font-size: 1rem; flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(var(--cor-rgb), .45);
}
.marca img { max-height: 40px; max-width: 170px; border-radius: 8px; background: #fff; padding: 3px; }
.marca-nome { font-weight: 800; font-size: 1.08rem; line-height: 1.1; }
.marca-sub { font-size: .72rem; color: #8f9cc4; font-weight: 600; }
.nav-secao { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: #7584b3; font-weight: 800; padding: 16px 12px 6px; }
.nav-item-link {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: #c9d3ee; font-weight: 600; font-size: .92rem; margin-bottom: 2px;
}
.nav-item-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item-link.ativo { background: rgba(255, 255, 255, .11); color: #fff; }
.nav-item-link.ativo::before {
  content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--cor);
}
.nav-item-link.destaque { background: var(--cor); color: #fff; margin: 6px 0 4px; box-shadow: 0 6px 18px rgba(var(--cor-rgb), .35); }
.nav-item-link.destaque:hover { filter: brightness(1.06); }
.sidebar-rodape { margin-top: auto; padding: 12px; font-size: .75rem; color: #7584b3; }
.sidebar-scroll { overflow-y: auto; flex: 1; margin: 0 -6px; padding: 0 6px; }

.principal { margin-left: 258px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1020; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--linha); height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 24px;
}
.topbar h1 { font-size: 1.15rem; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-usuario { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--fundo); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-2); color: #fff; font-weight: 800; font-size: .8rem; flex-shrink: 0; }
.chip-usuario .nome { font-weight: 700; font-size: .85rem; line-height: 1.1; }
.chip-usuario .cargo { font-size: .72rem; color: var(--suave); }
.btn-sair { color: var(--suave); }
.btn-sair:hover { color: var(--erro); background: #fef2f2; }
.btn-menu { display: none; }
.conteudo { padding: 24px; flex: 1; width: 100%; max-width: 1320px; }
.faixa-master { background: #fff7ed; border-bottom: 1px solid #fed7aa; color: #9a3412; padding: 8px 24px; font-weight: 700; font-size: .85rem; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- Cartões ---------- */
.cartao { background: var(--branco); border: 1px solid var(--linha); border-radius: var(--raio); box-shadow: var(--sombra); }
.cartao-corpo { padding: 20px; }
.cartao-titulo { font-size: 1rem; font-weight: 800; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.stat { padding: 18px 20px; }
.stat-rotulo { display: flex; align-items: center; gap: 8px; color: var(--suave); font-weight: 700; font-size: .82rem; }
.stat-rotulo::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ponto, var(--cor)); }
.stat-valor { font-size: 1.9rem; font-weight: 800; margin-top: 6px; line-height: 1; }
.stat-extra { font-size: .78rem; color: var(--suave); margin-top: 6px; }
.barra { height: 6px; border-radius: 6px; background: var(--fundo-alt); overflow: hidden; margin-top: 8px; }
.barra > span { display: block; height: 100%; background: var(--cor); border-radius: 6px; }

.cabecalho-pagina { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.cabecalho-pagina h2 { font-size: 1.35rem; margin: 0; }
.cabecalho-pagina p { margin: 2px 0 0; color: var(--suave); }

.alerta { border-radius: 12px; padding: 12px 16px; font-weight: 600; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.alerta-ok { background: #ecfdf3; color: #166534; border: 1px solid #bbf7d0; }
.alerta-erro { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alerta-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.selo { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 800; }
.selo-ok { background: #dcfce7; color: #166534; }
.selo-erro { background: #fee2e2; color: #991b1b; }
.selo-cinza { background: var(--fundo-alt); color: #475069; }
.selo-cor { background: rgba(var(--cor-rgb), .12); color: var(--cor-escura); }

.vazio { text-align: center; padding: 48px 20px; color: var(--suave); }
.vazio .ico { color: #b6bfd3; margin-bottom: 10px; }
.vazio h3 { color: var(--texto); font-size: 1.1rem; }

/* ---------- Tabelas (viram cartões no celular) ---------- */
.tabela { width: 100%; border-collapse: separate; border-spacing: 0; }
.tabela th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); font-weight: 800; padding: 12px 14px; border-bottom: 1px solid var(--linha); background: #fafbfd; white-space: nowrap; }
.tabela td { padding: 12px 14px; border-bottom: 1px solid var(--linha); vertical-align: middle; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela tbody tr:hover { background: #fafbff; }
.celula-acoes { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.miniatura { width: 48px; height: 48px; border-radius: 10px; object-fit: contain; background: var(--fundo); border: 1px solid var(--linha); }
.miniatura-vazia { width: 48px; height: 48px; border-radius: 10px; background: var(--fundo-alt); display: grid; place-items: center; color: #9aa4ba; }

/* ---------- Galeria de cartazes ---------- */
.grade-cartazes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.item-cartaz { background: #fff; border: 1px solid var(--linha); border-radius: var(--raio); overflow: hidden; box-shadow: var(--sombra); display: flex; flex-direction: column; min-width: 0; }
.item-cartaz .capa { aspect-ratio: 3 / 4; background: var(--fundo-alt) center / contain no-repeat; display: block; position: relative; }
.item-cartaz .capa-vazia { display: grid; place-items: center; height: 100%; color: #9aa4ba; font-weight: 700; font-size: .85rem; }
.item-cartaz .info { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.item-cartaz .titulo { font-weight: 800; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--texto); }
.item-cartaz .meta { font-size: .75rem; color: var(--suave); display: flex; gap: 6px; flex-wrap: wrap; }
.item-cartaz .acoes { display: flex; gap: 6px; margin-top: 4px; }
.item-cartaz .acoes form { margin: 0; }

/* ---------- Novo cartaz ---------- */
.escolha-formatos { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.opcao-formato { border: 2px solid var(--linha); border-radius: 12px; padding: 12px 8px 10px; text-align: center; cursor: pointer; background: #fff; transition: .15s; user-select: none; }
.opcao-formato:hover { border-color: #c4cbe0; }
.opcao-formato.ativo { border-color: var(--cor); background: rgba(var(--cor-rgb), .05); }
.opcao-formato .forma { margin: 0 auto 8px; border: 2px solid #9aa4ba; border-radius: 4px; background: var(--fundo); }
.opcao-formato.ativo .forma { border-color: var(--cor); background: rgba(var(--cor-rgb), .12); }
.opcao-formato .nome { font-weight: 800; font-size: .8rem; line-height: 1.15; }
.grade-temas { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.opcao-tema { border: 2px solid transparent; border-radius: 14px; overflow: hidden; cursor: pointer; background: #fff; box-shadow: var(--sombra); transition: .15s; min-width: 0; }
.opcao-tema:hover { transform: translateY(-2px); }
.opcao-tema.ativo { border-color: var(--cor); box-shadow: 0 0 0 4px rgba(var(--cor-rgb), .18); }
.opcao-tema .previa { background: var(--fundo-alt); display: grid; place-items: center; aspect-ratio: 3 / 4; overflow: hidden; }
.opcao-tema .previa img { width: 100%; height: 100%; object-fit: contain; }
.opcao-tema .previa .carregando { width: 28px; height: 28px; border: 3px solid #d5dbe8; border-top-color: var(--cor); border-radius: 50%; animation: gira 0.8s linear infinite; }
.opcao-tema .rotulo { padding: 9px 12px; font-weight: 800; font-size: .85rem; display: flex; justify-content: space-between; align-items: center; }
@keyframes gira { to { transform: rotate(360deg); } }
.lista-escolha { max-height: 380px; overflow-y: auto; border: 1px solid var(--linha); border-radius: 12px; }
.linha-escolha { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--linha); cursor: pointer; min-width: 0; }
.linha-escolha:last-child { border-bottom: 0; }
.linha-escolha:hover { background: #fafbff; }
.linha-escolha .nome { font-weight: 700; font-size: .9rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linha-escolha .preco { font-weight: 800; color: var(--cor-escura); white-space: nowrap; }
.linha-escolha img, .linha-escolha .miniatura-vazia { width: 40px; height: 40px; }
.barra-fixa { position: sticky; bottom: 0; background: rgba(255, 255, 255, .95); backdrop-filter: blur(6px); border-top: 1px solid var(--linha); padding: 12px 24px; margin: 24px -24px -24px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; z-index: 5; }

/* ---------- Foto do produto / logo ---------- */
.area-foto { border: 2px dashed #cbd2e1; border-radius: 14px; background: repeating-conic-gradient(#f3f5f9 0% 25%, #fff 0% 50%) 50% / 22px 22px; aspect-ratio: 1; display: grid; place-items: center; position: relative; overflow: hidden; cursor: pointer; }
.area-foto img { max-width: 92%; max-height: 92%; object-fit: contain; }
.area-foto .dica { text-align: center; color: var(--suave); font-weight: 700; font-size: .88rem; padding: 16px; }
.area-foto.logo { aspect-ratio: 16 / 9; }
.area-foto.carregando::after { content: ''; position: absolute; inset: 0; background: rgba(255, 255, 255, .7) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 50 50"><circle cx="25" cy="25" r="20" fill="none" stroke="%23e11d48" stroke-width="5" stroke-dasharray="90 40"><animateTransform attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.8s" repeatCount="indefinite"/></circle></svg>') center no-repeat; }

/* ---------- Telas de acesso ---------- */
.acesso { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.acesso-lado { background: linear-gradient(150deg, var(--navy-1), var(--navy-2)); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.acesso-lado h2 { font-size: 2.3rem; line-height: 1.12; max-width: 460px; }
.acesso-lado p { color: #b7c3e6; max-width: 420px; font-size: 1.02rem; }
.acesso-lado .vitrine { position: absolute; right: -40px; bottom: -30px; width: 54%; transform: rotate(-7deg); border-radius: 14px; box-shadow: 0 30px 60px rgba(0, 0, 0, .45); }
.acesso-form { display: grid; place-items: center; padding: 32px 20px; background: #fff; }
.acesso-caixa { width: 100%; max-width: 400px; }
.acesso-caixa h1 { font-size: 1.6rem; }
.lista-beneficios { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; }
.lista-beneficios li { display: flex; gap: 10px; align-items: center; color: #dfe6fa; font-weight: 600; }
.lista-beneficios .ico { color: #6ee7b7; }

/* ---------- Responsivo ---------- */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  body.menu-aberto .sidebar { transform: none; }
  body.menu-aberto .sidebar-fundo { position: fixed; inset: 0; background: rgba(10, 15, 30, .45); z-index: 1030; }
  .principal { margin-left: 0; }
  .btn-menu { display: inline-flex; }
  .topbar { padding: 0 14px; }
  .conteudo { padding: 16px; }
  .barra-fixa { margin: 16px -16px -16px; padding: 12px 16px; }
  .chip-usuario .textos { display: none; }
  .chip-usuario { padding: 3px; }
  .acesso { grid-template-columns: 1fr; }
  .acesso-lado { display: none; }
}

@media (max-width: 767.98px) {
  .tabela-responsiva thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .tabela-responsiva, .tabela-responsiva tbody, .tabela-responsiva tr, .tabela-responsiva td { display: block; width: 100%; }
  .tabela-responsiva tr { border: 1px solid var(--linha); border-radius: 12px; margin-bottom: 12px; overflow: hidden; background: #fff; }
  .tabela-responsiva tbody tr:nth-child(even) { background: #f7f8fb; }
  .tabela-responsiva td { border-bottom: 1px solid var(--linha); display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; min-width: 0; }
  .tabela-responsiva td::before { content: attr(data-rotulo); font-weight: 800; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); text-align: left; flex-shrink: 0; }
  .tabela-responsiva td:first-child { background: rgba(var(--cor-rgb), .1); font-weight: 800; text-align: left; }
  .tabela-responsiva td:first-child::before { display: none; }
  .tabela-responsiva td:first-child::before { color: var(--cor-escura); }
  .tabela-responsiva td:has(.celula-acoes)::before { display: none; }
  .tabela-responsiva td:has(.celula-acoes) { justify-content: flex-end; }
  .tabela-responsiva td:last-child { border-bottom: 0; }
  .grade-cartazes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .grade-temas { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cabecalho-pagina .btn { flex: 1 1 auto; }
}

[data-dispositivo="celular"] .stat-valor { font-size: 1.5rem; }
