/* Base e Estrutura Geral */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f4f8;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

/* Campo oculto pela configuração do admin */
.hidden-field {
    display: none !important;
}

.main-container {
    background-color: #ffffff;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    padding: 0.85rem;
    max-width: 800px;
    width: 95%;
    height: 95%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.page-header {
    position: relative;
    text-align: center;
    margin-bottom: 0.1rem;
    color: #0c1c3f;
    display: flex;
    justify-content: center;
    align-items: center;
}

.page-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0;
}

.header-actions {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 8px;
    align-items: center;
}

.admin-link {
    background: linear-gradient(135deg, #1a365d, #d69e2e);
    color: white;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 15px;
    font-weight: 600;
    font-size: 0.7rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(26, 54, 93, 0.2);
    border: none;
    cursor: pointer;
}

.admin-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 54, 93, 0.3);
    color: white;
    text-decoration: none;
}

.logout-button {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 15px;
    font-weight: 600;
    font-size: 0.7rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.2);
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.logout-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    background: linear-gradient(135deg, #c82333, #bd2130);
}

.logout-button:active {
    transform: translateY(0);
}

.superadmin-button {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    transition: transform 0.1s ease, box-shadow 0.15s ease, opacity 0.2s ease;
}

.superadmin-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
    opacity: 0.95;
}

.superadmin-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
}

/* Modal Superadmin */
.sa-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 16px;
}

.sa-modal.hidden {
    display: none !important;
}

.sa-modal-content {
    background: #fff;
    border-radius: 12px;
    max-width: 1100px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.sa-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #fff;
}

.sa-close-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 8px;
}

.sa-modal-body {
    padding: 16px;
    overflow-y: auto;
}

.sa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 16px;
}

.sa-card {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sa-card-header h4 {
    margin: 0;
    color: #0f172a;
}

.sa-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
    align-items: end;
}

.sa-form input,
.sa-form select {
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
}

.sa-form button {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px;
    cursor: pointer;
    font-weight: 600;
}

.sa-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #0f172a;
}

.sa-list {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    padding: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.sa-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    color: #0f172a;
}

.sa-list-item:last-child {
    border-bottom: none;
}

.sa-actions {
    display: flex;
    gap: 6px;
}

.sa-actions button {
    border: none;
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 12px;
}

.sa-btn-edit {
    background: #0ea5e9;
    color: #fff;
}

.sa-btn-delete {
    background: #ef4444;
    color: #fff;
}

@media (max-width: 768px) {
    .header-actions {
        position: static;
        transform: none;
        margin-top: 8px;
        justify-content: center;
        flex-wrap: wrap;
    }

    .admin-link,
    .logout-button {
        font-size: 0.8rem;
        padding: 8px 16px;
    }

    .page-header {
        flex-direction: column;
    }
}

.page-header p {
    font-size: 0.65rem;
    color: #555;
    margin-top: 0.05rem;
}

.simulator-flex-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: space-between;
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.input-area,
.result-area {
    flex: 1 1 45%;
    padding: 0.6rem;
    background-color: #fafbfd;
    border-radius: 10px;
}

.input-area h3,
.result-area h3 {
    margin-top: 0;
    margin-bottom: 0.4rem;
}

.charts-area {
    flex: 1 1 100%;
    padding: 0.6rem;
    background-color: #fafbfd;
    border-radius: 10px;
    margin-top: 0.5rem;
}

.charts-area h3 {
    font-size: 1rem;
    color: #0c1c3f;
    margin-bottom: 0.4rem;
    border-bottom: 2px solid #ff8c00;
    padding-bottom: 0.3rem;
}

.chart-flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chart-container {
    flex: 1 1 48%;
    min-height: 250px;
    max-height: 350px;
    display: flex;
    flex-direction: column;
}

.chart-container h4 {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.5rem;
    text-align: center;
}

.chart-container canvas {
    width: 100% !important;
    height: auto !important;
    flex-grow: 1;
}

/* Agrupa campos para layout lado a lado */
.form-group-paired {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.form-group-paired .form-group {
    flex: 1;
    margin-bottom: 0;
}

#percentualGroupContainer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 0.5rem;
    row-gap: 0.4rem;
    margin-bottom: 0.4rem;
}

#percentualGroupContainer>.form-group-paired {
    display: contents;
}

#percentualGroupContainer .form-group {
    min-width: 0;
    margin-bottom: 0;
}

/* Agrupa campos para layout de três colunas */
.form-group-triple {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
}

.form-group-triple .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Ajuste específico para o campo de sexo */
.form-group-triple .form-group:last-child {
    flex: 0.8;
    min-width: 120px;
}

/* Layout para slider e input de texto abaixo */
.slider-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.slider-group input[type="range"] {
    width: 100%;
}

/* Container que agrupa input e unidade para parecer uma única caixa */
.input-unit-group {
    display: flex;
    align-items: center;
    margin-top: 0.2rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fff;
    padding: 0.3rem 0.5rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-unit-group:focus-within {
    border-color: #ff8c00;
    box-shadow: 0 0 5px rgba(255, 140, 0, 0.2);
}

.slider-value-display {
    border: none;
    background: transparent;
    color: #ff8c00;
    font-size: 0.75rem;
    text-align: left;
    padding: 0;
    width: 30px;
    /* Ajuste a largura conforme necessário */
    font-weight: bold;
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: none;
    outline: none;
}

.slider-value-display::-webkit-outer-spin-button,
.slider-value-display::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.unit {
    font-size: 0.75rem;
    color: #ff8c00;
    margin-left: 0.2rem;
    font-weight: bold;
    white-space: nowrap;
}

/* Campos de Formulário */
.form-group {
    margin-bottom: 0.4rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.15rem;
    color: #444;
    font-size: 0.75rem;
    height: 1.2rem;
    line-height: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-control {
    width: 100%;
    padding: 0.3rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 0.75rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    border-color: #ff8c00;
    outline: none;
    box-shadow: 0 0 5px rgba(255, 140, 0, 0.2);
}

.form-control:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
}

.input-unit-group:has(input:disabled) {
    background-color: #f8f9fa;
    border-color: #e9ecef;
}

.input-unit-group:has(input:disabled) .unit {
    color: #6c757d;
}

input[type="range"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-with-prefix {
    display: flex;
    align-items: center;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: border-color 0.3s ease;
    padding: 0.3rem 0.5rem;
}

.input-with-prefix .prefix {
    padding-right: 0.5rem;
    font-weight: bold;
    color: #ff8c00;
    font-size: 0.75rem;
}

.input-with-prefix input {
    border: none;
    padding: 0;
    flex: 1;
    font-size: 0.75rem;
    color: #ff8c00;
    /* Alterado para laranja como os outros valores */
    font-weight: bold;
    /* Adicionado para deixar em negrito */
    outline: none;
}

/* Container para os campos de salário lado a lado usando table */
.salary-fields-row {
    display: table;
    width: 100%;
    table-layout: fixed;
}

/* Classe específica para os campos de salário */
.salary-field {
    display: table-cell;
    width: 50%;
    padding-right: 0.5rem;
    vertical-align: top;
}

.salary-field:last-child {
    padding-right: 0;
}

/* Ajustar o input-with-prefix dentro dos campos de salário */
.salary-field .input-with-prefix {
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* Ajustar o input dentro do input-with-prefix para campos de salário */
.salary-field .input-with-prefix input {
    width: 100%;
    text-align: left;
    padding-left: 0;
}

/* Estilo para o campo readonly do excesso de salário */
.salary-field .input-with-prefix:has(input[readonly]) {
    background-color: #f8f9fa;
    border-color: #e9ecef;
}

.salary-field .input-with-prefix:has(input[readonly]) .prefix {
    color: #6c757d;
}

.salary-field .input-with-prefix:has(input[readonly]) input {
    color: #6c757d;
    cursor: not-allowed;
}

.input-with-prefix:focus-within {
    border-color: #ff8c00;
    box-shadow: 0 0 5px rgba(255, 140, 0, 0.2);
}

/* Sliders (Range Inputs) */
.form-group input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    outline: none;
    transition: background 0.2s;
}

.form-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #ff8c00;
    cursor: pointer;
    border-radius: 50%;
    border: 1px solid #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.form-group input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #ff8c00;
    cursor: pointer;
    border-radius: 50%;
    border: 1px solid #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Área de Resultados */
.result-area table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
}

.result-area th,
.result-area td {
    padding: 0.35rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.75rem;
}

.result-area th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #555;
}

/* Estilos para os quadros de resumo */
.result-summary-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    gap: 0.5rem;
}

/* Ajuste de margem para o segundo bloco de quadros */
.result-summary-box.benefits-summary {
    margin-top: 0.5rem;
}

.result-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    border-radius: 10px;
    background-color: #e6f0ff;
    text-align: center;
    box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
}

.result-item:hover {
    transform: translateY(-2px);
}

.result-item label {
    font-size: 0.75rem;
    color: #444;
    margin-bottom: 0.2rem;
    font-weight: 600;
}

.result-item .result-value {
    font-size: 1.1em;
    font-weight: 700;
    color: #0c1c3f;
}

/* Estilo específico para o saldo final em negrito */
#finalBalanceContainer {
    background-color: #e6f0ff;
    color: #0c1c3f;
}

#finalBalanceContainer label,
#finalBalanceContainer .result-value {
    color: #0c1c3f;
}

/* Estilo para o quadro de benefício selecionado */
#selectedBenefitContainer {
    background-color: #e6f0ff;
    color: #0c1c3f;
}

#selectedBenefitContainer label,
#selectedBenefitContainer .result-value {
    color: #0c1c3f;
}

/* Estilos para o seletor de tipo de benefício */
.benefit-type-selector {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.benefit-type-selector input[type="radio"] {
    display: none;
}

.benefit-type-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.benefit-type-option:hover {
    border-color: #ff8c00;
    background-color: #fff8f0;
}

.benefit-type-selector input[type="radio"]:checked+.benefit-type-option {
    border-color: #ff8c00;
    background-color: #ff8c00;
    color: #ffffff;
}

.benefit-type-text {
    font-size: 0.75rem;
    font-weight: 600;
}

/* Selector de parcelas anuais (estilo similar ao tipo de renda) */
.installment-type-selector {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
}

.installment-type-selector input[type="radio"] {
    display: none;
}

.installment-type-option {
    flex: 1;
    display: flex;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 38px;
    padding: 0.45rem 0.35rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.installment-type-option:hover {
    border-color: #ff8c00;
    background-color: #fff8f0;
}

.installment-type-selector input[type="radio"]:checked+.installment-type-option {
    border-color: #ff8c00;
    background-color: #ff8c00;
    color: #ffffff;
}

.installment-type-text {
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.15;
}

/* Estilos para o seletor de sexo */
.gender-selector {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.15rem;
    min-width: 0;
}

.gender-selector input[type="radio"] {
    display: none;
}

.gender-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.2rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: visible;
    min-width: 50px;
    width: auto;
}

.gender-option:hover {
    border-color: #ff8c00;
    background-color: #fff8f0;
}

.gender-selector input[type="radio"]:checked+.gender-option {
    border-color: #ff8c00;
    background-color: #ff8c00;
    color: #ffffff;
}

/* Container para o input e botão de expectativa de vida */
.term-input-container {
    display: flex;
    align-items: stretch;
    gap: 0.3rem;
    margin-top: 0.2rem;
}

.term-input-container .input-unit-group {
    flex: 1;
    margin-top: 0;
}

.term-input-container .life-expectancy-button {
    flex: 0 0 auto;
    width: 4.5rem;
    height: auto;
}

/* Estilo para o botão de expectativa de vida */
.life-expectancy-button {
    width: 100%;
    height: 100%;
    padding: 0.3rem 0.5rem;
    background-color: #ffffff;
    color: #ff8c00;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    white-space: nowrap;
    box-sizing: border-box;
}

.life-expectancy-button:hover {
    border-color: #ff8c00;
    background-color: #fff8f0;
}

.life-expectancy-button:active,
.life-expectancy-button.clicked {
    border-color: #ff8c00;
    background-color: #ff8c00;
    color: #ffffff;
}

/* Estilos para fluxo esmaecido */
.benefit-flow-item.faded {
    opacity: 0.4;
}

.benefit-flow-item.faded .benefit-flow-value {
    color: #999;
    font-weight: 500;
}

.benefit-flow-item.faded .benefit-flow-label {
    color: #aaa;
}

/* NOVO ESTILO PARA O FLUXO DE PAGAMENTOS */
.benefit-flow-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 1rem;
    padding: 0 0.5rem;
    max-height: 30vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.benefit-flow-container > .benefit-flow-row {
    position: sticky;
    top: 0;
    z-index: 2;
}

.benefit-flow-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
    border-radius: 8px;
    padding: 0.4rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

#benefitFlowBody .benefit-flow-row:nth-child(odd) {
    background-color: #e9ecef;
}

.benefit-flow-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
    text-align: center;
}

.benefit-flow-item:first-child {
    align-items: flex-start;
    flex: 0.5;
    font-weight: 600;
}

.benefit-flow-item:last-child {
    align-items: flex-end;
}

.benefit-flow-label {
    font-size: 0.7rem;
    color: #777;
    margin-bottom: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.benefit-flow-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0c1c3f;
    white-space: nowrap;
}

/* NOVO ESTILO PARA O BOTÃO QUE EXPANDE O FLUXO */
#show-all-button {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 1.5rem;
    padding: 0;
    margin: 0.5rem 0;
    background-color: transparent;
    border: 1px dashed #b3cbe6;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

#show-all-button:hover {
    background-color: #f0f4f8;
}

#show-graphs-button {
    width: 100%;
    padding: 0.75rem;
    margin-top: 0.5rem;
    background-color: #0c1c3f;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#show-graphs-button:hover {
    background-color: #1a3465;
}

/* Classe para esconder elementos */
.hidden {
    display: none;
}

/* Tabela de fluxo mensal */
.monthly-flow-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.monthly-flow-table th,
.monthly-flow-table td {
    padding: 0.6rem;
    text-align: center;
    border-bottom: 1px solid #eee;
    font-size: 0.7rem;
}

.monthly-flow-table th {
    background-color: #e6f0ff;
    color: #0c1c3f;
    font-weight: 700;
    position: sticky;
    top: 0;
    text-transform: uppercase;
}

.monthly-flow-table tbody tr:hover {
    background-color: #f7f9fc;
}

.monthly-flow-table tbody tr:last-child td {
    border-bottom: none;
}

.table-scroll-container {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 0.5rem;
    padding-right: 0.5rem;
}

/* Estilos para os novos paineis de BI modernos */
.bi-panels-area {
    flex: 1 1 100%;
    padding: 0.6rem;
    background-color: #fafbfd;
    border-radius: 10px;
    margin-top: 0.5rem;
}

.bi-panels-area h3 {
    font-size: 1rem;
    color: #0c1c3f;
    margin-bottom: 0.4rem;
    border-bottom: 2px solid #ff8c00;
    padding-bottom: 0.3rem;
}

.bi-panels-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

/* Cards de indicadores modernos */
.bi-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 140, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.bi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
}

.bi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff8c00, #ff6b35);
}

.bi-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.bi-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    font-size: 1.2rem;
    color: white;
}

.bi-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    margin: 0;
}

.bi-card-subtitle {
    font-size: 0.75rem;
    color: #888;
    margin: 0;
}

/* Medidor circular */
.gauge-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
}

.gauge {
    width: 120px;
    height: 120px;
    position: relative;
}

.gauge-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #ff8c00 0deg, #ff8c00 var(--progress, 0deg), #e9ecef var(--progress, 0deg), #e9ecef 360deg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 8px;
}

.gauge-circle::before {
    content: '';
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    background: white;
    border-radius: 50%;
    position: absolute;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.gauge-value {
    position: relative;
    z-index: 1;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0c1c3f;
}

/* Barra de progresso moderna */
.progress-container {
    margin: 1rem 0;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: #666;
}

.progress-bar {
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff8c00, #ff6b35);
    border-radius: 6px;
    transition: width 0.8s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Gráfico de pizza simples */
.pie-chart-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
}

.pie-chart {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: conic-gradient(#ff8c00 0deg var(--contributions, 0deg),
            #28a745 var(--contributions, 0deg) var(--earnings, 0deg),
            #6c757d var(--earnings, 0deg) 360deg);
    position: relative;
}

.pie-chart::before {
    content: '';
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.pie-legend {
    margin-left: 1rem;
    font-size: 0.75rem;
}

.pie-legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
}

.pie-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 0.5rem;
}

/* Cards de comparação */
.comparison-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.comparison-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
}

.comparison-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
    position: relative;
    z-index: 1;
}

.comparison-label {
    font-size: 0.8rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* Indicadores de status */
.status-indicator {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
    cursor: help;
    position: relative;
}

.status-excellent {
    background: #d4edda;
    color: #155724;
}

.status-good {
    background: #d1ecf1;
    color: #0c5460;
}

.status-warning {
    background: #fff3cd;
    color: #856404;
}

.status-danger {
    background: #f8d7da;
    color: #721c24;
}

/* Tooltip explicativo */
.status-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
    margin-bottom: 0.5rem;
    max-width: 250px;
    white-space: normal;
    text-align: center;
}

.status-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

.status-indicator:hover .status-tooltip {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 768px) {
    body {
        height: auto;
        overflow: auto;
        padding: 1rem;
    }

    .main-container {
        height: auto;
        padding: 1rem;
    }

    .simulator-flex-layout {
        flex-direction: column;
        overflow-y: visible;
        padding-right: 0;
    }

    .form-group-paired {
        flex-direction: column;
    }

    #percentualGroupContainer {
        grid-template-columns: 1fr;
    }

    .form-group-triple {
        flex-direction: column;
    }

    .chart-flex-container {
        flex-direction: column;
    }

    .chart-container {
        max-height: 250px;
    }
}

/* Melhorias para Sliders em Dispositivos Móveis - SEM ALTERAR LAYOUT */
@media (max-width: 768px) {

    /* Apenas melhorias de usabilidade, mantendo o design original */
    .form-group input[type="range"] {
        -webkit-tap-highlight-color: transparent;
        touch-action: pan-y;
    }

    .form-group input[type="range"]:active {
        touch-action: none;
    }

    /* Tooltip para sliders mobile */
    .slider-tooltip {
        position: fixed;
        background: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 8px 12px;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 600;
        z-index: 10000;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.2s ease;
        transform: translateY(-100%);
        white-space: nowrap;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    /* Reorganizar cenários de rentabilidade no mobile */
    .bi-card div[style*="grid-template-columns: 1fr 1fr 1fr"] {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: 1fr 1fr !important;
        gap: 0.5rem !important;
    }

    /* Posicionar cenários específicos */
    .bi-card div[style*="grid-template-columns: 1fr 1fr 1fr"]>div:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }

    .bi-card div[style*="grid-template-columns: 1fr 1fr 1fr"]>div:nth-child(2) {
        grid-column: 1 / 3;
        grid-row: 2;
    }

    .bi-card div[style*="grid-template-columns: 1fr 1fr 1fr"]>div:nth-child(3) {
        grid-column: 2;
        grid-row: 1;
    }
}

/* ========================================
   ADMIN PANEL - NOVO LAYOUT
   ======================================== */

/* Container principal do admin */
.admin-page {
    min-height: 100vh;
    background-color: #f0f4f8;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.admin-container {
    background: radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.04), transparent 25%), radial-gradient(circle at 90% 10%, rgba(99, 102, 241, 0.05), transparent 22%), #ffffff;
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    border: 1px solid #e5e7eb;
}

/* Header do admin */
.admin-header {
    background: white;
    border-bottom: 2px solid #e5e7eb;
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-radius: 15px 15px 0 0;
}

.admin-header-content {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.admin-title {
    font-size: 1rem;
    font-weight: 600;
    color: #0c1c3f;
    margin: 0;
    text-align: center;
}

/* Barra de ações */
.admin-actions {
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.04), rgba(59, 130, 246, 0.05));
    padding: 12px 20px;
    margin: 0;
    border-bottom: 1px solid #e5e7eb;
}

.admin-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.admin-actions-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.preset-helper {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0;
}

.admin-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.admin-select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #0f172a;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.admin-select:hover {
    border-color: #94a3b8;
    box-shadow: 0 8px 22px rgba(59, 130, 246, 0.18);
}

.admin-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.admin-btn {
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.admin-btn-secondary {
    color: #0f172a;
    background: #eef2f7;
    border-color: #d6d9df;
}

.admin-btn-secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.admin-btn-primary {
    color: white;
    background: linear-gradient(120deg, #3b82f6, #6366f1);
    border-color: #3b82f6;
}

.admin-btn-primary:hover {
    background: linear-gradient(120deg, #2563eb, #4f46e5);
}

.admin-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Grid de configurações */
.config-section {
    background: transparent;
    margin-bottom: 20px;
    padding: 0 20px;
}

.config-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
    letter-spacing: -0.01em;
}

.config-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
    gap: 12px !important;
    width: 100%;
    min-width: 0;
}

.config-grid>* {
    min-width: 0;
    /* Garante que os cards possam encolher */
    max-width: 100%;
    /* Não ultrapassa o grid */
}

/* Card de campo individual */
.field-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px !important;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    transition: all 0.2s ease;
    box-sizing: border-box !important;
    overflow: hidden !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}

.field-card:hover {
    border-color: #94a3b8;
    background: #ffffff;
    box-shadow: 0 14px 26px rgba(59, 130, 246, 0.12);
}

/* Removido: não esmaecer campos na tela de admin */

/* Badge de status para campos sempre fixos */
.field-status-badge {
    background: #FEF3C7;
    color: #92400E;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Header do card */
.field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.field-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.field-toggles {
    display: inline-flex;
    gap: 8px;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
}

.field-visible-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.field-visible-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3b82f6;
}

.field-visible-label {
    font-size: 0.78rem;
    color: #0f172a;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
}

/* Inputs do card */
.field-inputs {
    display: flex;
    flex-direction: column;
    gap: 6px !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

.field-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    /* Permite que o input encolha */
    max-width: 100%;
    /* Não ultrapassa o container */
    box-sizing: border-box;
}

.field-input-label {
    font-size: 0.68rem;
    color: #475569;
    font-weight: 600;
    margin-bottom: 2px;
}

.field-input {
    padding: 6px 8px !important;
    border: 1px solid #d6d9df;
    border-radius: 8px;
    font-size: 0.78rem !important;
    color: #0f172a;
    transition: all 0.2s ease;
    background: #fff;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

.field-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.field-input:disabled {
    background: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
}

.field-input::placeholder {
    color: #9ca3af;
}

/* Grid de Min/Max */
.field-minmax-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 3px !important;
    /* Reduzido ao mínimo */
    min-width: 0 !important;
    /* Permite encolher */
    max-width: 100% !important;
    /* Não ultrapassa */
    box-sizing: border-box !important;
    width: 100% !important;
}

/* Mensagens de feedback */
.admin-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.875rem;
    font-weight: 500;
}

.admin-message-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.admin-message-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Loading state */
.admin-loading {
    text-align: center;
    padding: 48px 24px;
}

.admin-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

.admin-loading-text {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Responsividade */
@media (max-width: 1024px) {
    .config-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .config-grid {
        grid-template-columns: 1fr;
    }

    .admin-actions-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .admin-buttons {
        flex-direction: column;
        width: 100%;
    }

    .admin-btn {
        width: 100%;
        justify-content: center;
    }

    .admin-title {
        font-size: 1.125rem;
    }

    .config-section {
        padding: 16px;
    }
}

.input-unit-with-hint {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-top: 0.2rem;
}

.input-unit-with-hint .input-unit-group {
    margin-top: 0;
}

.contrib-absolute {
    font-size: 0.75rem;
    color: #ff8c00;
    font-weight: bold;
    white-space: nowrap;
}

/* ===== Logotipo no header (logo à esquerda, acima do título) ===== */
.page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
}

.brand-logo {
    height: 130px;
    width: auto;
    object-fit: contain;
    align-self: center;
    margin: -18px 0 -12px;
}

.page-header h1 {
    margin-top: 0;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .brand-logo {
        height: 96px;
        margin: -12px 0 -8px;
    }
}

/* ===== Rodapé (disclaimer + bloco cinza estilo cca-site) ===== */
.app-footer {
    flex-shrink: 0;
    margin: 0.5rem -0.85rem -0.85rem;
    text-align: center;
}

.app-disclaimer {
    background: #fff8e1;
    color: #92400e;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    padding: 0.45rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0.85rem 0.4rem;
}

.app-footer-info {
    background-color: #E6E6E6;
    color: #7A7A7A;
    box-shadow: inset 0 15px 20px -15px rgba(0, 0, 0, 0.3);
    padding: 0.6rem 0.85rem 0.5rem;
    border-radius: 0 0 15px 15px;
    font-family: "Trebuchet MS", Helvetica, sans-serif;
}

.app-footer-contacts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem 1.2rem;
    font-size: 0.78rem;
    margin-bottom: 0.25rem;
}

.app-footer-contacts a {
    color: #7A7A7A;
    text-decoration: none;
}

.app-footer-contacts a:hover {
    text-decoration: underline;
}

.app-footer-copyright {
    font-size: 0.72rem;
    color: #7A7A7A;
    line-height: 1.3;
}

@media (max-width: 768px) {
    .app-disclaimer {
        position: sticky;
        bottom: 0;
        z-index: 10;
        font-size: 0.7rem;
        padding: 0.4rem 0.55rem;
        box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.08);
    }

    .app-footer-contacts {
        flex-direction: column;
        gap: 0.1rem;
        font-size: 0.72rem;
    }
}