/* Identidade raiseUP: mesma base dos relatórios em PDF (verde escuro, verde limão, Space Mono + Poppins). */
.viz-root {
  color-scheme: light;
  --verde: #0E5543;
  --verde-fundo: #0D5644;
  --verde-medio: #2E7A4C;
  --verde-texto: #5BA83A;
  --limao: #9FDE5F;
  --cinza-verde: #6E8F82;
  --pagina: #F7F7F7;
  --surface-1: #FFFFFF;
  --text-primary: #0E2A22;
  --text-secondary: #4A5F57;
  --text-muted: #7D8F88;
  --grid: #E6ECE9;
  --axis: #C3D1CB;
  --borda: rgba(14, 85, 67, 0.12);
  --series-1: #0E5543;
  --series-1-hover: #2E7A4C;
  --bom: #2E7A4C;
  --ruim: #C23B3B;
  --lavagem: rgba(159, 222, 95, 0.18);
  --mono: "Space Mono", ui-monospace, monospace;
  --sans: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: #F7F7F7; }

.viz-root { min-height: 100vh; background: var(--pagina); color: var(--text-primary); font: 14px/1.5 var(--sans); }
h1, h2, h3 { margin: 0; font-weight: 600; }
h3 { font-size: 15px; margin-bottom: 12px; color: var(--verde); }
.muted { color: var(--text-secondary); }
.pequeno { font-size: 12px; margin: 0 0 12px; }
.erro { color: var(--ruim); margin: 0; font-size: 13px; }
button { font: inherit; cursor: pointer; }
select, input {
  font: inherit; color: var(--text-primary); background: var(--surface-1);
  border: 1px solid var(--borda); border-radius: 8px; padding: 7px 10px;
}
select:focus, input:focus { outline: 2px solid var(--limao); outline-offset: 1px; }

/* ---------- marca d'água ---------- */
.marca-dagua {
  position: absolute; left: 30%; right: -70%; top: -40%; bottom: -40%; display: flex; align-items: center; justify-content: center; pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,.35) 35%, #000 75%);
          mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,.35) 35%, #000 75%);
}
.marca-dagua .rot { transform: rotate(-24deg); transform-origin: center; }
.marca-dagua .linha { font-weight: 700; font-size: 86px; line-height: 88px; color: #2E7A4C; white-space: nowrap; opacity: .55; letter-spacing: -1px; }

/* ---------- login ---------- */
.login { display: grid; grid-template-columns: 1.15fr 1fr; min-height: 100vh; }
.login-arte { position: relative; overflow: hidden; background: var(--verde-fundo); color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 64px 9%; }
.login-texto { position: relative; z-index: 2; }
.selo-marca { display: inline-block; background: var(--limao); color: #fff; font-weight: 600; font-size: 22px; padding: 4px 18px; margin-bottom: 40px; }
.t-leve { font-family: var(--mono); font-size: clamp(32px, 4vw, 52px); letter-spacing: 1px; line-height: 1.1; }
.t-forte { font-family: var(--mono); font-weight: 700; font-size: clamp(38px, 5vw, 64px); letter-spacing: 1px; line-height: 1.15; }
.t-sub { color: var(--limao); font-size: 18px; margin-top: 44px; max-width: 420px; }
.login-rodape { position: absolute; left: 9%; bottom: 32px; font-size: 12px; color: #7FC25A; z-index: 2; }
.login-lado { display: grid; place-items: center; padding: 32px; background: var(--pagina); }
.login-card { width: 100%; max-width: 380px; display: grid; gap: 16px; }
.login-logo { font-weight: 600; font-size: 26px; color: var(--verde); }
.login-card h1 { font-family: var(--mono); font-size: 34px; color: var(--verde); letter-spacing: 1px; }
.login-card p { margin: -8px 0 6px; }
.login-card label { display: grid; gap: 6px; font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.login-card input { padding: 12px 14px; border-radius: 10px; background: #fff; }
#btn-entrar { background: var(--verde); color: #fff; border: 0; border-radius: 10px; padding: 13px; font-weight: 600; font-size: 15px; margin-top: 6px; transition: background .15s; }
#btn-entrar:hover { background: var(--verde-medio); }
#btn-entrar:disabled { opacity: .6; cursor: wait; }
@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; }
  .login-arte { min-height: 300px; padding: 40px 28px 64px; }
  .t-sub { margin-top: 20px; }
  .login-rodape { left: 28px; bottom: 20px; }
}

/* ---------- topo ---------- */
.topo { background: var(--verde-fundo); color: #fff; }
.topo-dentro, .miolo { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.topo-dentro { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.marca { font-weight: 600; font-size: 22px; }
.marca span { font-family: var(--mono); font-size: 14px; color: var(--limao); letter-spacing: 2px; margin-left: 8px; }
.usuario { font-size: 13px; color: rgba(255,255,255,.75); }
.link-claro { background: none; border: 0; color: var(--limao); padding: 0; margin-left: 8px; font-weight: 600; }
.miolo { padding-top: 20px; padding-bottom: 48px; }

/* ---------- filtros ---------- */
.filtros { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 6px; }
.filtros label { display: grid; gap: 4px; font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.periodos { display: flex; border: 1px solid var(--borda); border-radius: 8px; overflow: hidden; background: var(--surface-1); }
.periodos button { background: none; border: 0; padding: 8px 13px; color: var(--text-secondary); }
.periodos button + button { border-left: 1px solid var(--borda); }
.periodos button:hover { background: var(--lavagem); }
.periodos button.ativo { color: #fff; font-weight: 600; background: var(--verde); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 12px; margin: 10px 0 22px; }
.kpi { background: var(--surface-1); border: 1px solid var(--borda); border-radius: 12px; padding: 14px 16px; border-top: 4px solid var(--limao); }
.kpi .rotulo { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.kpi .valor { font-family: var(--mono); font-size: 23px; font-weight: 700; margin: 6px 0 4px; color: var(--verde); }
.kpi .delta { font-size: 12px; color: var(--text-secondary); }
.kpi .delta.bom { color: var(--bom); font-weight: 500; }
.kpi .delta.ruim { color: var(--ruim); font-weight: 500; }

/* ---------- abas ---------- */
.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--borda); margin-bottom: 18px; overflow-x: auto; }
.abas button { background: none; border: 0; padding: 10px 14px; color: var(--text-secondary); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.abas button:hover { color: var(--verde); }
.abas button.ativo { color: var(--verde); border-bottom-color: var(--limao); font-weight: 600; }

.cartao { background: var(--surface-1); border: 1px solid var(--borda); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.grade-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grade-2 { grid-template-columns: 1fr; } }

/* ---------- gráficos ---------- */
.grafico { width: 100%; height: 220px; position: relative; }
.grafico svg { display: block; width: 100%; height: 100%; overflow: visible; }
.grafico .eixo text { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; font-family: var(--sans); }
.grafico .grade line { stroke: var(--grid); stroke-width: 1; }
.grafico .base { stroke: var(--axis); stroke-width: 1; }
.grafico .barra { fill: var(--series-1); }
.grafico .barra.hover { fill: var(--series-1-hover); }
.grafico .linha { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.grafico .ponto { fill: var(--series-1); stroke: var(--surface-1); stroke-width: 2; }
.grafico .mira { stroke: var(--axis); stroke-width: 1; }
.grafico .alvo { fill: transparent; }
.vazio { color: var(--text-muted); padding: 24px 0; text-align: center; }

.dica { position: fixed; z-index: 30; pointer-events: none; background: #fff; color: var(--text-primary); border: 1px solid var(--borda); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 6px 20px rgba(14,85,67,.15); min-width: 150px; }
.dica strong { display: block; margin-bottom: 2px; color: var(--verde); }
.dica .linha-dica { display: flex; justify-content: space-between; gap: 12px; color: var(--text-secondary); }
.dica .linha-dica b { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- barras horizontais ---------- */
.barras { display: grid; gap: 8px; }
.barras .item { display: grid; grid-template-columns: 140px 1fr 150px; gap: 10px; align-items: center; font-size: 13px; }
.barras .nome { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barras .trilho { height: 10px; }
.barras .preenchido { height: 10px; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.barras .item:hover .preenchido { background: var(--series-1-hover); }
.barras .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.barras .num small { display: block; color: var(--text-muted); font-size: 11px; font-weight: 400; }

/* ---------- tabelas ---------- */
.tabela-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: right; padding: 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; white-space: normal; min-width: 260px; }
th { color: var(--verde); font-weight: 600; font-size: 12px; cursor: pointer; user-select: none; }
th.ordenado::after { content: " ↓"; }
th.ordenado.asc::after { content: " ↑"; }
tbody tr:hover { background: var(--lavagem); }
td .sub { display: block; color: var(--text-muted); font-size: 11px; white-space: normal; }
.selo { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--borda); color: var(--text-secondary); margin-left: 6px; font-weight: 500; }
.selo.ativo { background: var(--limao); border-color: var(--limao); color: var(--verde); }

/* ---------- ranking de criativos ---------- */
.barra-criativos { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; align-items: end; }
.barra-criativos label { display: grid; gap: 4px; font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.criativos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.criativo { background: var(--surface-1); border: 1px solid var(--borda); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.criativo .midia { aspect-ratio: 1 / 1; background: #EEF3F0; position: relative; display: grid; place-items: center; color: var(--cinza-verde); font-size: 12px; }
.midia img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.posicao { position: absolute; top: 8px; left: 8px; background: var(--verde); color: #fff; border-radius: 6px; font-size: 12px; font-weight: 600; padding: 2px 8px; z-index: 1; }
.tipo { position: absolute; top: 8px; right: 8px; background: #fff; color: var(--verde); border-radius: 6px; font-size: 11px; padding: 2px 8px; font-weight: 500; z-index: 1; }
.criativo .corpo { padding: 12px; display: grid; gap: 8px; }
.criativo .nome { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.criativo .camp { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.criativo dl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 0; }
.criativo dt { font-size: 11px; color: var(--text-muted); }
.criativo dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.criativo details { font-size: 12px; color: var(--text-secondary); }
.criativo details p { white-space: pre-wrap; margin: 6px 0 0; }

/* ---------- galeria de anúncios ---------- */
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.peca { background: var(--surface-1); border: 1px solid var(--borda); border-radius: 12px; overflow: hidden; cursor: pointer; text-align: left; padding: 0; color: inherit; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.peca:hover, .peca:focus-visible { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(14,85,67,.14); outline: none; }
.peca .midia { aspect-ratio: 4 / 5; background: #EEF3F0; position: relative; display: grid; place-items: center; color: var(--cinza-verde); font-size: 12px; text-align: center; padding: 12px; }
.play { position: absolute; z-index: 1; width: 54px; height: 54px; border-radius: 50%; background: rgba(13,86,68,.82); display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.play::after { content: ""; border-left: 17px solid #fff; border-top: 11px solid transparent; border-bottom: 11px solid transparent; margin-left: 4px; }
.peca .rodape { padding: 10px 12px 12px; display: grid; gap: 6px; }
.peca .nome { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.faixa { background: var(--limao); color: var(--verde); font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 4px; display: flex; justify-content: space-between; gap: 8px; }

/* ---------- modal de prévia ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; }
.modal-fundo { position: absolute; inset: 0; background: rgba(8, 40, 32, .72); }
.modal-caixa { position: relative; background: var(--pagina); border-radius: 16px; width: min(1000px, 100%); max-height: calc(100vh - 40px); overflow: auto; display: grid; grid-template-columns: auto 1fr; }
.modal-fechar { position: absolute; top: 10px; right: 12px; background: none; border: 0; font-size: 28px; line-height: 1; color: var(--verde); z-index: 2; }
.modal-previa { background: var(--verde-fundo); padding: 18px; display: grid; gap: 12px; align-content: start; justify-items: center; min-width: 380px; }
.formatos { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.formatos button { background: rgba(255,255,255,.1); color: #fff; border: 0; border-radius: 6px; padding: 5px 10px; font-size: 12px; }
.formatos button.ativo { background: var(--limao); color: var(--verde); font-weight: 600; }
.previa-area { width: 340px; min-height: 560px; display: grid; place-items: center; color: rgba(255,255,255,.8); font-size: 13px; text-align: center; }
.previa-area iframe { width: 340px; height: 620px; border: 0; border-radius: 10px; background: #fff; }
.modal-info { padding: 28px 28px 24px; display: grid; gap: 12px; align-content: start; }
.modal-info .chip { justify-self: start; background: var(--verde); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 6px; font-weight: 500; }
.modal-info h2 { font-family: var(--mono); font-size: 22px; color: var(--verde); line-height: 1.25; padding-right: 24px; word-break: break-word; }
.modal-info .camp { font-size: 12px; color: var(--cinza-verde); }
.modal-info .leg-t { font-family: var(--mono); font-weight: 700; color: var(--verde-texto); letter-spacing: 1px; margin-top: 4px; }
.modal-info .legenda { white-space: pre-wrap; font-size: 14px; line-height: 1.55; max-height: 220px; overflow: auto; }
.modal-info dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 0; }
.modal-info dt { font-size: 11px; color: var(--text-muted); }
.modal-info dd { margin: 0; font-weight: 700; font-family: var(--mono); color: var(--verde); }
.ideias { border-top: 1px solid var(--borda); padding-top: 14px; margin-top: 4px; display: grid; gap: 8px; }
.ideias-topo { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-ideias { background: var(--verde); color: #fff; border: 0; border-radius: 8px; padding: 9px 14px; font-weight: 600; font-size: 13px; }
.btn-ideias:hover { background: var(--verde-medio); }
.btn-ideias:disabled { opacity: .7; cursor: wait; }
.ideias-texto { background: #fff; border: 1px solid var(--borda); border-left: 4px solid var(--limao); border-radius: 10px; padding: 14px 16px; max-height: 420px; overflow: auto; font-size: 13px; line-height: 1.55; }
.ideias-texto h4 { font-family: var(--mono); color: var(--verde); font-size: 13px; margin: 12px 0 4px; letter-spacing: .5px; }
.ideias-texto h4:first-child { margin-top: 0; }
.ideias-texto p { margin: 0; white-space: pre-wrap; }
.btn-copiar { margin-top: 12px; background: var(--limao); color: var(--verde); border: 0; border-radius: 6px; padding: 6px 12px; font-weight: 600; font-size: 12px; }
@media (max-width: 760px) {
  .modal-caixa { grid-template-columns: 1fr; }
  .modal-previa { min-width: 0; }
}

#analise-texto { white-space: pre-wrap; line-height: 1.6; }
.carregando { position: fixed; bottom: 16px; right: 16px; background: var(--verde); color: #fff; border-radius: 8px; padding: 8px 14px; font-size: 12px; z-index: 50; }
