/* reset e tipografia global */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    background: #e7ecf2;
    color: #333;
}

/* =========================================================
   APP MOBILE-FIRST LAYOUT (VISÍVEL NO NAVEGADOR)
========================================================= */
.app-container {
    max-width: 650px;
    margin: 40px auto;
    background: #fff;
    min-height: auto;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
}

.app-header {
    background: transparent;
    color: #1b365d;
    padding: 0 10px 24px;
    text-align: center;
    border-bottom: none;
}

.app-logo {
    max-width: 220px;
    margin-bottom: 20px;
    background: #fff;
    padding: 8px;
    border-radius: 4px;
}

.app-header h1 {
    font-size: 1.3rem;
    margin-bottom: 8px;
    font-weight: 700;
}

.app-header p {
    font-size: 0.95rem;
    color: #6b7280;
    margin-bottom: 0;
}

/* Stepper oculto (design da imagem sem stepper) */
.stepper {
    display: none;
}

.step {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1a5935;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.85rem;
    font-weight: bold;
    border: 2px solid transparent;
    transition: 0.3s;
}

.step.active {
    background: #fff;
    color: #0F321E;
    border-color: #fff;
}

.step-line {
    height: 2px;
    background: #1a5935;
    width: 40px;
    margin: 0 4px;
}

#prestacao-form {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-step {
    display: none;
    flex: 1;
    flex-direction: column;
}

.form-step.active {
    display: flex;
}

.form-section {
    margin-bottom: 24px;
    padding-bottom: 0;
}

.form-section h2 {
    font-size: 1rem;
    color: #1a5935;
    margin-bottom: 20px;
    font-weight: 700;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 10px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 10px;
}

.section-header h2 {
    margin-bottom: 0;
    border: none;
    padding: 0;
}

#contador-despesas {
    font-size: 0.9rem;
    color: #777;
    font-weight: bold;
}

.input-group {
    margin-bottom: 16px;
    position: relative;
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.col {
    flex: 1;
}

.row .input-group {
    margin-bottom: 0;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 6px;
}

/* Esconder labels na div que tiver a classe .hide-labels para ficar igual placeholders da foto */
.hide-labels label {
    display: none;
}

input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    color: #374151;
    font-family: inherit;
    transition: all 0.2s;
    background: #fff;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #e65c00;
    box-shadow: 0 0 0 3px rgba(230, 92, 0, 0.1);
}

input::placeholder, textarea::placeholder {
    color: #9ca3af;
}

textarea {
    resize: vertical;
}

/* Card de Despesa */
.despesa-card {
    background: #fff;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
    border-left: 4px solid #1a5935;
}

.despesa-card .btn-remover {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #fef2f2;
    border: none;
    color: #ef4444;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.despesa-card .btn-remover:hover {
    background: #fee2e2;
}

.despesa-card h4 {
    margin-bottom: 16px;
    font-size: 0.95rem;
    color: #4b5563;
    font-weight: 600;
}

/* Botões */
.btn-outline {
    display: block;
    width: 100%;
    padding: 14px 16px;
    background: #f9fafb;
    color: #4b5563;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
}

.btn-outline:hover {
    background: #f3f4f6;
}

.btn-primary {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 16px;
    background: #e65c00;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 10px;
}

.btn-primary:hover {
    background: #cc5200;
}

.btn-primary:active {
    background: #b34700;
}


/* Navegação de Etapas */
.form-actions {
    margin-top: auto;
    padding-top: 20px;
    display: flex;
    gap: 12px;
}

.form-actions.right {
    justify-content: flex-end;
}

.form-actions.split {
    justify-content: space-between;
}

.form-actions .btn-outline {
    width: 48%;
    border-color: #ccc;
    color: #555;
    margin-bottom: 0;
}

.form-actions .btn-outline:hover {
    background: #f2f2f2;
}

.form-actions .btn-primary {
    width: 48%;
    margin-top: 0;
}

.form-actions.right .btn-primary {
    width: 100%;
}


/* Box de Resumo */
.resumo-box {
    background: #f2f2f2;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.resumo-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.resumo-item.destaque {
    border-top: 1px solid #ccc;
    padding-top: 8px;
    margin-top: 8px;
    font-size: 1.2rem;
    color: #0F321E;
}

.status-saldo {
    text-align: right;
    font-weight: bold;
    font-size: 0.95rem;
    margin-top: 8px;
    color: #555;
}

.status-saldo.restituir {
    color: #d9534f;
}

.status-saldo.reembolsar {
    color: #5cb85c;
}

.status-saldo.zerado {
    color: #555;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0F321E;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* =========================================================
   TEMPLATE A4 PARA PDF (PADRÃO ANTIGO ESTILIZADO)
========================================================= */

#pdf-container {
    /* Esconde o PDF do fluxo da tela; html2pdf puxará o conteúdo interno (#pdf-content) */
    display: none;
    background: #fff;
}

/* A div pagina será capturada pelo html2pdf. Ela precisa ter fundo branco e fontes limpas. */
.pagina {
    width: 210mm;
    height: 297mm;
    padding: 20mm 15mm 20mm 25mm;
    box-sizing: border-box;
    position: relative;
    background: #fff;
    color: #000;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11pt;
    /* Fonte base de impressão */
}

/* HEADER */
.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 8mm;
    border-bottom: 2px solid #0F321E;
    padding-bottom: 10px;
}

.logo {
    width: 140px;
}

.header h1 {
    font-size: 15pt;
    margin: 0;
    color: #000;
    text-align: right;
}

.linha {
    display: none;
}

/* CONTEÚDO */
.bloco {
    margin-bottom: 6mm;
}

.linha-dupla {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3mm;
}

.linha-dupla div {
    width: 48%;
}

.d-val {
    border-bottom: none;
    display: inline-block;
    padding-left: 5px;
}

.bloco strong {
    display: inline-block;
    min-width: 35px;
}

/* TABELA */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 4mm;
    margin-bottom: 6mm;
}

th,
td {
    border: 1px solid #444;
    padding: 6px;
    font-size: 10pt;
}

th {
    background: #f2f2f2;
    text-align: left;
    font-weight: bold;
    color: #0F321E;
}

.valor {
    text-align: right;
}

/* RESUMO */
.resumo {
    margin-top: 2mm;
}

.resumo-linhas {
    margin-bottom: 4mm;
}

.resumo-linhas .d-val {
    border-bottom: none;
    min-width: auto;
    font-weight: normal;
}

.resumo-linhas .saldo {
    font-weight: bold;
    font-size: 12pt;
    margin-top: 3mm;
}

.opcoes {
    margin-top: 4mm;
    font-size: 10pt;
    font-weight: bold;
}

.checkbox {
    font-weight: normal;
}

/* OBSERVAÇÕES */
.linha-texto {
    border-bottom: none;
    height: auto;
    margin-top: 2mm;
}

/* ASSINATURAS */
.assinaturas {
    position: absolute;
    bottom: 25mm;
    /* Distância do rodapé */
    left: 25mm;
    right: 15mm;
    display: flex;
    justify-content: space-between;
}

.assinaturas>div {
    width: 40%;
}

.linha-ass {
    border-bottom: 1px solid #000;
    width: 100%;
    margin-bottom: 5px;
}

.assinaturas p {
    text-align: center;
    font-size: 10pt;
    margin: 0;
}