/* ========================================================================
   AdPilot — estilos base (sem dependências externas)
   A cor principal vem do painel do admin via --primary.
   ======================================================================== */
:root {
  --primary: #2563eb;
  --primary-soft: color-mix(in srgb, var(--primary) 10%, white);
  --primary-dark: color-mix(in srgb, var(--primary) 80%, black);
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --green: #16a34a; --green-soft: #dcfce7;
  --red: #dc2626; --red-soft: #fee2e2;
  --orange: #d97706; --orange-soft: #fef3c7;
  --blue: #2563eb; --blue-soft: #dbeafe;
  --gray-soft: #f1f5f9;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
code { background: var(--gray-soft); padding: 2px 6px; border-radius: 4px; font-size: .85em; word-break: break-all; }
small, .muted { color: var(--muted); }
.small { font-size: .85rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
img { max-width: 100%; }

/* ---------- layout do painel ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: #0f172a; color: #cbd5e1; padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.1rem; padding: 4px 10px 22px; }
.sidebar .brand img { max-height: 32px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; color: #cbd5e1; padding: 9px 12px; border-radius: 8px; font-size: .93rem; margin-bottom: 2px; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar nav .nav-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; margin: 18px 12px 6px; }
.sidebar .count { margin-left: auto; background: var(--red); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 7px; }
.sidebar .bottom { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: .85rem; }
.sidebar .bottom .who { color: #fff; padding: 0 12px; }
.main { padding: 26px 32px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar h1 { margin: 0; }
.btn.mobile-toggle, .mobile-toggle { display: none; }
.editor-texts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.editor-texts .lower { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 800px) { .editor-texts .lower { grid-template-columns: 1fr; } }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: -270px; width: 260px; transition: left .2s; }
  .sidebar.open { left: 0; }
  .btn.mobile-toggle, .mobile-toggle { display: inline-flex; position: fixed; top: 12px; right: 12px; z-index: 60; }
  .main { padding: 60px 16px 40px; }
}

/* ---------- componentes ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.right { text-align: right; } .center { text-align: center; }
.mt0 { margin-top: 0 } .mb0 { margin-bottom: 0 } .mt { margin-top: 16px } .mb { margin-bottom: 16px }

.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: .82rem; }
.stat .value { font-size: 1.55rem; font-weight: 700; margin-top: 2px; }
.stat .hint { font-size: .8rem; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent; font-size: .92rem; font-weight: 600; cursor: pointer; background: var(--primary); color: #fff; text-decoration: none; line-height: 1.2; white-space: nowrap; font-family: inherit; }
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-light { background: #fff; color: var(--text); border-color: var(--border); }
.btn-light:hover { background: var(--gray-soft); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-danger { background: var(--red); } .btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--green); } .btn-success:hover { background: #15803d; }
.btn-sm { padding: 5px 10px; font-size: .82rem; }
.btn-lg { padding: 13px 24px; font-size: 1.02rem; }
.btn-block { width: 100%; }
form.inline { display: inline; }

label { display: block; font-weight: 600; font-size: .86rem; margin: 0 0 5px; }
.field { margin-bottom: 16px; }
.help { font-size: .8rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date], input[type=datetime-local], input[type=search], input[type=tel], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: .93rem; background: #fff; color: var(--text); font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent); border-color: var(--primary); }
textarea { min-height: 90px; resize: vertical; }
input[type=color] { width: 60px; height: 38px; padding: 2px; border: 1px solid #cbd5e1; border-radius: 8px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; font-size: .9rem; cursor: pointer; }
.check input { margin-top: 3px; }
.input-group { display: flex; } .input-group input { border-radius: 8px 0 0 8px; } .input-group .btn { border-radius: 0 8px 8px 0; }

table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fafbfd; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-green { background: var(--green-soft); color: #166534; }
.badge-red { background: var(--red-soft); color: #991b1b; }
.badge-orange { background: var(--orange-soft); color: #92400e; }
.badge-blue { background: var(--blue-soft); color: #1e40af; }
.badge-gray { background: var(--gray-soft); color: #475569; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 14px; font-size: .92rem; border: 1px solid transparent; }
.alert-success { background: var(--green-soft); color: #166534; border-color: #bbf7d0; }
.alert-error { background: var(--red-soft); color: #991b1b; border-color: #fecaca; }
.alert-warning { background: var(--orange-soft); color: #92400e; border-color: #fde68a; }
.alert-info { background: var(--blue-soft); color: #1e40af; border-color: #bfdbfe; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; font-family: inherit; }
.tabs a.active, .tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tab-panel { display: none; } .tab-panel.active { display: block; }

.progress { height: 8px; background: var(--gray-soft); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.score-ring { --v: 0; --c: var(--green); width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--v) * 1%), var(--gray-soft) 0); }
.score-ring > span { width: 72px; height: 72px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 1.4rem; font-weight: 800; }

.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.steps li:last-child { border: 0; }
.steps .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; background: var(--gray-soft); color: var(--muted); flex: none; }
.steps li.done .dot { background: var(--green); color: #fff; }
.steps li.done a { color: var(--muted); text-decoration: line-through; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .icon { font-size: 2.2rem; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.pager a, .pager span { padding: 6px 11px; border: 1px solid var(--border); border-radius: 6px; font-size: .85rem; background: #fff; }
.pager span.current { background: var(--primary); color: #fff; border-color: var(--primary); }

.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.check-list li:last-child { border: 0; }
.check-list .ic { flex: none; width: 20px; text-align: center; font-weight: 700; }
.ic-ok { color: var(--green); } .ic-warn { color: var(--orange); } .ic-fail { color: var(--red); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--gray-soft); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: .82rem; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; font-size: 1rem; line-height: 1; }
.chip.add { cursor: pointer; background: #fff; }
.chip.add:hover { border-color: var(--primary); color: var(--primary); }

.kw-metric { font-size: .72rem; color: var(--muted); }

/* ---------- pré-visualização do anúncio (SERP) ---------- */
.serp { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; font-family: Arial, sans-serif; max-width: 640px; }
.serp.mobile { max-width: 380px; }
.serp .sponsored { font-size: 12px; font-weight: 700; color: #202124; margin-bottom: 6px; }
.serp .site { display: flex; align-items: center; gap: 10px; }
.serp .fav { width: 26px; height: 26px; border-radius: 50%; background: var(--gray-soft); display: grid; place-items: center; font-size: 12px; color: #5f6368; border: 1px solid #e8eaed; }
.serp .domain { font-size: 14px; color: #202124; }
.serp .url { font-size: 12px; color: #4d5156; }
.serp .headline { color: #1a0dab; font-size: 20px; line-height: 1.3; margin: 6px 0 3px; }
.serp.mobile .headline { font-size: 18px; }
.serp .desc { color: #4d5156; font-size: 14px; line-height: 1.58; }
.serp .sitelinks { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; }
.serp .sitelinks a { color: #1a0dab; font-size: 14px; }
.serp .callouts { color: #4d5156; font-size: 14px; margin-top: 4px; }

/* ---------- editor de campanha ---------- */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.editor-side { position: sticky; top: 16px; }
@media (max-width: 1200px) { .editor-grid { grid-template-columns: 1fr; } .editor-side { position: static; } }
.text-item { display: grid; grid-template-columns: 1fr auto auto auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.text-item input { font-size: .9rem; }
.text-item .cnt { font-size: .74rem; color: var(--muted); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.text-item .cnt.over { color: var(--red); font-weight: 700; }
.text-item select { width: 64px; padding: 6px; font-size: .78rem; }
.icon-btn { border: 1px solid var(--border); background: #fff; border-radius: 6px; width: 32px; height: 34px; cursor: pointer; color: var(--muted); font-size: .95rem; }
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }
.issue { font-size: .84rem; padding: 6px 10px; border-left: 3px solid; margin-bottom: 6px; background: #fff; border-radius: 0 6px 6px 0; }
.issue.err { border-color: var(--red); background: #fff7f7; }
.issue.warn { border-color: var(--orange); background: #fffbeb; }
.issue.fix { border-color: var(--green); background: #f0fdf4; }
.group-card { border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; background: #fcfdff; }
.strength { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: .85rem; }
.strength .bar { width: 80px; height: 6px; background: var(--gray-soft); border-radius: 99px; overflow: hidden; }
.strength .bar span { display: block; height: 100%; }
.s-Excelente { color: var(--green); } .s-Excelente .bar span { background: var(--green); }
.s-Boa { color: #65a30d; } .s-Boa .bar span { background: #65a30d; }
.s-Média { color: var(--orange); } .s-Média .bar span { background: var(--orange); }
.s-Ruim { color: var(--red); } .s-Ruim .bar span { background: var(--red); }
.savebar { position: sticky; bottom: 0; background: rgba(255,255,255,.95); backdrop-filter: blur(4px); border-top: 1px solid var(--border); padding: 12px 0; display: flex; gap: 10px; align-items: center; justify-content: flex-end; z-index: 5; margin-top: 10px; }
.savebar .status { margin-right: auto; font-size: .85rem; color: var(--muted); }

.popover { position: absolute; z-index: 100; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(15,23,42,.15); padding: 10px; width: 360px; max-width: 92vw; }
.popover .opt { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: .9rem; }
.popover .opt:hover { background: var(--primary-soft); }
.dropdown-list { position: absolute; z-index: 100; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,.1); max-height: 260px; overflow-y: auto; width: 100%; }
.dropdown-list div { padding: 8px 12px; cursor: pointer; font-size: .88rem; }
.dropdown-list div:hover { background: var(--primary-soft); }
.rel { position: relative; }

.loading-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: none; align-items: center; justify-content: center; z-index: 200; }
.loading-overlay.show { display: flex; }
.loading-box { background: #fff; border-radius: 14px; padding: 28px 32px; width: 420px; max-width: 92vw; text-align: center; }
.spinner { width: 42px; height: 42px; border: 4px solid var(--gray-soft); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-box ol { text-align: left; font-size: .9rem; color: var(--muted); padding-left: 20px; }
.loading-box li.on { color: var(--text); font-weight: 600; }
.loading-box li.done { color: var(--green); }

.chart { width: 100%; height: 220px; }
.chart text { font-size: 11px; fill: var(--muted); }

/* ---------- site público ---------- */
.pub-header { background: #fff; border-bottom: 1px solid var(--border); }
.pub-header .inner, .container { max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.pub-header .inner { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.pub-header .logo { font-weight: 800; font-size: 1.2rem; color: var(--text); display: flex; align-items: center; gap: 8px; }
.pub-header .logo img { max-height: 34px; }
.pub-header nav { display: flex; gap: 18px; align-items: center; }
.pub-header nav a:not(.btn) { color: var(--text); font-weight: 500; }
.hero { padding: 80px 0 60px; background: linear-gradient(180deg, var(--primary-soft), var(--bg)); text-align: center; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); max-width: 820px; margin: 0 auto 18px; letter-spacing: -.02em; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 680px; margin: 0 auto 28px; }
.hero form { display: flex; gap: 8px; max-width: 620px; margin: 0 auto; }
.hero form input { padding: 14px 16px; font-size: 1rem; }
.section { padding: 60px 0; }
.section h2 { text-align: center; font-size: 1.9rem; margin-bottom: 10px; }
.section .sub { text-align: center; color: var(--muted); max-width: 640px; margin: 0 auto 36px; }
.feature { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 22px; }
.feature .ico { width: 42px; height: 42px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 1.3rem; margin-bottom: 12px; }
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: .93rem; margin: 0; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; align-items: stretch; }
.plan { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 26px; display: flex; flex-direction: column; position: relative; }
.plan.highlight { border: 2px solid var(--primary); box-shadow: 0 10px 30px color-mix(in srgb, var(--primary) 18%, transparent); }
.plan .tag { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; font-size: .75rem; font-weight: 700; padding: 3px 12px; border-radius: 999px; white-space: nowrap; }
.plan .promo { background: var(--orange-soft); color: #92400e; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 6px; display: inline-block; margin-bottom: 8px; }
.plan .price { font-size: 2.1rem; font-weight: 800; margin: 10px 0 0; }
.plan .price small { font-size: .9rem; font-weight: 500; }
.plan .old { text-decoration: line-through; color: var(--muted); font-size: .9rem; }
.plan ul { list-style: none; padding: 0; margin: 16px 0 22px; flex: 1; }
.plan li { padding: 5px 0 5px 24px; position: relative; font-size: .92rem; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 700; }
.cycle-toggle { display: inline-flex; background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 4px; margin: 0 auto 28px; }
.cycle-toggle button { border: 0; background: none; padding: 8px 18px; border-radius: 999px; font-weight: 600; cursor: pointer; color: var(--muted); font-family: inherit; }
.cycle-toggle button.active { background: var(--primary); color: #fff; }
.pub-footer { border-top: 1px solid var(--border); background: #fff; padding: 30px 0; font-size: .88rem; color: var(--muted); margin-top: 40px; }
.pub-footer .inner { max-width: 1140px; margin: 0 auto; padding: 0 20px; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.pub-footer a { color: var(--muted); margin-right: 14px; }
.auth-box { max-width: 430px; margin: 50px auto; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .82rem; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.btn-google { background: #fff; color: #3c4043; border: 1px solid #dadce0; width: 100%; }
.btn-google:hover { background: #f8f9fa; }
.prose { max-width: 780px; margin: 0 auto; }
.prose h2 { margin-top: 1.6em; }
.how { counter-reset: s; }
.how .step { position: relative; padding-left: 52px; margin-bottom: 22px; }
.how .step::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; }
