:root {
    --color-principal: #1f4e79;
}

body {
    background-color: #f5f6f8;
}

.navbar {
    background-color: var(--color-principal);
    --bs-navbar-padding-y: .35rem;
    --bs-navbar-color: rgba(255, 255, 255, .82);
    --bs-navbar-hover-color: #fff;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.05rem;
}

.navbar .nav-link {
    border-radius: .4rem;
    padding-inline: .75rem !important;
}

.navbar .nav-link.active {
    background: rgba(0, 0, 0, .2);
}

.btn-primary {
    --bs-btn-bg: var(--color-principal);
    --bs-btn-border-color: var(--color-principal);
    --bs-btn-hover-bg: #173b5c;
    --bs-btn-hover-border-color: #173b5c;
}

.table td,
.table th {
    vertical-align: middle;
}

.import {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.stat {
    font-size: 1.5rem;
    font-weight: 600;
}

/* ---------- Rebut ---------- */
.rebut {
    background: #fff;
    border: 2px solid #222;
    padding: 1.25rem 1.5rem;
    color: #111;
    font-size: .95rem;
    max-width: 820px;
    margin: 0 auto 1.5rem;
    position: relative;
    break-inside: avoid;
    page-break-inside: avoid;
}

.rebut-cap {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    border-bottom: 1px solid #222;
    padding-bottom: .6rem;
    margin-bottom: .75rem;
}

.rebut-titol {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: .15rem;
    line-height: 1;
}

.rebut-subtitol {
    font-size: .85rem;
    text-transform: uppercase;
    color: #444;
}

.rebut-dades-cap {
    text-align: right;
    font-size: .9rem;
}

.rebut-total-cap {
    display: inline-block;
    border: 2px solid #222;
    padding: .2rem .7rem;
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: .3rem;
}

.rebut-fila {
    display: flex;
    gap: .5rem;
    border-bottom: 1px dotted #888;
    padding: .25rem 0;
}

.rebut-fila .etiqueta {
    flex: 0 0 9.5rem;
    color: #444;
}

.rebut-fila .valor {
    flex: 1;
    font-weight: 600;
}

.rebut table {
    width: 100%;
    margin: .75rem 0 .5rem;
    border-collapse: collapse;
}

.rebut table th,
.rebut table td {
    border-bottom: 1px solid #ccc;
    padding: .2rem .3rem;
}

.rebut table tfoot td {
    border-top: 2px solid #222;
    border-bottom: none;
    font-weight: 700;
}

.rebut-peu {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    font-size: .85rem;
    margin-top: .5rem;
}

.rebut-signatura {
    min-width: 13rem;
    text-align: center;
    border-top: 1px solid #222;
    padding-top: .2rem;
    margin-top: 2.5rem;
}

.segell-cobrat {
    position: absolute;
    left: 50%;
    bottom: 1.2rem;
    transform: translateX(-50%) rotate(-10deg);
    border: 3px solid #1a7f37;
    color: #1a7f37;
    font-weight: 700;
    font-size: 1.3rem;
    padding: .1rem .7rem;
    border-radius: .3rem;
    opacity: .85;
    text-align: center;
    line-height: 1.15;
}

.segell-cobrat small {
    display: block;
    font-size: .7rem;
}

.rebut-copia {
    position: absolute;
    top: .3rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: .7rem;
    letter-spacing: .1rem;
    color: #666;
}

.tall {
    max-width: 820px;
    margin: 0 auto 1.5rem;
    border-top: 1px dashed #999;
}

@media print {
    @page {
        size: A4;
        margin: 10mm;
    }

    body {
        background: #fff;
    }

    .no-print,
    .navbar,
    .btn,
    .alert {
        display: none !important;
    }

    .container {
        max-width: none !important;
        padding: 0 !important;
    }

    .rebut {
        margin-bottom: 8mm;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body {
        padding: 0 !important;
    }

    .tall {
        margin-bottom: 6mm;
    }

    .pagina .rebut:last-child {
        margin-bottom: 0;
    }

    .pagina + .pagina {
        break-before: page;
        page-break-before: always;
    }
}
