/* ==========================================================================
   PayDay — Design System (estilo Stripe)
   Tema claro, tipografia Inter, índigo #635bff, sombras suaves em camadas.
   ========================================================================== */

:root {
    /* Cores base */
    --bg: #f6f9fc;
    --surface: #ffffff;
    --surface-2: #f7fafc;
    --border: #e6ebf1;
    --border-strong: #d5dbe5;

    /* Texto */
    --text: #0a2540;        /* navy escuro Stripe */
    --text-2: #1a1f36;
    --muted: #697386;
    --muted-2: #8792a2;

    /* Marca */
    --primary: #635bff;     /* blurple Stripe */
    --primary-hover: #5249e9;
    --primary-soft: #f5f4ff;

    /* Status */
    --green: #15b884;
    --green-soft: #e6faf3;
    --amber: #d97917;
    --amber-soft: #fdf3e7;
    --red: #df1b41;
    --red-soft: #fdeef1;

    /* Gradiente de marca (destaques) */
    --grad: linear-gradient(101deg, #635bff 0%, #4f9cff 50%, #00d4ff 100%);

    /* Raios */
    --r-sm: 6px;
    --r: 8px;
    --r-lg: 14px;

    /* Sombras (camadas Stripe) */
    --shadow-sm: 0 1px 1px rgba(0,0,0,.03), 0 0 0 1px rgba(50,50,93,.06);
    --shadow: 0 0 0 1px rgba(50,50,93,.04), 0 2px 5px -1px rgba(50,50,93,.10), 0 1px 3px -1px rgba(0,0,0,.07);
    --shadow-lg: 0 0 0 1px rgba(50,50,93,.04), 0 15px 35px -5px rgba(50,50,93,.12), 0 5px 15px rgba(0,0,0,.06);
    --ring: 0 0 0 1px var(--primary), 0 1px 1px rgba(0,0,0,.04), 0 0 0 4px rgba(99,91,255,.16);
}

* { box-sizing: border-box; }

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

/* Evita overflow horizontal em qualquer elemento */
img, svg, video, canvas, iframe { max-width: 100%; }

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; font-weight: 500; }
a:hover { color: var(--primary-hover); }

h1, h2, h3 { color: var(--text); letter-spacing: -.02em; font-weight: 700; overflow-wrap: break-word; }
h1 { font-size: 28px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 16px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Texto com gradiente de marca */
.accent {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---- Topbar -------------------------------------------------------------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; height: 64px;
    background: rgba(255,255,255,.85);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
}
.topbar--admin { background: #fff; }
.brand {
    font-weight: 800; font-size: 19px; color: var(--text);
    letter-spacing: -.03em; display: inline-flex; align-items: center; gap: 8px;
}
.brand:hover { color: var(--text); }
.tag {
    font-size: 11px; font-weight: 700; background: var(--primary-soft); color: var(--primary);
    padding: 3px 8px; border-radius: 999px; letter-spacing: 0;
}
.nav { display: flex; align-items: center; gap: 20px; }
.nav a { color: var(--muted); font-weight: 500; font-size: 14px; }
.nav a:hover { color: var(--text); }
.inline { display: inline; margin: 0; }
.link-btn {
    background: none; border: none; color: var(--muted); cursor: pointer;
    font: inherit; font-weight: 500; font-size: 14px; padding: 0;
}
.link-btn:hover { color: var(--text); }

/* ---- Layout -------------------------------------------------------------- */
.container { max-width: 880px; margin: 0 auto; padding: 40px 24px 80px; overflow-x: clip; }
.footer { text-align: center; color: var(--muted-2); font-size: 13px; padding: 32px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.page-head h1 { margin: 0; }

/* ---- Cards --------------------------------------------------------------- */
.card {
    background: var(--surface);
    border-radius: var(--r-lg);
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.card h2:first-child { margin-top: 0; }
.card--narrow { max-width: 420px; margin-left: auto; margin-right: auto; }
.card--form { max-width: 640px; }

/* ---- Hero / Home --------------------------------------------------------- */
.hero { max-width: 460px; width: 100%; margin: 16px auto; }
.hero h1 { font-size: 38px; line-height: 1.1; text-align: center; margin-bottom: 12px; word-break: break-word; }
.subtitle { color: var(--muted); margin: 0 0 28px; text-align: center; font-size: 16px; }
.checkout-form {
    background: var(--surface);
    border-radius: var(--r-lg);
    padding: 28px;
    box-shadow: var(--shadow-lg);
    text-align: left;
    width: 100%;
}

/* ---- Fields -------------------------------------------------------------- */
.field { display: block; margin-bottom: 20px; }
.field__label {
    display: block; font-size: 13px; font-weight: 600; color: var(--text-2);
    margin-bottom: 7px;
}
input[type=text], input[type=email], input[type=password], input[type=date],
textarea, select {
    width: 100%; padding: 11px 13px; border-radius: var(--r);
    border: 1px solid var(--border-strong); background: #fff; color: var(--text);
    font-family: inherit; font-size: 15px; outline: none;
    box-shadow: 0 1px 1px rgba(0,0,0,.03);
    transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
    box-shadow: var(--ring);
}
textarea { resize: vertical; }
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23697386' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
    padding-right: 36px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.radio-row { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; color: var(--text-2); }
.radio-row label { display: flex; align-items: center; gap: 7px; cursor: pointer; font-weight: 500; }
.radio-row input { accent-color: var(--primary); width: 16px; height: 16px; }
.fieldset {
    border: 1px solid var(--border); border-radius: var(--r);
    padding: 18px; margin: 8px 0 22px; background: var(--surface-2);
}
.fieldset legend { padding: 0 8px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ---- Amount input -------------------------------------------------------- */
.amount-input {
    display: flex; align-items: center; background: #fff;
    border: 1px solid var(--border-strong); border-radius: var(--r);
    padding: 6px 16px; box-shadow: 0 1px 1px rgba(0,0,0,.03);
    transition: border-color .15s, box-shadow .15s;
}
.amount-input:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.amount-input__prefix { color: var(--muted); font-weight: 600; font-size: 22px; margin-right: 8px; }
.amount-input input {
    border: none; background: none; box-shadow: none; padding: 8px 0;
    font-size: 30px; font-weight: 700; color: var(--text); letter-spacing: -.02em;
}
.amount-input input:focus { border: none; box-shadow: none; }

/* ---- Installments -------------------------------------------------------- */
.installments { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.inst-chip {
    padding: 11px 0; border-radius: var(--r); border: 1px solid var(--border-strong);
    background: #fff; color: var(--text-2); font-weight: 600; font-size: 14px;
    cursor: pointer; box-shadow: 0 1px 1px rgba(0,0,0,.03);
    transition: all .12s ease;
}
.inst-chip:hover { border-color: var(--primary); color: var(--primary); }
.inst-chip.is-active {
    background: var(--primary); border-color: var(--primary); color: #fff;
    box-shadow: 0 2px 5px rgba(99,91,255,.4);
}
.installments__hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; }

/* ---- Seletor de metodo de pagamento (home) ------------------------------- */
.methods { display: grid; gap: 12px; }
.method {
    display: flex; align-items: center; gap: 14px; width: 100%;
    padding: 14px 16px; border-radius: var(--r); cursor: pointer; text-align: left;
    border: 1px solid var(--border-strong); background: #fff;
    box-shadow: 0 1px 1px rgba(0,0,0,.03);
    transition: border-color .12s, box-shadow .12s, background .12s;
    font-family: inherit;
}
.method:hover { border-color: var(--primary); }
.method.is-active { border-color: var(--primary); background: var(--primary-soft); box-shadow: var(--ring); }
.method__icon {
    flex: 0 0 auto; width: 42px; height: 42px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-2); color: var(--muted);
}
.method.is-active .method__icon { background: #fff; color: var(--primary); }
.method__body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.method__name { font-weight: 600; font-size: 15px; color: var(--text); }
.method__desc { font-size: 13px; color: var(--muted); }
.method__check {
    flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid var(--border-strong); transition: all .12s;
}
.method.is-active .method__check {
    border-color: var(--primary); background: var(--primary);
    box-shadow: inset 0 0 0 3px #fff;
}

/* ---- Buttons ------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 11px 18px; border-radius: var(--r); border: none;
    background: var(--primary); color: #fff; font-family: inherit;
    font-weight: 600; font-size: 15px; cursor: pointer; text-align: center;
    box-shadow: 0 1px 1px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.08);
    transition: transform .08s ease, background .15s, box-shadow .15s;
}
.btn:hover { background: var(--primary-hover); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(99,91,255,.35); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn:disabled:hover { background: var(--primary); transform: none; box-shadow: none; }
.btn--block { display: flex; width: 100%; }
.btn--lg { padding: 14px 20px; font-size: 16px; }
.btn--sm { padding: 7px 13px; font-size: 13px; border-radius: var(--r-sm); }
.btn--danger { background: var(--red); box-shadow: 0 1px 2px rgba(223,27,65,.25); }
.btn--danger:hover { background: #c4163a; box-shadow: 0 4px 10px rgba(223,27,65,.3); }
.btn--ghost {
    background: #fff; color: var(--text-2);
    border: 1px solid var(--border-strong); box-shadow: 0 1px 1px rgba(0,0,0,.03);
}
.btn--ghost:hover { background: var(--surface-2); color: var(--primary); border-color: var(--primary); box-shadow: none; }
.link { color: var(--primary); font-weight: 500; font-size: 14px; }

/* Divisor "ou" */
.divider {
    display: flex; align-items: center; gap: 14px;
    margin: 22px 0; color: var(--muted-2); font-size: 13px;
}
.divider::before, .divider::after {
    content: ""; flex: 1; height: 1px; background: var(--border);
}

/* ---- Tables -------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); font-weight: 600; padding: 0 12px 12px; border-bottom: 1px solid var(--border);
}
.table td { padding: 16px 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr:last-child td { border-bottom: none; }

/* ---- Badges / chips ------------------------------------------------------ */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--ok { background: var(--green-soft); color: #0c8a64; }
.badge--warn { background: var(--amber-soft); color: var(--amber); }
.badge--muted { background: var(--surface-2); color: var(--muted); }
.chip {
    display: inline-block; padding: 3px 9px; border-radius: var(--r-sm);
    background: var(--surface-2); border: 1px solid var(--border);
    font-size: 12px; font-weight: 500; color: var(--text-2); margin-right: 4px;
}

/* ---- Alerts -------------------------------------------------------------- */
.alert {
    padding: 12px 16px; border-radius: var(--r); margin-bottom: 18px; font-size: 14px;
    font-weight: 500; box-shadow: 0 1px 1px rgba(0,0,0,.03);
}
.alert--error { background: var(--red-soft); color: #b3123a; border: 1px solid #f6cdd6; }
.alert--ok { background: var(--green-soft); color: #0c8a64; border: 1px solid #b6ecda; }
.alert--warn { background: var(--amber-soft); color: var(--amber); border: 1px solid #f6dcba; }
.alert--muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.big-alert { font-size: 17px; font-weight: 600; padding: 18px; text-align: center; }

/* ---- Key-value ----------------------------------------------------------- */
.kv { display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); gap: 16px; }
.kv:last-child { border-bottom: none; }
.kv > span:first-child { color: var(--muted); font-size: 14px; }
.kv strong { color: var(--text); }

/* ---- Invoice / checkout (estilo Stripe Checkout) ------------------------- */
.invoice {
    /* 600px no desktop: espaço suficiente pro Brick do MP (bandeiras, CPF/CNPJ) */
    max-width: 600px; margin: 16px auto;
    background: var(--surface); border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg); overflow: hidden;
}
.invoice__head {
    text-align: center; padding: 32px 36px 0;
}
.invoice__head .small { letter-spacing: .12em; font-weight: 600; color: var(--muted-2); }
.invoice__head h1 { font-size: 22px; margin-top: 6px; }
.invoice__amount { text-align: center; padding: 16px 36px 24px; }
.invoice__amount .small { letter-spacing: .1em; font-weight: 600; color: var(--muted-2); }
.big { font-size: 42px; font-weight: 800; display: block; letter-spacing: -.03em; color: var(--text); margin-top: 4px; }
.invoice > .alert, .invoice .card, .invoice .checkout-wrap, .invoice #result, .invoice #amount-step {
    margin-left: 28px; margin-right: 28px;
}
.invoice .card { box-shadow: none; border: 1px solid var(--border); }
.checkout-wrap { padding-bottom: 28px; }
.copy-row { display: flex; gap: 8px; margin: 14px 0; }
.copy-row input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
.pix-qr {
    width: 220px; height: 220px; margin: 18px auto; display: block;
    background: #fff; border: 1px solid var(--border); border-radius: var(--r);
    padding: 10px; box-shadow: var(--shadow-sm);
}
.result { padding: 0 0 8px; }

/* faixa fina de marca no topo da fatura */
.invoice::before {
    content: ""; display: block; height: 4px; background: var(--grad);
}

/* ---- Abas de pagamento (PIX / Cartão) ------------------------------------ */
.pay-tabs {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--r); padding: 4px; margin-bottom: 22px;
}
.pay-tab {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px; border: none; background: none; cursor: pointer;
    font-family: inherit; font-weight: 600; font-size: 14px; color: var(--muted);
    border-radius: var(--r-sm); transition: all .12s;
}
.pay-tab:hover { color: var(--text); }
.pay-tab.is-active { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }

/* ---- Formulário de cartão (cardForm próprio) ----------------------------- */
.card-form { text-align: left; }
.cf-input {
    width: 100%; padding: 11px 13px; border-radius: var(--r);
    border: 1px solid var(--border-strong); background: #fff; color: var(--text);
    font-family: inherit; font-size: 15px; outline: none; height: 44px;
    box-shadow: 0 1px 1px rgba(0,0,0,.03);
    transition: border-color .15s, box-shadow .15s;
}
.cf-input::placeholder { color: var(--muted-2); }
.cf-input:focus { border-color: var(--primary); box-shadow: var(--ring); }
select.cf-input {
    appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23697386' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px;
}

/* Campo número do cartão com bandeira */
.cf-card-number { position: relative; }
.cf-brand {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    display: flex; align-items: center; height: 24px;
}
.cf-brand img { height: 22px; width: auto; border-radius: 3px; }

/* CPF/CNPJ: select de tipo grudado no input do número */
.cf-doc { display: flex; }
.cf-doc-type {
    flex: 0 0 auto; width: 78px; border: 1px solid var(--border-strong);
    border-right: none; border-radius: var(--r) 0 0 var(--r);
    background: var(--surface-2); color: var(--text); font-family: inherit;
    font-size: 14px; font-weight: 600; padding: 0 8px; height: 44px; outline: none;
    appearance: none; cursor: pointer; text-align: center;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 12 8'%3E%3Cpath fill='%23697386' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center; padding-right: 22px;
}
.cf-doc .cf-input { border-radius: 0 var(--r) var(--r) 0; }
.cf-doc:focus-within .cf-doc-type { border-color: var(--primary); }

.cf-secure { text-align: center; color: var(--muted-2); font-size: 12px; margin: 12px 0 0; }
.cf-lock { margin-right: 4px; }

/* ---- Telas de resultado -------------------------------------------------- */
.result-card { text-align: center; padding: 8px 0 16px; }
.result-card h2 { margin: 8px 0 4px; }
.result-card--ok .result-icon { color: var(--green); }
.result-icon {
    width: 56px; height: 56px; margin: 0 auto 8px; border-radius: 50%;
    background: var(--green-soft); color: var(--green);
    display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700;
}
.result-icon--wait { background: var(--amber-soft); }
.pix-intro {
    display: flex; align-items: center; gap: 12px; text-align: left;
    background: var(--primary-soft); border-radius: var(--r); padding: 14px 16px; margin-bottom: 18px;
}
.pix-intro p { margin: 0; font-size: 14px; color: var(--text-2); }

/* ---- Responsivo ---------------------------------------------------------- */

/* Tablet (≤768px) */
@media (max-width: 768px) {
    .container { padding: 28px 20px 64px; }
    .page-head { flex-wrap: wrap; }
    .grid-2 { grid-template-columns: 1fr; gap: 14px; }
    .table th, .table td { padding: 12px 8px; }
}

/* Mobile (≤520px) */
@media (max-width: 520px) {
    .container { padding: 20px 16px 60px; }
    .topbar { padding: 0 16px; height: 56px; }
    .brand { font-size: 16px; }
    .nav { gap: 12px; }

    /* Hero / home */
    .hero { padding: 0 4px; }
    .hero h1 { font-size: 22px; }
    .subtitle { font-size: 14px; }
    .checkout-form { padding: 20px 16px; }
    .amount-input input { font-size: 24px; }
    .amount-input__prefix { font-size: 18px; }

    /* Invoice — borda a borda: o container perde o padding lateral */
    .container:has(.invoice) { padding-left: 0; padding-right: 0; padding-top: 0; }
    .invoice {
        margin: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
        border-top: 1px solid var(--border);
    }
    .invoice::before { height: 3px; }
    .invoice__head { padding: 24px 20px 0; }
    .invoice__head h1 { font-size: 18px; }
    .invoice__amount { padding: 12px 20px 20px; }
    .big { font-size: 30px; }
    .invoice > .alert, .invoice .card, .invoice .checkout-wrap,
    .invoice #result, .invoice #amount-step {
        margin-left: 16px; margin-right: 16px;
    }
    .checkout-wrap { padding-bottom: 20px; }

    /* Tabelas — scroll horizontal */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table { min-width: 520px; }
    .installments { grid-template-columns: repeat(4, 1fr); }

    /* Cards */
    .card { padding: 18px 16px; }
    .card--narrow { margin: 0; }

    /* Botões */
    .btn--lg { padding: 13px 16px; font-size: 15px; }
    .page-head h1 { font-size: 22px; }
    .divider { margin: 18px 0; }
}
