:root {
    --lf-primary: #0d6efd;
    --lf-primary-dark: #0b5ed7;
    --lf-success: #198754;
    --lf-success-soft: #ecf8f1;
    --lf-bg: #f4f7fb;
    --lf-surface: #ffffff;
    --lf-text: #1f2937;
    --lf-muted: #6b7280;
    --lf-border: #e5e7eb;
    --lf-radius: 16px;
    --lf-shadow: 0 4px 18px rgba(15, 23, 42, .06);
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    background: var(--lf-bg);
    color: var(--lf-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img,
svg {
    max-width: 100%;
}

a,
button,
input,
textarea {
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease, transform .08s ease;
}

:focus-visible {
    outline: 3px solid rgba(13, 110, 253, .28);
    outline-offset: 2px;
}

.btn {
    min-height: 46px;
    border-radius: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
}

.btn-primary {
    background-color: var(--lf-primary);
    border-color: var(--lf-primary);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background-color: var(--lf-primary-dark);
    border-color: var(--lf-primary-dark);
}

.btn:active {
    transform: translateY(1px);
}

/* Páginas de consulta e cadastro não encontrado */
.lf-auth-page {
    min-height: 100vh;
}

.lf-auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 14px;
}

.lf-auth-card {
    width: 100%;
    max-width: 420px;
    padding: 24px;
    background: var(--lf-surface);
    border: 1px solid rgba(229, 231, 235, .8);
    border-radius: var(--lf-radius);
    box-shadow: var(--lf-shadow);
}

.lf-auth-logo {
    display: block;
    width: auto;
    max-width: 116px;
    max-height: 58px;
    margin: 0 auto 20px;
    object-fit: contain;
}

.lf-eyebrow {
    margin: 0 0 8px;
    color: var(--lf-primary);
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .09em;
    line-height: 1.35;
    text-transform: uppercase;
}

.lf-auth-title {
    margin: 0;
    color: var(--lf-text);
    font-size: clamp(1.4rem, 5vw, 1.75rem);
    font-weight: 750;
    line-height: 1.2;
}

.lf-auth-description {
    margin: 10px 0 0;
    color: var(--lf-muted);
    font-size: .95rem;
    line-height: 1.55;
}

.lf-auth-form {
    margin-top: 24px;
}

.lf-auth-form .form-label {
    margin-bottom: 7px;
    font-size: .88rem;
    font-weight: 700;
}

.lf-auth-form .form-control {
    min-height: 52px;
    padding: .75rem .9rem;
    border-color: #cfd7e3;
    border-radius: 11px;
    color: var(--lf-text);
    font-size: 16px;
}

.lf-auth-form .form-control::placeholder {
    color: #929baa;
}

.lf-auth-form .form-control:focus {
    border-color: var(--lf-primary);
    box-shadow: 0 0 0 .22rem rgba(13, 110, 253, .13);
}

.lf-auth-form .btn {
    width: 100%;
    min-height: 52px;
}

.lf-form-hint {
    margin: 8px 0 0;
    color: var(--lf-muted);
    font-size: .8rem;
    line-height: 1.45;
}

.lf-error-mark {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: #fff3f3;
    color: #c24141;
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    font-weight: 800;
}

/* Página de fatura */
.invoice-page {
    min-height: 100vh;
}

.lf-navbar {
    min-height: 58px;
    padding: 0;
    background: var(--lf-primary);
    box-shadow: 0 2px 12px rgba(13, 110, 253, .16);
}

.lf-navbar .container {
    max-width: 1080px;
    min-height: 58px;
    padding: 8px 16px;
}

.lf-navbar .navbar-brand {
    margin: 0;
    padding: 0;
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: .02em;
    line-height: 1.1;
    white-space: normal;
}

.lf-navbar .navbar-brand small {
    display: block;
    margin-top: 3px;
    color: rgba(255, 255, 255, .8);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .04em;
}

.invoice-main {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px 16px 36px;
}

.invoice-page .card {
    overflow: hidden;
    border: 0;
    border-radius: var(--lf-radius);
    background: var(--lf-surface);
    box-shadow: var(--lf-shadow);
}

.invoice-page .card-header {
    padding: 15px 18px;
    border: 0;
    border-bottom: 1px solid var(--lf-border);
    background: var(--lf-surface);
    color: var(--lf-text);
    font-size: .9rem;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.invoice-page .card-body {
    padding: 18px;
}

.invoice-summary-card {
    border-top: 3px solid var(--lf-primary) !important;
}

.invoice-customer-label,
.invoice-detail-label {
    display: block;
    margin-bottom: 5px;
    color: var(--lf-muted);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .065em;
    text-transform: uppercase;
}

.invoice-customer-name {
    margin: 0;
    color: var(--lf-text);
    font-size: clamp(1.16rem, 4vw, 1.45rem);
    font-weight: 750;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.invoice-plan {
    margin: 7px 0 0;
    color: var(--lf-muted);
    font-size: .9rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.invoice-plan strong {
    color: var(--lf-text);
}

.invoice-key-details {
    margin-top: 18px;
}

.invoice-detail {
    height: 100%;
    padding: 14px;
    border: 1px solid var(--lf-border);
    border-radius: 12px;
    background: #fbfcfe;
}

.invoice-amount {
    color: var(--lf-primary-dark);
    font-size: clamp(1.55rem, 6vw, 2.05rem);
    font-weight: 800;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.invoice-due-date {
    color: var(--lf-text);
    font-size: 1.08rem;
    font-weight: 750;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.invoice-message {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--lf-border);
    color: #4b5563;
    font-size: .92rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.invoice-message > :last-child {
    margin-bottom: 0;
}

.invoice-message img,
.invoice-message iframe,
.invoice-message table {
    max-width: 100%;
}

.payment-card {
    margin-bottom: 16px;
}

.pix-card.border-success {
    border-top: 3px solid var(--lf-success) !important;
}

.pix-card.border-secondary {
    border-top: 3px solid #8a94a3 !important;
}

.pix-card .card-header.bg-success,
.pix-card .card-header.bg-secondary {
    background: var(--lf-surface) !important;
    color: var(--lf-text) !important;
}

.pix-card .card-body {
    padding: 20px;
}

.qr-code {
    display: block;
    width: 100%;
    max-width: 250px;
    height: auto;
    margin-right: auto;
    margin-left: auto;
    padding: 9px;
    border: 1px solid var(--lf-border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 3px 14px rgba(15, 23, 42, .06);
}

.pix-card .form-label {
    margin-bottom: 7px;
    color: var(--lf-text);
    font-size: .86rem;
    font-weight: 750;
}

.pix-code {
    min-height: 7rem;
    padding: .75rem;
    resize: none;
    overflow-wrap: anywhere;
    word-break: break-all;
    border-color: var(--lf-border);
    border-radius: 10px;
    background: #f8fafc;
    color: #334155;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: .78rem;
    line-height: 1.5;
}

.copy-btn {
    width: 100%;
    min-height: 50px;
    cursor: pointer;
}

#pix-copy-status {
    min-height: 1.35rem;
    color: var(--lf-success);
    font-size: .86rem;
    font-weight: 700;
}

.pix-tip {
    margin: 0 0 16px;
    padding: 11px 14px;
    border: 1px solid #cae9d8;
    border-radius: 12px;
    background: var(--lf-success-soft);
    color: #166b45;
    font-size: .84rem;
    line-height: 1.45;
}

.payment-stack .card {
    margin-bottom: 16px;
}

.payment-stack .card:last-child {
    margin-bottom: 0;
}

.payment-stack .card.border-primary {
    border-top: 3px solid var(--lf-primary) !important;
}

.payment-stack .card.border-secondary {
    border-top: 3px solid #8a94a3 !important;
}

.payment-stack .card-header.bg-primary,
.payment-stack .card-header.bg-secondary {
    background: var(--lf-surface) !important;
    color: var(--lf-text) !important;
}

.payment-stack .card-body {
    overflow-wrap: anywhere;
}

.payment-stack .card-body img {
    height: auto;
}

.boleto-button {
    min-width: 210px;
}

.table-card .card-body {
    padding: 0;
}

.table-card .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-card .table {
    min-width: 620px;
    margin: 0;
    color: var(--lf-text);
    font-size: .88rem;
    vertical-align: middle;
}

.table-card .table > :not(caption) > * > * {
    padding: .8rem .9rem;
    border-color: var(--lf-border);
}

.table-card .table thead th {
    background: #f8fafc;
    color: #475569;
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table-card .table tbody tr:last-child td {
    border-bottom: 0;
}

@media (max-width: 767.98px) {
    .lf-auth-shell {
        align-items: flex-start;
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    .lf-auth-card {
        padding: 22px 18px;
    }

    .lf-navbar,
    .lf-navbar .container {
        min-height: 54px;
    }

    .lf-navbar .container {
        padding-right: 14px;
        padding-left: 14px;
    }

    .invoice-main {
        padding: 14px 12px 28px;
    }

    .invoice-page .card {
        border-radius: 14px;
    }

    .invoice-page .card-header {
        padding: 13px 14px;
        font-size: .82rem;
    }

    .invoice-page .card-body,
    .pix-card .card-body {
        padding: 15px 14px;
    }

    .invoice-key-details {
        margin-top: 15px;
    }

    .invoice-detail {
        padding: 12px;
    }

    .payment-card,
    .payment-stack .card {
        margin-bottom: 14px;
    }

    .qr-code {
        max-width: 220px;
    }

    .pix-tip {
        padding: 10px 12px;
        font-size: .8rem;
    }

    .payment-stack .btn,
    .payment-stack .card-body > a {
        width: 100%;
        min-height: 48px;
    }

    .table-card .table {
        font-size: .76rem;
    }

    .table-card .table > :not(caption) > * > * {
        padding: .65rem .7rem;
    }
}

@media (max-width: 400px) {
    .lf-auth-shell {
        padding-right: 12px;
        padding-left: 12px;
    }

    .lf-auth-card {
        padding: 20px 16px;
    }

    .lf-auth-logo {
        max-width: 108px;
        margin-bottom: 17px;
    }

    .invoice-main {
        padding-right: 12px;
        padding-left: 12px;
    }

    .invoice-amount {
        font-size: 1.5rem;
    }

    .qr-code {
        max-width: 210px;
        padding: 7px;
    }

    .pix-code {
        font-size: .74rem;
    }
}

@media (min-width: 768px) {
    .lf-auth-card {
        padding: 30px;
    }

    .invoice-main {
        padding-top: 28px;
        padding-bottom: 48px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
