/* ============================ APOIA — landing ============================ */
@font-face {
  font-family: "Anton";
  src: url("/static/fonts/Anton-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }   /* trava: regras de classe/id não vazam estado */

:root {
  --brand: #1F3A6B;
  --brand-ink: #FFFFFF;

  --bg: #eef1f5;
  --card: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --line: #e7eaef;

  --wpp: #25D366;

  --r-lg: 22px;
  --r-md: 14px;
  --shadow-card: 0 18px 40px -22px rgba(16, 24, 40, .35);
  --shadow-soft: 0 6px 18px -10px rgba(16, 24, 40, .3);
  --dock-h: calc(74px + env(safe-area-inset-bottom, 0px));
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  overflow-x: hidden;
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--dock-h) + 16px); /* espaço pro dock fixo */
}
body.enviado .wrap { padding-bottom: 24px; }

/* ------------------------------- HERO ---------------------------------- */
.hero {
  position: relative;
  background: var(--brand);
  color: var(--brand-ink);
  padding: max(30px, env(safe-area-inset-top)) 22px 60px;
  text-align: center;
  overflow: hidden;
  isolation: isolate;
}
/* profundidade independente da cor da marca: escurece embaixo + glow no topo */
.hero::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255,255,255,.22), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,.28));
}
.hero-inner { position: relative; }
.hero h1 {
  font-size: clamp(1.5rem, 6.4vw, 2rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.12;
  text-wrap: balance;
}
.hero .sub {
  margin-top: 6px;
  font-size: .98rem;
  opacity: .82;
  font-weight: 500;
}
.hero-fade {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 46px;
  background: linear-gradient(180deg, transparent, var(--bg));
}

/* contador ao vivo */
.counter { margin-top: 22px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.live {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  opacity: .85; margin-bottom: 4px;
}
.live .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #46e58a; box-shadow: 0 0 0 0 rgba(70,229,138,.7);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(70,229,138,.7); }
  70%  { box-shadow: 0 0 0 9px rgba(70,229,138,0); }
  100% { box-shadow: 0 0 0 0 rgba(70,229,138,0); }
}
.count-num {
  font-family: "Anton", Impact, sans-serif;
  font-size: clamp(3.2rem, 15vw, 4.4rem);
  line-height: .95;
  font-variant-numeric: tabular-nums;
  letter-spacing: .5px;
  text-shadow: 0 2px 20px rgba(0,0,0,.18);
}
.count-label { font-size: .9rem; opacity: .82; font-weight: 500; }

/* ------------------------------- STAGE --------------------------------- */
.stage { padding: 0 18px; margin-top: -34px; display: flex; flex-direction: column; gap: 14px; position: relative; z-index: 1; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

.canvas-card { padding: 10px; }
.canvas-box { position: relative; border-radius: 16px; overflow: hidden; }
#palco {
  width: 100%; aspect-ratio: 1/1; height: auto; display: block;
  background: #e7ebf0;
  touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
}
#palco.arrastando { cursor: grabbing; }

/* overlay do estado vazio (some quando tem foto) */
.canvas-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  border: 0; cursor: pointer;
  background: radial-gradient(closest-side, rgba(255,255,255,.5), rgba(255,255,255,.06));
  color: var(--brand);
  font-weight: 800; font-size: .95rem;
  text-shadow: 0 1px 10px rgba(255,255,255,.9);
}
.canvas-empty svg { opacity: .95; filter: drop-shadow(0 1px 8px rgba(255,255,255,.9)); }
body.has-photo .canvas-empty { display: none; }

.dica { text-align: center; color: var(--muted); font-size: .82rem; }

.zoom-row { display: flex; align-items: center; gap: 14px; padding: 2px 8px; }
.zoom-row .zi { color: var(--muted); font-weight: 800; width: 14px; text-align: center; font-size: 1.1rem; }
.zoom-row input[type=range] {
  flex: 1; height: 6px; -webkit-appearance: none; appearance: none;
  background: var(--line); border-radius: 999px; outline: none;
}
.zoom-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand); border: 3px solid #fff; box-shadow: var(--shadow-soft); cursor: pointer;
}
.zoom-row input[type=range]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand); border: 3px solid #fff; box-shadow: var(--shadow-soft); cursor: pointer;
}

/* --------------------------------- BOTÕES ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; border: none; border-radius: var(--r-md);
  padding: 15px 18px; font-size: 1rem; font-weight: 700; font-family: inherit;
  cursor: pointer; text-decoration: none; line-height: 1;
  transition: transform .06s ease, box-shadow .15s ease, opacity .15s ease, background .15s ease;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { flex: none; }

.btn-primary {
  background: var(--brand); color: var(--brand-ink);
  box-shadow: 0 10px 22px -10px color-mix(in srgb, var(--brand) 70%, transparent);
}
.btn-ghost {
  background: #fff; color: var(--brand);
  border: 1.5px solid color-mix(in srgb, var(--brand) 22%, #fff);
}
.btn-dark { background: #16202e; color: #fff; }
.btn-soft { background: #eef1f5; color: var(--ink); border: 1px solid var(--line); }
.btn-wpp { background: var(--wpp); color: #06371d; }

/* fallback pra navegadores sem color-mix */
@supports not (color: color-mix(in srgb, red, blue)) {
  .btn-primary { box-shadow: var(--shadow-soft); }
  .btn-ghost { border-color: rgba(31,58,107,.25); }
}

/* --------------------------------- OPCIONAIS --------------------------- */
.opcionais { padding: 0 16px; overflow: hidden; }
.opcionais summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  padding: 15px 0; font-weight: 700; color: var(--ink);
}
.opcionais summary::-webkit-details-marker { display: none; }
.opcionais summary .tag {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, #fff);
  padding: 3px 8px; border-radius: 999px;
}
.opcionais summary .chev { margin-left: auto; color: var(--muted); transition: transform .2s ease; }
.opcionais[open] summary .chev { transform: rotate(180deg); }
.campos { display: flex; flex-direction: column; gap: 13px; padding: 4px 0 18px; }
.campos label { display: flex; flex-direction: column; gap: 6px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.campos input, .campos select {
  padding: 13px 12px; border: 1.5px solid var(--line); border-radius: 11px;
  font-size: 1rem; font-family: inherit; background: #fff; color: var(--ink);
  transition: border-color .15s ease;
}
.campos input:focus, .campos select:focus { outline: none; border-color: var(--brand); }

.erro { color: #c0392b; font-size: .88rem; text-align: center; font-weight: 600; }

/* --------------------------------- SHARE ------------------------------- */
.share { margin: 16px 18px 0; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.share-head { display: flex; align-items: center; gap: 12px; text-align: left; }
.share-head .check {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; background: #12b76a;
  box-shadow: 0 8px 18px -8px rgba(18,183,106,.7);
}
.share-head strong { font-size: 1.05rem; }
.share-head p { color: var(--muted); font-size: .9rem; margin-top: 1px; }
.resultado img { width: 100%; border-radius: 16px; display: block; box-shadow: var(--shadow-soft); }
.share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share-actions .btn-wpp { grid-column: 1 / -1; }

.pageft { text-align: center; color: var(--muted); font-size: .78rem; padding: 26px 20px; }
.pageft b { color: var(--ink); letter-spacing: .02em; }

/* ------------------------------ CTA DOCK ------------------------------- */
.cta-dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(238,241,245,0), var(--bg) 42%);
  pointer-events: none;
}
.cta-dock-inner { max-width: 480px; margin: 0 auto; pointer-events: auto; }
.cta-dock .btn-primary { box-shadow: 0 -2px 0 rgba(0,0,0,0), 0 14px 30px -12px rgba(16,24,40,.55); padding: 17px 18px; font-size: 1.05rem; }
body.enviado .cta-dock { display: none !important; }

/* --------------------------- NÃO ENCONTRADO ---------------------------- */
.nf-wrap { justify-content: center; align-items: center; padding: 24px; gap: 8px; }
.nf { padding: 34px 24px 30px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.nf-badge {
  width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center;
  color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, #fff);
}
.nf h1 { font-size: 1.4rem; font-weight: 800; letter-spacing: -.01em; }
.nf p { color: var(--muted); font-size: .96rem; max-width: 34ch; }
.nf .btn { width: auto; padding: 14px 24px; margin-top: 6px; }

/* ------------------------------- ADMIN --------------------------------- */
body.admin { background: var(--bg); }
.adm-top { background: var(--brand); color: var(--brand-ink); padding: 22px 20px; text-align: center; }
.adm-top h1 { font-size: 1.4rem; font-weight: 800; }
.adm-top p { opacity: .85; font-size: .9rem; margin-top: 4px; }
.adm-wrap { max-width: 720px; margin: 0 auto; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.adm-card { padding: 18px; }
.adm-card h2 { font-size: 1.1rem; margin-bottom: 14px; }
.adm-h2 { font-size: 1.05rem; margin: 8px 2px -4px; color: var(--muted); }

.flash { padding: 12px 14px; border-radius: 12px; font-weight: 600; font-size: .92rem; }
.flash-ok { background: #e7f7ef; color: #0b7a4b; border: 1px solid #b6e6cf; }
.flash-erro { background: #fdecea; color: #c0392b; border: 1px solid #f5c6c0; }

.adm-form { display: flex; flex-direction: column; gap: 13px; }
.adm-form label { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.adm-form label span { font-weight: 500; }
.adm-form label span b { color: var(--brand); }
.adm-form input[type=text], .adm-form input[type=number] {
  padding: 12px; border: 1.5px solid var(--line); border-radius: 11px; font-size: 1rem; font-family: inherit;
}
.adm-form input[type=text]:focus, .adm-form input[type=number]:focus { outline: none; border-color: var(--brand); }
.adm-form input[type=color] { width: 100%; height: 44px; border: 1.5px solid var(--line); border-radius: 11px; background: #fff; cursor: pointer; }
.adm-form input[type=file] { font-size: .9rem; }
.adm-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.adm-preview { width: 140px; height: 140px; object-fit: contain; border-radius: 12px; background: #eef1f5; align-self: center; }

.adm-lista { display: flex; flex-direction: column; gap: 12px; }
.adm-item { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.adm-item-top { display: flex; gap: 14px; align-items: center; }
.adm-thumb { width: 72px; height: 72px; object-fit: contain; border-radius: 10px; background: #eef1f5; flex: none; }
.adm-meta { min-width: 0; }
.adm-title-row { display: flex; align-items: center; gap: 8px; }
.adm-title-row strong { font-size: 1rem; }
.badge { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 8px; border-radius: 999px; }
.badge.on { background: #e7f7ef; color: #0b7a4b; }
.badge.off { background: #eef1f5; color: var(--muted); }
.adm-link { color: var(--brand); font-weight: 700; font-size: .9rem; text-decoration: none; }
.adm-sub { color: var(--muted); font-size: .84rem; margin-top: 3px; }
.adm-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }
.adm-troca { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 240px; }
.adm-troca input[type=file] { font-size: .82rem; min-width: 0; flex: 1; }
.adm-actions .btn { width: auto; padding: 10px 16px; font-size: .9rem; }
@media (max-width: 520px) { .adm-row { grid-template-columns: 1fr; } .adm-troca { min-width: 0; } }

.adm-navlink { display: inline-block; margin-top: 12px; color: var(--brand-ink); font-weight: 700; text-decoration: none; background: rgba(255,255,255,.16); padding: 8px 14px; border-radius: 999px; font-size: .9rem; }
.adm-linkrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0; }
.adm-url { font-size: .82rem; background: #eef1f5; padding: 4px 8px; border-radius: 7px; color: var(--ink); word-break: break-all; }
.btn-mini { font-size: .8rem; font-weight: 700; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--brand); cursor: pointer; text-decoration: none; }
.btn-mini:hover { background: #f4f6f9; }

.adm-det { border-top: 1px solid var(--line); }
.adm-det > summary { list-style: none; cursor: pointer; padding: 11px 0 11px; font-weight: 600; font-size: .9rem; color: var(--ink); }
.adm-det > summary::-webkit-details-marker { display: none; }
.adm-det[open] > summary { color: var(--brand); }
.adm-det .adm-form { padding-bottom: 12px; }
.adm-hint { font-size: .78rem; color: var(--muted); margin: 2px 0; }
.adm-ref { display: flex; gap: 8px; padding-bottom: 8px; }
.adm-ref .ref-src { flex: 1; padding: 10px; border: 1.5px solid var(--line); border-radius: 10px; font-size: .95rem; }
.adm-ref .ref-gen { width: auto; padding: 10px 16px; }
.ref-out { display: flex; align-items: center; gap: 8px; padding: 4px 0 12px; flex-wrap: wrap; }
.ref-link { font-size: .82rem; background: #eef1f5; padding: 6px 9px; border-radius: 7px; word-break: break-all; flex: 1; }

/* ------------------------- DASHBOARD (executivo) ----------------------- */
body.dashx { background: var(--bg); }
.dx-hero { position: relative; overflow: hidden; isolation: isolate; background: var(--brand); color: var(--brand-ink); padding: 26px 20px 52px; }
.dx-hero::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(120% 90% at 85% -20%, rgba(255,255,255,.20), transparent 55%), linear-gradient(180deg, rgba(255,255,255,.05), rgba(0,0,0,.28)); }
.dx-hero-in { max-width: 1000px; margin: 0 auto; }
.dx-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.dx-back { color: rgba(255,255,255,.8); text-decoration: none; font-size: .82rem; font-weight: 600; }
.dx-hero-top h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin-top: 3px; }
.dx-filtros { display: flex; gap: 8px; }
.dx-filtros select { padding: 9px 12px; border-radius: 10px; border: none; background: rgba(255,255,255,.16); color: #fff; font-weight: 600; font-size: .85rem; cursor: pointer; }
.dx-filtros select option { color: #111; }
.dx-headline { display: flex; gap: 36px; align-items: flex-end; margin-top: 20px; flex-wrap: wrap; }
.dx-hero-metric { display: flex; flex-direction: column; }
.dx-big { font-family: "Anton", Impact, sans-serif; font-size: clamp(2.5rem, 9vw, 3.6rem); line-height: .88; font-variant-numeric: tabular-nums; }
.dx-big.accent { color: #46e58a; }
.dx-big-l { font-size: .84rem; opacity: .85; margin-top: 6px; font-weight: 500; }
.dx-period { width: 100%; opacity: .72; font-size: .8rem; margin-top: 2px; }

.dx-wrap { max-width: 1000px; margin: -26px auto 0; padding: 0 18px 44px; position: relative; z-index: 1; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 15px 16px; box-shadow: var(--shadow-card); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; }
.ic-b { background: #2a78d6; } .ic-p { background: #7c5cff; } .ic-a { background: #1baf7a; } .ic-s { background: #eb6834; }
.kpi-n { font-family: "Anton", Impact, sans-serif; font-size: 2rem; line-height: 1; margin-top: 11px; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-l { font-size: .77rem; color: var(--muted); font-weight: 600; margin-top: 2px; }
.delta { font-size: .71rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.delta.up { color: #0b7a4b; background: #e7f7ef; }
.delta.down { color: #c0392b; background: #fdecea; }
.delta.flat { color: var(--muted); background: #eef1f5; }

.dx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.dx-col2 { grid-column: 1 / -1; }
.dx-card { padding: 18px; }
.dx-card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.dx-card-h h3 { font-size: 1rem; font-weight: 700; }
.dx-tag { font-size: .71rem; color: var(--muted); background: #eef1f5; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.dash-empty { color: var(--muted); font-size: .9rem; }

.chart-h { font-size: .82rem; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.chart-h b { margin-left: auto; color: var(--ink); font-size: .95rem; font-variant-numeric: tabular-nums; }
.chart-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.areachart { width: 100%; height: 88px; display: block; overflow: visible; }
.areachart circle { cursor: pointer; }
.areachart circle:hover { fill-opacity: 1 !important; }
.chart-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .72rem; margin-top: 6px; }

.funnel { display: flex; flex-direction: column; }
.fn-row { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: 5px; }
.fn-label { color: var(--ink); font-weight: 600; }
.fn-n { font-weight: 800; font-variant-numeric: tabular-nums; }
.fn-track { background: #eef1f5; border-radius: 8px; height: 26px; overflow: hidden; }
.fn-fill { height: 100%; background: linear-gradient(90deg, #2a78d6, #1baf7a); border-radius: 8px; min-width: 4px; transition: width .4s ease; }
.fn-conv { font-size: .73rem; color: var(--muted); text-align: center; padding: 6px 0; }

.barlist { display: flex; flex-direction: column; gap: 9px; }
.barrow { display: grid; grid-template-columns: 110px 1fr 38px; align-items: center; gap: 10px; }
.barlabel { font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bartrack { background: #eef1f5; border-radius: 999px; height: 12px; overflow: hidden; }
.barfill { display: block; height: 100%; background: #2a78d6; border-radius: 999px; min-width: 3px; }
.barfill.alt { background: #1baf7a; }
.barval { font-size: .84rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tbl td.num, .tbl th:nth-child(n+2) { text-align: right; font-variant-numeric: tabular-nums; }
.tbl a { color: var(--brand); font-weight: 600; text-decoration: none; }
.pill { background: #eef2fb; color: #2a78d6; font-weight: 700; padding: 2px 9px; border-radius: 999px; font-size: .82rem; }

@media (max-width: 720px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .dx-grid { grid-template-columns: 1fr; }
  .dx-headline { gap: 24px; }
}

/* ------------------------------ MOTION --------------------------------- */
.reveal { animation: reveal .45s cubic-bezier(.2,.7,.2,1) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .live .dot { animation: none; }
}
