/* ==========================================================================
   SISTEMA DE DESIGN & VARIÁVEIS CSS
   ========================================================================== */
:root {
    --primary-color: #1e3a8a;      /* Azul escuro corporativo */
    --primary-hover: #172554;
    --primary-light: #eff6ff;
    --accent-color: #f59e0b;       /* Laranja/Ouro solar */
    --accent-hover: #d97706;
    --bg-color: #f8fafc;           /* Cinza azulado bem claro */
    --card-bg: #ffffff;
    --border-color: #e2e8f0;       /* Cinza claro para bordas */
    --text-main: #0f172a;          /* Slate escuro para textos */
    --text-muted: #64748b;         /* Slate médio para legendas */
    --success-color: #10b981;      /* Verde sucesso */
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;
    --danger-color: #ef4444;       /* Vermelho perigo */
    --danger-hover: #dc2626;
    --danger-bg: #fef2f2;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ==========================================================================
   RESET & ESTILOS GERAIS
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding: 2rem 1.5rem;
}

.app-container {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ==========================================================================
   COMPONENTES DE CARTÕES (GLASSMORPHISM SUAVE)
   ========================================================================== */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* ==========================================================================
   TOAST DE NOTIFICAÇÃO
   ========================================================================== */
.toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(0);
    opacity: 1;
}

.toast.hidden {
    display: none !important;
    opacity: 0;
    transform: translateY(-20px);
}

.toast-success {
    background-color: var(--success-color);
}

.toast-danger {
    background-color: var(--danger-color);
}

/* ==========================================================================
   CABEÇALHO DO RELATÓRIO
   ========================================================================== */
.report-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.report-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background-color: var(--primary-color);
}

.header-logo-container {
    flex-shrink: 0;
}

.logo-box {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 150px;
    min-height: 80px;
    background-color: var(--bg-color);
    transition: all 0.2s ease;
}

.logo-box:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
}

.logo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.solar-logo-svg {
    width: 48px;
    height: 48px;
    animation: rotate-sun 20s linear infinite;
}

@keyframes rotate-sun {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.logo-text {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: 1px;
}

.custom-logo-img {
    max-width: 150px;
    max-height: 80px;
    object-fit: contain;
}

.logo-hover-badge {
    position: absolute;
    bottom: 2px;
    font-size: 0.65rem;
    color: var(--primary-color);
    font-weight: 600;
    opacity: 0;
    transform: translateY(2px);
    transition: all 0.2s ease;
}

.logo-box:hover .logo-hover-badge {
    opacity: 1;
    transform: translateY(0);
}

.header-title-container {
    flex-grow: 1;
    text-align: center;
}

.header-title-container h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1.2;
    margin-bottom: 0.25rem;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.header-title-container h1:hover {
    background-color: var(--primary-light);
    border-bottom-color: var(--primary-color);
    outline: none;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ==========================================================================
   SEÇÃO DE UPLOAD E CONTROLES (NO-PRINT)
   ========================================================================== */
.section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    color: var(--primary-color);
}

.section-title i {
    font-size: 1.25rem;
}

.section-title h2 {
    font-size: 1.15rem;
    font-weight: 700;
}

.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .upload-grid {
        grid-template-columns: 1fr;
    }
}

.dropzone {
    border: 2px dashed var(--primary-color);
    border-radius: var(--radius-md);
    background-color: var(--primary-light);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropzone:hover, .dropzone.dragover {
    background-color: #dbeafe;
    transform: scale(1.01);
}

.drop-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.drop-text {
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.file-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.upload-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.upload-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.quick-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* ==========================================================================
   METADADOS DO PROJETO
   ========================================================================== */
.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.meta-field {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.meta-field label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 130px;
}

.meta-field input {
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    background-color: transparent;
    width: 100%;
    transition: all 0.2s ease;
}

.meta-field input:hover {
    background-color: var(--bg-color);
    border-color: var(--border-color);
}

.meta-field input:focus {
    outline: none;
    background-color: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* ==========================================================================
   TABELA DE COTAÇÃO - DESIGN PREMIUM
   ========================================================================== */
.table-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.supplier-configs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.config-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.supplier-name-input {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    background-color: var(--bg-color);
    max-width: 120px;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.supplier-name-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #ffffff;
}

.table-buttons {
    display: flex;
    gap: 0.5rem;
}

.responsive-table-wrapper {
    overflow-x: auto;
    margin: 0 -1.5rem;
    padding: 0 1.5rem;
}

.quotation-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.quotation-table th, .quotation-table td {
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border-color);
    vertical-align: middle;
}

.quotation-table th {
    font-weight: 700;
    text-align: center;
}

/* Larguras ajustadas para evitar que valores cortem */
.col-desc { min-width: 250px; text-align: left !important; }
.col-qty { width: 70px; text-align: center; }
.col-supplier-header { text-transform: uppercase; font-size: 0.85rem; }
.col-price-unit { width: 125px; min-width: 125px; } /* Largura suficiente para inputs e R$ */
.col-price-total { width: 130px; min-width: 130px; }
.col-lowest { width: 130px; min-width: 130px; font-weight: 700; }
.col-winner { width: 140px; min-width: 140px; font-weight: 700; text-align: center; }
.col-actions { width: 60px; text-align: center; }

/* Cores de Cabeçalhos de Fornecedores */
.supplier-1-header-bg { background-color: #eff6ff; color: #1e40af; border-bottom: 2px solid #3b82f6 !important; }
.supplier-2-header-bg { background-color: #fef3c7; color: #92400e; border-bottom: 2px solid #f59e0b !important; }
.supplier-3-header-bg { background-color: #f0fdf4; color: #166534; border-bottom: 2px solid #10b981 !important; }

.subheader-row th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background-color: var(--bg-color);
}

/* Categorias */
.category-row {
    background-color: var(--primary-light);
}

.category-title {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--primary-color);
    letter-spacing: 0.5px;
}

/* Itens da Tabela */
.item-row:nth-child(even) {
    background-color: #f8fafc;
}

.item-row:hover {
    background-color: #f1f5f9;
}

.cell-qty {
    text-align: center;
}

.cell-price-input {
    width: 100%;
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    padding: 0.4rem 0.5rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: right;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.cell-price-input:hover {
    background-color: var(--bg-color);
}

.cell-price-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.cell-total-price, .cell-lowest-price {
    text-align: right;
    font-weight: 600;
}

.cell-winner-name {
    text-align: center;
    font-weight: 700;
}

/* Linha de Totais da Categoria */
.category-total-row {
    background-color: #f1f5f9;
    font-weight: 700;
}

.category-total-label {
    text-align: left;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.category-total-val {
    text-align: right;
    font-weight: 700;
}

/* Linha de Total Geral do Kit */
.grand-total-row {
    background-color: #e2e8f0;
    font-weight: 800;
    font-size: 0.9rem;
}

.grand-total-label {
    text-align: left;
    font-weight: 800;
    color: var(--primary-color);
}

/* Destaque Condicional (Vencedor) */
.winner-highlight {
    background-color: var(--success-bg) !important;
    color: var(--success-color) !important;
    font-weight: 700;
}

.winner-cell-highlight {
    background-color: var(--success-bg) !important;
    border: 1px solid var(--success-border) !important;
    color: #065f46 !important;
}

/* Botão de Exclusão de Linha */
.btn-delete-row {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.btn-delete-row:hover {
    background-color: var(--danger-bg);
    color: var(--danger-hover);
}

.row-actions-container {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
}

/* ==========================================================================
   PAINEL DE ANÁLISE E ECONOMIA
   ========================================================================== */
.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
}

.analysis-card {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: relative;
    overflow: hidden;
}

.card-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
}

.card-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Destaques do Painel */
.kpi-winner {
    background-color: var(--primary-light);
    border-color: #bfdbfe;
}
.kpi-winner .card-value {
    color: var(--primary-color);
}

.kpi-savings {
    background-color: var(--success-bg);
    border-color: var(--success-border);
}
.kpi-savings .card-value {
    color: var(--success-color);
}

.kpi-final {
    background-color: #faf5ff;
    border-color: #e9d5ff;
}
.kpi-final .card-value {
    color: #6b21a8;
}

/* Frete Customizado */
.edit-card {
    background-color: #ffffff;
    border-color: var(--border-color);
}

.input-currency-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    background-color: var(--bg-color);
    width: 100%;
}

.currency-prefix {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-right: 0.25rem;
}

.freight-input {
    border: none;
    background: transparent;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    width: 100%;
    text-align: right;
}

.freight-input:focus {
    outline: none;
}

/* ==========================================================================
   SEÇÃO DO HISTÓRICO DE COTAÇÕES
   ========================================================================== */
.history-table {
    width: 100%;
    margin-top: 1rem;
}

.history-table th, .history-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.history-table tr:hover {
    background-color: var(--bg-color);
}

.btn-history-load {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border: 1px solid #bfdbfe;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-right: 0.25rem;
    transition: all 0.2s ease;
}

.btn-history-load:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-history-delete {
    background-color: var(--danger-bg);
    color: var(--danger-color);
    border: 1px solid var(--success-border);
    border-color: #fecaca;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-history-delete:hover {
    background-color: var(--danger-color);
    color: white;
}

/* ==========================================================================
   BOTÕES E ELEMENTOS DE UI
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
}

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

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: var(--bg-color);
    border-color: var(--text-muted);
}

.btn-danger {
    background-color: var(--danger-color);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

/* Botão Flutuante (PDF) */
.floating-actions {
    display: flex;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
}

.btn-floating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--success-color);
    color: #ffffff;
    border: none;
    border-radius: 50px;
    padding: 0.9rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-floating:hover {
    background-color: #059669;
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.15);
}

/* ==========================================================================
   MODAIS E INTERFACES DE DIÁLOGO
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    transition: all 0.3s ease;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    animation: modal-enter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-enter {
    from { transform: scale(0.9) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.modal-header h3 {
    font-size: 1.15rem;
    color: var(--primary-color);
    font-weight: 700;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--text-muted);
}

.btn-close:hover {
    color: var(--text-main);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.75rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

/* ==========================================================================
   RODAPÉ DO RELATÓRIO
   ========================================================================== */
footer.report-footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

/* ==========================================================================
   UTILITÁRIOS
   ========================================================================== */
.hidden { display: none !important; }
.font-numeric { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   ESTILOS ESPECIAIS DE IMPRESSÃO (@MEDIA PRINT) - OTIMIZADO PARA 1 PÁGINA A4
   ========================================================================== */
@media print {
    @page {
        size: A4 landscape;
        margin: 4mm 5mm; /* Margens extremamente finas */
    }

    body {
        background-color: #ffffff;
        color: #000000;
        padding: 0;
        margin: 0;
        font-size: 7.2pt; /* Letra reduzida para caber tudo na folha */
        zoom: 70%;       /* Redução de escala geral da viewport na impressão */
    }

    .app-container {
        gap: 3mm;
        max-width: 100%;
        height: auto;
        overflow: hidden;
    }

    .card {
        border: 1px solid #94a3b8;
        box-shadow: none;
        padding: 3mm;
        border-radius: 4px;
        margin-bottom: 0;
    }

    /* Ocultar elementos interativos na impressão */
    .no-print, 
    .btn-delete-row,
    .btn-add-category-row,
    .row-actions-container,
    .floating-actions,
    .upload-section,
    .history-section,
    .table-actions,
    th.col-actions,
    td.col-actions {
        display: none !important;
    }

    /* Ajustes específicos das colunas da tabela para a versão impressa */
    .quotation-table {
        font-size: 7.2pt;
        width: 100%;
        table-layout: auto;
    }

    .quotation-table th, .quotation-table td {
        padding: 1mm 1.5mm !important; /* Espaçamento extremamente compacto */
        border: 0.5pt solid #475569 !important;
    }

    /* Ajustar campos do cabeçalho */
    .meta-field {
        border-bottom: 0.5pt solid #cbd5e1;
        padding-bottom: 0.2rem;
    }

    .meta-field input {
        border: none;
        background-color: transparent;
        padding: 0;
        font-weight: bold;
        font-size: 7.5pt;
    }

    /* Configurar inputs de preço como células de texto plano (sem caixa de input de formulário) */
    .cell-price-input {
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
        font-weight: 600;
        text-align: right;
        font-size: 7.2pt;
        box-shadow: none !important;
    }

    /* Forçar fundos de cores de cabeçalhos e totais no PDF gerado */
    .quotation-table th,
    .category-row,
    .category-total-row,
    .grand-total-row,
    .winner-cell-highlight,
    .winner-highlight,
    .analysis-card,
    .report-header {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .report-header {
        border: 1px solid #475569;
        padding: 3mm 4mm;
        border-radius: 4px;
    }

    .report-header::before {
        display: none;
    }

    .logo-box {
        border: none;
        padding: 0;
        background: transparent;
        min-height: auto;
        min-width: auto;
    }

    .solar-logo-svg {
        width: 32px;
        height: 32px;
    }

    .category-row {
        background-color: #cbd5e1 !important;
    }

    .category-total-row {
        background-color: #f1f5f9 !important;
    }

    .grand-total-row {
        background-color: #cbd5e1 !important;
    }

    .winner-cell-highlight {
        background-color: #d1fae5 !important;
        color: #065f46 !important;
    }

    /* Impedir quebras de páginas no meio dos componentes */
    tr, .analysis-section, .report-header, footer {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .analysis-grid {
        grid-template-columns: repeat(6, 1fr) !important; /* Coloca os cards lado a lado na horizontal */
        gap: 2mm !important;
    }

    .analysis-card {
        padding: 1.5mm 2mm !important;
        border: 0.5pt solid #475569 !important;
        border-radius: 4px;
    }

    .analysis-card .card-value {
        font-size: 1.15rem !important;
    }

    .input-currency-wrapper {
        border: none !important;
        padding: 0 !important;
        background: transparent !important;
    }

    .freight-input {
        font-size: 1.15rem !important;
    }

    footer.report-footer {
        padding: 0.5rem;
        margin-top: 1rem;
    }
}

/* ==========================================================================
   ESTILOS DO MODO DE PREVIEW DE IMPRESSÃO (TELA)
   ========================================================================== */
body.print-preview-active {
    background-color: #525659 !important;
    overflow-y: auto !important;
    padding: 0 !important;
}

body.print-preview-active .app-container {
    display: block !important;
    width: 297mm !important;
    max-width: 297mm !important;
    min-height: 210mm !important;
    background: #ffffff !important;
    margin: 60px auto 40px auto !important;
    padding: 4mm 5mm !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5) !important;
    border-radius: 4px !important;
    position: relative !important;
    box-sizing: border-box !important;
    transform-origin: top center;
}

body.print-preview-active .upload-section,
body.print-preview-active .history-section,
body.print-preview-active .floating-actions,
body.print-preview-active .no-print, 
body.print-preview-active .btn-delete-row,
body.print-preview-active .btn-add-category-row,
body.print-preview-active .row-actions-container,
body.print-preview-active th.col-actions,
body.print-preview-active td.col-actions {
    display: none !important;
}

body.print-preview-active .freight-input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    pointer-events: none;
    padding: 0 !important;
}

body.print-preview-active .input-currency-wrapper {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

.preview-control-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #323639;
    color: white;
    padding: 10px 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 999999;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    font-family: inherit;
}

body.print-preview-active .preview-control-bar {
    display: flex;
}

.preview-control-bar .btn {
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.preview-control-bar .btn-success {
    background-color: var(--success-color);
    color: white;
}

.preview-control-bar .btn-success:hover {
    background-color: #047857;
}

.preview-control-bar .btn-outline {
    background-color: transparent;
    color: white;
    border-color: rgba(255,255,255,0.4);
}

.preview-control-bar .btn-outline:hover {
    background-color: rgba(255,255,255,0.1);
    border-color: white;
}
