/* ==========================================================
   Design neutro e compartilhado (checkout + administração)
   ========================================================== */

:root {
    --bg: #f6f6f4;
    --surface: #ffffff;
    --surface-2: #f0f0ed;
    --border: #e3e3de;
    --border-strong: #cfcfc8;
    --text: #1d1d1b;
    --muted: #6a6a64;
    --primary: #262624;
    --primary-hover: #3b3b38;
    --on-primary: #ffffff;
    --ring: rgba(38, 38, 36, .22);

    --ok: #2d6a4a;
    --ok-bg: #e7f1eb;
    --warn: #86611a;
    --warn-bg: #f7efd8;
    --bad: #9f3a31;
    --bad-bg: #f7e5e2;
    --mute: #5d5d57;
    --mute-bg: #ecece8;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(20, 20, 18, .04), 0 8px 24px rgba(20, 20, 18, .05);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #141413;
        --surface: #1d1d1b;
        --surface-2: #262624;
        --border: #2f2f2c;
        --border-strong: #42423e;
        --text: #ecebe7;
        --muted: #9b9b94;
        --primary: #ecebe7;
        --primary-hover: #ffffff;
        --on-primary: #1d1d1b;
        --ring: rgba(236, 235, 231, .25);

        --ok: #7cc79c;
        --ok-bg: #1b2a22;
        --warn: #e0bb6a;
        --warn-bg: #2b2415;
        --bad: #e69088;
        --bad-bg: #2f1b19;
        --mute: #aaa9a2;
        --mute-bg: #2a2a27;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .9em; }
a { color: inherit; }
small, .muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .875em; }
.center { text-align: center; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Cartões ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
}

.card + .card { margin-top: 20px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.card-sub { color: var(--muted); font-size: .925rem; margin-bottom: 20px; }

/* ---------- Formulários ---------- */

.campo { margin-bottom: 16px; }

.campo label,
.rotulo {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.campo .dica { font-weight: 400; color: var(--muted); }
.campo .ajuda { display: block; color: var(--muted); font-size: .8125rem; margin-top: 6px; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], select, textarea {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
}

select {
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 20px) 20px, calc(100% - 15px) 20px;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    padding-right: 38px;
}

textarea { resize: vertical; min-height: 76px; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--text);
    box-shadow: 0 0 0 3px var(--ring);
}

.campo.tem-erro input, .campo.tem-erro textarea { border-color: var(--bad); }
.erro-campo { display: none; color: var(--bad); font-size: .8125rem; margin-top: 6px; }
.campo.tem-erro .erro-campo { display: block; }

.grupo { display: flex; align-items: stretch; gap: 8px; }
.grupo > input { flex: 1; min-width: 0; }

.prefixo { position: relative; }
.prefixo span {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--muted); font-weight: 600; pointer-events: none;
}
.prefixo input { padding-left: 44px; font-weight: 600; font-variant-numeric: tabular-nums; }

.linha { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .linha { grid-template-columns: 1fr; } }

.check { display: flex; align-items: center; gap: 10px; font-size: .925rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

/* ---------- Botões ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 46px; padding: 0 20px;
    font: inherit; font-weight: 600; text-decoration: none;
    color: var(--on-primary); background: var(--primary);
    border: 1px solid var(--primary); border-radius: var(--radius-sm);
    cursor: pointer; transition: background .15s, transform .05s, opacity .15s;
}

.btn:hover { background: var(--primary-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

.btn-sec { color: var(--text); background: var(--surface); border-color: var(--border-strong); }
.btn-sec:hover { background: var(--surface-2); }

.btn-perigo { color: var(--bad); background: transparent; border-color: var(--border-strong); }
.btn-perigo:hover { background: var(--bad-bg); }

.btn-sm { min-height: 34px; padding: 0 12px; font-size: .8125rem; }
.btn-link { background: none; border: 0; color: var(--muted); padding: 0; min-height: 0; font-weight: 500; text-decoration: underline; cursor: pointer; font: inherit; }
.btn-link:hover { color: var(--text); }

.spinner {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: girar .7s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Avisos e badges ---------- */

.aviso {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; margin-bottom: 18px;
    font-size: .9rem; border-radius: var(--radius-sm);
    color: var(--mute); background: var(--mute-bg);
    border: 1px solid var(--border);
}
.aviso.ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.aviso.erro { color: var(--bad); background: var(--bad-bg); border-color: transparent; }
.aviso.atencao { color: var(--warn); background: var(--warn-bg); border-color: transparent; }

.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; font-size: .78rem; font-weight: 600;
    border-radius: 999px; white-space: nowrap;
    color: var(--mute); background: var(--mute-bg);
}
.badge.ok { color: var(--ok); background: var(--ok-bg); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.bad { color: var(--bad); background: var(--bad-bg); }

.ponto { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.ponto.pulsa { animation: pulsar 1.6s ease-in-out infinite; }
@keyframes pulsar { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------- Toast ---------- */

.toast {
    position: fixed; left: 50%; bottom: 24px; z-index: 50;
    transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    padding: 10px 18px; font-size: .9rem; font-weight: 600;
    color: var(--on-primary); background: var(--primary);
    border-radius: 999px; box-shadow: var(--shadow);
    transition: opacity .2s, transform .2s;
}
.toast.visivel { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================
   Logomarcas
   ========================================================== */

.logo-img {
    display: block;
    max-width: 300px;
    width: 100%;
    height: auto;
    margin: 0 auto 4px;
}

.logo-grande {
    display: block;
    max-width: 600px;
    width: 100%;
    height: auto;
    margin: 0 auto;
}

.landing-logo {
    margin-bottom: 24px;
    text-align: center;
}

.landing .checkout {
    padding-top: 36px;
}

.resultados {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.resultado-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
    transition: background .15s, border-color .15s, transform .05s;
}

.resultado-item:hover {
    background: var(--surface);
    border-color: var(--border-strong);
}

.resultado-item:active {
    transform: translateY(1px);
}

.resultado-info {
    flex: 1;
    min-width: 0;
}

.resultado-info strong {
    display: block;
    margin-bottom: 2px;
    font-size: 1rem;
}

.resultado-info .sub {
    color: var(--muted);
    font-size: .8125rem;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resultado-valor {
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.resultado-tipo {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-radius: 999px;
    margin-right: 4px;
}

.resultado-tipo.saas { color: var(--ok); background: var(--ok-bg); }
.resultado-tipo.produto { color: var(--warn); background: var(--warn-bg); }

.resultado-vazio {
    padding: 24px 16px;
    text-align: center;
    color: var(--muted);
    font-size: .925rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
}

.campo .ajuda {
    display: block;
    color: var(--muted);
    font-size: .8125rem;
    margin-top: 6px;
}

.co-logo {
    margin-bottom: 8px;
    text-align: center;
}

.logo-marca {
    height: 36px;
    width: auto;
    vertical-align: middle;
    margin-right: 10px;
}

.marca {
    display: inline-flex;
    align-items: center;
}

/* ==========================================================
   Checkout
   ========================================================== */

.checkout { max-width: 460px; margin: 0 auto; padding: 28px 16px 48px; }

.co-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; padding: 0 4px; }
.co-marca { font-weight: 700; letter-spacing: -.01em; }
.co-seguro { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; color: var(--muted); }
.co-seguro svg { width: 15px; height: 15px; }

.co-rodape { margin-top: 18px; text-align: center; font-size: .8125rem; color: var(--muted); }

.valor-destaque {
    text-align: center; padding: 18px 12px; margin-bottom: 20px;
    background: var(--surface-2); border-radius: var(--radius-sm);
}
.valor-destaque .rotulo { color: var(--muted); font-weight: 500; margin-bottom: 2px; }
.valor-destaque strong { font-size: 2rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.valor-destaque small { display: block; margin-top: 2px; }

.qr-area { display: flex; justify-content: center; margin-bottom: 18px; }
.qr-area img {
    width: 232px; height: 232px; padding: 10px;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
    image-rendering: pixelated;
}

.copia {
    width: 100%; min-height: 0; height: 84px; margin-bottom: 12px;
    font-family: var(--mono); font-size: .75rem; line-height: 1.4;
    resize: none; background: var(--surface-2);
}

.passos { margin: 18px 0 0; padding: 0; list-style: none; counter-reset: passo; }
.passos li {
    counter-increment: passo; position: relative;
    padding: 0 0 0 34px; margin-bottom: 10px;
    font-size: .875rem; color: var(--muted);
}
.passos li::before {
    content: counter(passo); position: absolute; left: 0; top: 0;
    width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: .75rem; font-weight: 700;
    color: var(--text); background: var(--surface-2);
}

.status-linha { display: flex; justify-content: center; margin-bottom: 18px; }

.resumo { margin: 20px 0; padding: 0; }
.resumo div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .925rem; }
.resumo div:last-child { border-bottom: 0; }
.resumo dt { color: var(--muted); }
.resumo dd { margin: 0; font-weight: 600; text-align: right; word-break: break-all; }

.selo {
    width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%;
    display: grid; place-items: center;
    color: var(--ok); background: var(--ok-bg);
    animation: surgir .4s ease-out both;
}
.selo svg { width: 32px; height: 32px; }
.selo.neutro { color: var(--mute); background: var(--mute-bg); }
@keyframes surgir { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.etapa { animation: entrar .25s ease-out both; }
@keyframes entrar { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ==========================================================
   Administração
   ========================================================== */

.topo {
    position: sticky; top: 0; z-index: 20;
    background: var(--surface); border-bottom: 1px solid var(--border);
}

.topo-in {
    max-width: 1100px; margin: 0 auto; padding: 0 20px;
    display: flex; align-items: center; gap: 24px; min-height: 60px;
}

.marca { font-weight: 700; letter-spacing: -.01em; text-decoration: none; white-space: nowrap; }

.menu { display: flex; align-items: center; gap: 4px; flex: 1; overflow-x: auto; }
.menu a {
    padding: 8px 14px; font-size: .925rem; font-weight: 500;
    color: var(--muted); text-decoration: none; border-radius: var(--radius-sm); white-space: nowrap;
}
.menu a:hover { color: var(--text); background: var(--surface-2); }
.menu a.ativo { color: var(--text); background: var(--surface-2); font-weight: 600; }

.topo-acoes { display: flex; align-items: center; gap: 10px; }
.topo-acoes form { margin: 0; }

@media (max-width: 720px) {
    .topo-in { flex-wrap: wrap; gap: 4px 12px; padding: 10px 16px; }
    .menu { order: 3; flex-basis: 100%; }
}

.pagina { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.pagina-topo { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.pagina-topo h1 { margin: 0; }
.pagina-topo p { margin: 4px 0 0; color: var(--muted); }

.metricas { display: grid; gap: 14px; grid-template-columns: repeat(4, 1fr); margin-bottom: 20px; }
@media (max-width: 900px) { .metricas { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .metricas { grid-template-columns: 1fr; } }

.metrica { padding: 18px 20px; }
.metrica .rotulo { color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.metrica strong { display: block; font-size: 1.5rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metrica small { display: block; margin-top: 2px; font-size: .8125rem; }

.grade { display: grid; gap: 20px; grid-template-columns: 1.7fr 1fr; align-items: start; }
@media (max-width: 900px) { .grade { grid-template-columns: 1fr; } }
.grade .card + .card { margin-top: 0; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .925rem; }
.checklist li:last-child { border-bottom: 0; }
.checklist .icone { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: var(--ok); background: var(--ok-bg); }
.checklist .icone.pendente { color: var(--warn); background: var(--warn-bg); }

/* ---------- Filtros e tabela ---------- */

.filtros { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filtros form { display: flex; gap: 8px; flex: 1; min-width: 240px; }

.abas { display: inline-flex; padding: 4px; gap: 2px; background: var(--surface-2); border-radius: var(--radius-sm); }
.abas a { padding: 6px 14px; font-size: .875rem; font-weight: 500; color: var(--muted); text-decoration: none; border-radius: 6px; }
.abas a:hover { color: var(--text); }
.abas a.ativo { color: var(--text); background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); font-weight: 600; }

.tabela-wrap { padding: 0; overflow: hidden; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 18px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
th { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td .sub { display: block; color: var(--muted); font-size: .8125rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.acoes { text-align: right; white-space: nowrap; }
td.acoes form { display: inline; margin: 0; }
td.acoes .btn { margin-left: 4px; }

.vazio { padding: 48px 20px; text-align: center; color: var(--muted); }

@media (max-width: 760px) {
    thead { display: none; }
    table, tbody, tr, td { display: block; width: 100%; }
    tr { padding: 14px 18px; border-bottom: 1px solid var(--border); }
    tbody tr:last-child { border-bottom: 0; }
    td { padding: 4px 0; border: 0; text-align: left !important; }
    td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 84px; color: var(--muted); font-size: .8125rem; }
    td.acoes { padding-top: 10px; }
    td.acoes .btn:first-child { margin-left: 0; }
}

.paginacao { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: .875rem; color: var(--muted); }
.paginacao div { display: flex; gap: 8px; }

/* ---------- Diálogo ---------- */

dialog {
    width: min(460px, calc(100% - 32px)); padding: 26px;
    color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(20, 20, 18, .5); }
dialog .rodape { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---------- Login ---------- */

.login { max-width: 400px; margin: 0 auto; padding: 72px 16px; }
.login .marca-grande { display: block; text-align: center; font-size: 1.15rem; font-weight: 700; margin-bottom: 20px; }

/* ---------- Seções de credenciais ---------- */

.secao-topo { margin-bottom: 18px; }
.senha-wrap { display: flex; gap: 8px; }
.senha-wrap input { flex: 1; min-width: 0; }

.rodape-form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Checkbox de aceite legal ---------- */

.campo.aceite {
    padding: 0;
    margin: 0;
}
.campo.aceite .erro-campo {
    display: block;
    margin-left: 36px;
    margin-top: 4px;
}

label.chk {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 10px;
    align-items: flex-start;
    cursor: pointer;
    line-height: 1.5;
    user-select: none;
}
label.chk > input {
    position: absolute;
    width: 1px; height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    white-space: nowrap;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
}
label.chk > span {
    width: 22px; height: 22px;
    border: 2px solid var(--border-strong);
    border-radius: 6px;
    background: var(--surface);
    position: relative;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
    margin-top: 1px;
    flex-shrink: 0;
}
label.chk > span::after {
    content: "";
    position: absolute;
    left: 5px; top: 1px;
    width: 7px; height: 12px;
    border: solid transparent;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(40deg);
    transform-origin: left center;
    transition: border-color .15s ease;
}
label.chk:hover > span {
    border-color: var(--text);
}
label.chk > input:focus-visible + span {
    box-shadow: 0 0 0 4px var(--ring);
    border-color: var(--text);
}
label.chk > input:checked + span {
    background: var(--primary);
    border-color: var(--primary);
}
label.chk > input:checked + span::after {
    border-color: var(--on-primary);
}
label.chk small {
    color: var(--muted);
    font-size: .8125rem;
}
label.chk small a {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
}
label.chk small a:hover {
    text-decoration-thickness: 2px;
}
.campo.tem-erro label.chk > span {
    border-color: var(--bad);
}

/* ---------- Páginas legais (conteúdo) ---------- */

.pagina .card h1 { font-size: 1.5rem; margin-bottom: 6px; }
.pagina .card h2 { font-size: 1.15rem; margin: 28px 0 10px; letter-spacing: -.01em; }
.pagina .card h3 { font-size: 1rem; margin: 22px 0 8px; }
.pagina .card p,
.pagina .card li { line-height: 1.7; color: #2f2f2b; }
.pagina .card ul,
.pagina .card ol { margin: 8px 0 4px 0; padding-left: 22px; }
.pagina .card li { margin-bottom: 6px; }
.pagina .card strong { color: var(--text); font-weight: 600; }
.pagina .card a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
