﻿:root {
    /* Base */
    --bg: #F4F7FB;
    --card: #FFFFFF;
    --card2: #F0F4F9;
    /* Texto */
    --text: #0F172A;
    --muted: #5B6B80;
    --line: #D6E0EA;
    /* Estados */
    --ok: #1E9E4A;
    --warn: #F2A900;
    --bad: #E1261C;
    /* Destaques / CTA */
    --accent: #005EA8;
    --accent2: #3B82C4;
    /* Layout */
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    --radius: 10px;
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
    background: radial-gradient(1000px 600px at 20% -10%, rgba(0,94,168,.10), transparent 60%), var(--bg);
    color: var(--text);
}

a {
    color: inherit
}

.resultadoPage .container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 18px 28px;
}

.hero {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: stretch;
    margin-top: 10px;
}

.stat {
    flex: 1 1 220px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    min-height: 74px;
}

    .stat .k {
        font-size: 12px;
        color: var(--muted);
        margin-top: 10px
    }

        .stat .k:first-child {
            margin-top: 0
        }

    .stat .v {
        font-size: 18px;
        font-weight: 800;
        margin-top: 6px
    }

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 14px;
}

.btnSelecionarTodas {
    background-color: rgba(13, 110, 253, 0.8) !important;
    color: white !important;
}

.btnLimpar {
    background-color: rgba(255,0,0,0.8) !important;
    color: white !important;
}

.btnGerarPix {
    width: 100%;
}

summary.parcelasSummary {
    list-style: none;
    cursor: pointer;
    margin: 12px 0 0;
    padding: 12px 12px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(240,244,249,.95), rgba(240,244,249,.75));
    border: 1px solid rgba(214,224,234,.95);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

    summary.parcelasSummary:hover {
        border-color: rgba(0,94,168,.30);
        box-shadow: 0 8px 18px rgba(0,0,0,.06);
    }

    summary.parcelasSummary::-webkit-details-marker {
        display: none;
    }

.parcelasSummaryLeft {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

    .parcelasSummaryLeft strong {
        font-weight: 900;
        font-size: 13px;
        letter-spacing: .2px;
    }

.parcelasSummarySub {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.25;
}

/* Chevron desenhado no CSS (não precisa de ícone externo) */
.parcelasChevron {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    border: 1px solid rgba(214,224,234,.95);
    background: rgba(255,255,255,.85);
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

    .parcelasChevron::before {
        content: "";
        width: 8px;
        height: 8px;
        border-right: 2px solid rgba(15,23,42,.65);
        border-bottom: 2px solid rgba(15,23,42,.65);
        transform: rotate(45deg); /* seta para baixo */
        transition: transform .18s ease;
    }

/* quando fechado, seta vira "para a direita/cima" */
details:not([open]) > summary.parcelasSummary .parcelasChevron::before {
    transform: rotate(-45deg);
}

/* feedback de foco (acessibilidade) */
summary.parcelasSummary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0,94,168,.12);
    border-color: rgba(0,94,168,.35);
}


@media (min-width: 1000px) {
    .grid {
        grid-template-columns: 1fr 1fr;
    }
}

.resultadoPage .card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.cardHeader {
    padding: 14px 14px 12px;
    border-bottom: 1px solid rgba(214,224,234,.8);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.resultadoPage .row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%
}


.contractTitle {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .contractTitle .h {
        font-weight: 900;
        font-size: 16px;
        display: flex;
        align-items: center;
        gap: 10px;
    }

.badge {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
    background: var(--card2);
    white-space: nowrap;
}

.desc {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
    max-width: 520px
}

.actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.resultadoPage button {
    appearance: none;
    border: none;
    cursor: pointer;
    border-radius: 12px;
    padding: 10px 12px;
    font-weight: 800;
    color: var(--text);
    background: var(--card2);
    border: 1px solid var(--line);
}

button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

    button.primary:hover {
        filter: brightness(.98)
    }

button.small {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
}

button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

details {
    padding: 0 5px 5px;
}

summary {
    list-style: none;
    cursor: pointer;
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--card2);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

    summary::-webkit-details-marker {
        display: none
    }

.tableWrap {
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    background: #fff;
}


.resultadoPage table {
    width: 100%;
    border-collapse: collapse;
}

.resultadoPage th, td {
    padding: 8px 8px;
    border-bottom: 1px solid rgba(214,224,234,.8);
    font-size: 11px;
    vertical-align: top;
}

.resultadoPage th {
    color: var(--muted);
    text-align: left;
    font-weight: 800;
    background: var(--card2);
    white-space: nowrap;
}

tr:last-child td {
    border-bottom: none
}

.chk {
    display: flex;
    align-items: center;
    gap: 10px;
}

.resultadoPage input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.money {
    font-weight: 900;
    white-space: nowrap
}

.status {
    font-size: 11px;
    font-weight: 900;
    padding: 3px 7px;
    border-radius: 999px;
    white-space: nowrap;
    border: 1px solid var(--line);
    background: var(--card2);
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .status.bad {
        border-color: rgba(225,38,28,.35);
        color: #7f1d1d;
        background: rgba(225,38,28,.10)
    }

    .status.warn {
        border-color: rgba(242,169,0,.35);
        color: #7c4a00;
        background: rgba(242,169,0,.14)
    }

    .status.ok {
        border-color: rgba(30,158,74,.35);
        color: #14532d;
        background: rgba(30,158,74,.12)
    }

/* footer do contrato (CTA por Carnê) */
.contractFooter {
    margin-top: 12px;
    padding: 12px;
    border: 1px dashed rgba(0,94,168,.35);
    border-radius: 14px;
    background: rgba(0,94,168,.06);
    display: flex;
    align-items: center;
    justify-content: space-around;
}

    .contractFooter .info {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

        .contractFooter .info .a {
            font-weight: 900
        }

        .contractFooter .info .b {
            font-size: 12px;
            color: var(--muted)
        }

.hintLock {
    margin-top: 10px;
    font-size: 12px;
    color: var(--muted);
    background: #fff7ed;
    border: 1px solid rgba(242,169,0,.35);
    padding: 10px 12px;
    border-radius: 12px;
    display: none;
}

    .hintLock.show {
        display: block
    }


.vencimento-info {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 999px; /* pill */
    display: inline-block;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

/* 🔴 Vencido */
.vencido {
    color: #b42318;
    background-color: rgba(180, 35, 24, 0.08);
    border: 1px solid rgba(180, 35, 24, 0.25);
}

/* 🟡 Vence hoje */
.vence-hoje {
    color: #a15c00;
    background-color: rgba(255, 193, 7, 0.12);
    border: 1px solid rgba(255, 193, 7, 0.35);
}

/* 🟢 A vencer */
.a-vencer {
    color: #137547;
    background-color: rgba(19, 117, 71, 0.10);
    border: 1px solid rgba(19, 117, 71, 0.30);
}

/* =========================================================
   TABELA (DESKTOP / PADRÃO)
   ========================================================= */

.tableWrap {
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}

.parcelas-table {
    width: 100%;
    border-collapse: collapse;
}

    .parcelas-table th,
    .parcelas-table td {
        padding: 10px 10px;
        border-bottom: 1px solid rgba(214,224,234,.8);
        font-size: 12px;
        vertical-align: middle;
    }

    .parcelas-table th {
        color: var(--muted);
        text-align: left;
        font-weight: 800;
        background: var(--card2);
        white-space: nowrap;
    }

    .parcelas-table tr:last-child td {
        border-bottom: none;
    }

    .parcelas-table .money {
        font-weight: 900;
        white-space: nowrap;
    }

    /* checkbox padrão (desktop) */
    .parcelas-table input[type="checkbox"] {
        width: 16px;
        height: 16px;
        accent-color: var(--accent);
        cursor: pointer;
    }

/* =========================================================
   MOBILE: TRANSFORMA CADA TR EM "CARD" (SEM SCROLL / SEM COLUNAS OCULTAS)
   ========================================================= */

@media (max-width: 576px) {

    .tableWrap {
        border: none;
        background: transparent;
        overflow: visible;
    }

    .parcelas-table thead {
        display: none;
    }

    .parcelas-table,
    .parcelas-table tbody,
    .parcelas-table tr {
        display: block;
        width: 100%;
    }

        /* cada linha vira um card */
        .parcelas-table tr[data-parcela] {
            background: #fff;
            border: 1px solid var(--line);
            border-radius: 16px;
            box-shadow: 0 3px 14px rgba(0,0,0,.05);
            padding: 12px;
            margin-top: 10px;
            display: grid;
            grid-template-columns: 42px 1fr; /* coluna esquerda p/ parcela + checkbox */
            grid-template-areas:
                "left head"
                "left meta"
                "left bottom";
            column-gap: 12px;
            row-gap: 10px;
            transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
        }

        /* remove estilo de célula */
        .parcelas-table td {
            display: block;
            border: none;
            padding: 0;
            font-size: 13px;
            vertical-align: middle;
        }

        .parcelas-table tr[data-parcela] td:nth-child(2) {
            grid-area: left;
            align-self: start;
            font-weight: 900;
            font-size: 13px;
            line-height: 1.1;
        }

        .parcelas-table tr[data-parcela] td:first-child {
            grid-area: left;
            align-self: center;
            display: flex;
            justify-content: flex-start;
            margin-top: 22px;
        }

        /* checkbox redondo */
        .parcelas-table input[type="checkbox"].parcela-check {
            width: 22px;
            height: 22px;
            border-radius: 999px;
            appearance: none;
            -webkit-appearance: none;
            outline: none;
            cursor: pointer;
            border: 2px solid rgba(0,94,168,.35);
            background: rgba(0,94,168,.06);
            box-shadow: inset 0 0 0 2px rgba(255,255,255,.7);
            transition: transform .12s ease, background-color .12s ease, border-color .12s ease, box-shadow .12s ease;
        }

            .parcelas-table input[type="checkbox"].parcela-check:active {
                transform: scale(.96);
            }

            .parcelas-table input[type="checkbox"].parcela-check:checked {
                border-color: var(--accent);
                background: var(--accent);
                box-shadow: 0 0 0 4px rgba(0,94,168,.12);
            }

                .parcelas-table input[type="checkbox"].parcela-check:checked::after {
                    content: "";
                    display: block;
                    width: 10px;
                    height: 6px;
                    border: 2px solid #fff;
                    border-top: 0;
                    border-right: 0;
                    transform: translate(5px, 6px) rotate(-45deg);
                }

        .parcelas-table tr[data-parcela] td:nth-child(3) { /* Vencimento */
            grid-area: head;
            justify-self: start;
            font-weight: 900;
            font-size: 14px;
        }

        .parcelas-table tr[data-parcela] td:nth-child(4) { /* Status */
            grid-area: head;
            justify-self: end;
            align-self: start;
        }

            /* status */
            .parcelas-table tr[data-parcela] td:nth-child(4) .status {
                font-size: 11px;
                padding: 5px 10px;
                border-radius: 999px;
                font-weight: 900;
                display: inline-flex;
                width: auto;
                max-width: 100%;
            }

        /*valor atualizado */
        .parcelas-table tr[data-parcela] td:nth-child(5) {
            grid-area: bottom;
            display: flex;
            align-items: baseline;
            justify-content: space-between;
            gap: 12px;
            padding-top: 10px;
            border-top: 1px solid rgba(214,224,234,.85);
        }

            .parcelas-table tr[data-parcela] td:nth-child(5)::before {
                content: "Valor atualizado";
                font-size: 12px;
                color: var(--muted);
                font-weight: 800;
            }

        .parcelas-table tr[data-parcela] td:nth-child(5) {
            font-size: 18px;
            font-weight: 900;
            white-space: nowrap;
        }

        /* ===== selecionado: sem “vazar branco” =====
     (o branco do padding é o background do card;
      ao pintar o card inteiro, não só borda, com um tom bem leve) */
        .parcelas-table tr[data-parcela]:has(input.parcela-check:checked) {
            background: rgba(0,94,168,.06);
            border-color: rgba(0,94,168,.45);
            box-shadow: 0 8px 20px rgba(0,0,0,.08);
        }

            .parcelas-table tr[data-parcela]:has(input.parcela-check:checked) td:nth-child(5) {
                border-top-color: rgba(0,94,168,.22);
            }

    /* neutraliza widths antigas no mobile */
    .col-vencimento, .col-status, .col-total {
        width: auto !important;
    }
}

@media (max-width: 576px) {

    /* quando a parcela está selecionada,
     elimina fundos brancos internos */
    .parcelas-table tr[data-parcela]:has(input.parcela-check:checked) td,
    .parcelas-table tr[data-parcela]:has(input.parcela-check:checked) .status,
    .parcelas-table tr[data-parcela]:has(input.parcela-check:checked) .badge {
        background: transparent !important;
    }

    /* status mantém apenas a borda e a cor do texto */
    .parcelas-table tr[data-parcela]:has(input.parcela-check:checked) .status {
        border-color: rgba(0,94,168,.45);
    }
}

.parcela-row {
    position: relative;
}
    /* Estado "bloqueado": quando checkbox está disabled */
    .parcela-row:has(.parcela-check:disabled) {
        opacity: .45;
        filter: saturate(.75);
        pointer-events: none; /* impede clique no card inteiro */
    }

/* mas mantém a rolagem e o layout do pai */
.tableWrap, .tableWrap * {
    pointer-events: auto;
}

/* para o modo mobile com layout em cards */
.parcela-row:has(.parcela-check:disabled) .status {
    opacity: .85;
}


.authSelect {
    width: 100%;
    border: 1px solid rgba(214,224,234,.9);
    border-radius: 12px;
    padding: 11px 12px;
    outline: none;
    font-weight: 700;
    cursor: pointer;
}
