/* ==========================================================================
   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;
}

/* ==========================================================================
   TELA DE LOGIN COM SENHA
   ========================================================================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    min-height: -webkit-fill-available;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #172554 100%);
    background-size: 400% 400%;
    animation: loginBgShift 8s ease infinite;
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}
.login-overlay.hidden { display: none; }

@keyframes loginBgShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.login-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 2rem 1.5rem;
    width: calc(100% - 1rem);
    max-width: 380px;
    margin: auto !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    box-sizing: border-box;
    animation: loginCardEntry 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes loginCardEntry {
    from { transform: scale(0.88) translateY(24px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

.login-logo {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: rgba(245, 158, 11, 0.15);
    border: 2px solid rgba(245, 158, 11, 0.4);
    border-radius: 50%;
    padding: 0.5rem;
    box-shadow: 0 0 24px rgba(245, 158, 11, 0.25);
}

.login-logo svg, .login-logo img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.login-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #ffffff;
    text-align: center;
    margin-top: 0.25rem;
    letter-spacing: -0.5px;
}

.login-subtitle {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.55);
    text-align: center;
    margin-bottom: 0.75rem;
}

.login-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.login-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.login-input-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.login-input-group input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    outline: none;
}

.login-input-group input::placeholder { color: rgba(255,255,255,0.35); }

.login-input-group input:focus {
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.login-password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.login-password-wrapper input {
    padding-right: 2.8rem;
}

.btn-toggle-pass {
    position: absolute;
    right: 0.7rem;
    background: none;
    border: none;
    color: rgba(255,255,255,0.45);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0.25rem;
    transition: color 0.2s;
}
.btn-toggle-pass:hover { color: rgba(255,255,255,0.85); }

.login-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60%  { transform: translateX(-6px); }
    40%, 80%  { transform: translateX(6px); }
}

.btn-login {
    width: 100%;
    padding: 0.8rem 1rem;
    margin-top: 0.25rem;
    background: linear-gradient(135deg, var(--accent-color), #d97706);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
}
.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.45);
}
.btn-login:active { transform: translateY(0); }

.login-footer-note {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.3);
    text-align: center;
    margin-top: 0.75rem;
}

.login-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

.login-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.2s;
}

.login-links a:hover {
    color: var(--accent-color);
}

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

html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

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: 2.1fr 1.6fr 1.6fr;
    gap: 1rem;
}

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

.meta-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background-color: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.meta-field:hover {
    border-color: #93c5fd;
    background-color: #f1f5f9;
}

.meta-field label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e3a8a;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.meta-field input {
    border: 2px solid #93c5fd !important;
    border-radius: 8px !important;
    padding: 0.6rem 0.85rem !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    color: #1e3a8a !important;
    background-color: #ffffff !important;
    width: 100% !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04) !important;
}

.meta-field input:hover {
    border-color: #3b82f6 !important;
}

.meta-field input:focus {
    outline: none !important;
    background-color: #ffffff !important;
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25) !important;
}

/* ==========================================================================
   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.5rem 0.85rem;
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
    min-width: 180px;
    width: 200px;
    max-width: 260px;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

#supplier1Name {
    background-color: #dcfce7 !important;
    color: #15803d !important;
    border: 1.5px solid #86efac !important;
}
#supplier1Name:focus {
    outline: none;
    border-color: #22c55e !important;
    background-color: #f0fdf4 !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2) !important;
}

#supplier2Name {
    background-color: #dbeafe !important;
    color: #1d4ed8 !important;
    border: 1.5px solid #93c5fd !important;
}
#supplier2Name:focus {
    outline: none;
    border-color: #3b82f6 !important;
    background-color: #eff6ff !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
}

#supplier3Name {
    background-color: #fef9c3 !important;
    color: #a16207 !important;
    border: 1.5px solid #fde047 !important;
}
#supplier3Name:focus {
    outline: none;
    border-color: #eab308 !important;
    background-color: #fefce8 !important;
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.2) !important;
}

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

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

.history-table-wrapper {
    overflow-x: auto;
    width: 100%;
    margin-top: 1rem;
    -webkit-overflow-scrolling: touch;
}

.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: 135px; min-width: 135px; } /* Largura suficiente para inputs e R$ */
.col-price-total { width: 145px; min-width: 145px; }
.col-lowest { width: 145px; min-width: 145px; font-weight: 700; }
.col-winner { width: 150px; min-width: 150px; font-weight: 700; text-align: center; }
.col-actions { width: 60px; text-align: center; }

.global-price-input {
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    padding: 0.5rem 0.65rem !important;
    min-width: 150px;
    width: 100%;
    text-align: right;
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Painel de Propostas Globais por Fornecedor */
.global-cards-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.global-supplier-card {
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.25s ease;
}

.global-supplier-card.card-winner-highlight {
    border-color: #22c55e;
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.15);
}

.global-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 800;
    font-size: 0.9rem;
}

.badge-winner-tag {
    background-color: #22c55e;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-global-included {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background-color: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
}

/* 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);
}

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

.btn-edit-row:hover {
    background-color: var(--primary-light);
    color: var(--primary-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(200px, 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.25rem;
    font-weight: 800;
    color: var(--text-main);
    word-break: break-word;
}

.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);
}

.btn-success {
    background-color: var(--success-color);
    color: #ffffff;
    border-color: transparent;
}

.btn-success:hover {
    background-color: #059669;
}

/* 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; }

/* ==========================================================================
   OTIMIZAÇÃO E RESPONSIVIDADE MOBILE
   ========================================================================== */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.5rem;
    }

    .report-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1.25rem;
        padding: 1.5rem 1rem;
    }

    .report-header::before {
        width: 100%;
        height: 6px;
        top: 0;
        left: 0;
    }

    .logo-box {
        min-width: 130px;
        min-height: 70px;
        padding: 0.5rem;
    }

    .header-title-container h1 {
        font-size: 1.25rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

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

    .dropzone {
        padding: 1.5rem 1rem;
    }

    .metadata-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .meta-field {
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        padding: 0.75rem 1rem;
        background-color: #f8fafc;
        border: 1.5px solid #cbd5e1;
        border-radius: 10px;
    }

    .meta-field label {
        color: #1e3a8a;
        font-weight: 700;
        font-size: 0.9rem;
    }

    .meta-field input {
        max-width: 100%;
        width: 100%;
        text-align: left;
        border: 2px solid #93c5fd !important;
        background-color: #ffffff !important;
        border-radius: 8px !important;
        padding: 0.6rem 0.85rem !important;
        font-weight: 600 !important;
        font-size: 0.95rem !important;
        color: #1e3a8a !important;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05) !important;
    }

    .table-actions {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        width: 100%;
    }

    .supplier-configs {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0.6rem;
        align-items: center;
    }

    .supplier-name-input {
        max-width: 100% !important;
        width: 100% !important;
        min-width: 100% !important;
        padding: 0.65rem 1rem !important;
        font-size: 1rem !important;
        min-height: 46px;
        box-sizing: border-box !important;
        text-align: center;
        border-radius: var(--radius-sm);
    }

    .config-label {
        width: 100%;
        text-align: center;
        margin-bottom: 0.25rem;
        font-size: 0.9rem;
    }

    .table-buttons {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.6rem;
        width: 100%;
        margin: 0 auto;
    }

    .table-buttons button,
    .form-buttons button,
    #btnSaveQuotation,
    #btnAddNewRowGlobal,
    #btnSaveTextConfig {
        width: 100% !important;
        max-width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
        margin: 0 auto !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.95rem !important;
        box-sizing: border-box !important;
    }

    .global-cards-panel {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .card-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.5rem;
    }

    .floating-actions {
        bottom: 1rem;
        right: 1rem;
        gap: 0.5rem;
    }

    .btn-floating {
        padding: 0.8rem !important;
        border-radius: 50% !important;
        width: 48px;
        height: 48px;
        min-width: 48px;
        justify-content: center;
        margin-right: 0 !important;
    }

    .btn-floating span {
        display: none !important;
    }

    .btn-floating i {
        font-size: 1.2rem;
        margin: 0;
    }

    .login-overlay {
        padding: 0.75rem;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100vw;
        max-width: 100vw;
    }

    .login-card {
        padding: 1.5rem 1rem;
        width: calc(100% - 1rem);
        max-width: 340px;
        margin: auto !important;
        box-sizing: border-box;
    }

    .login-logo {
        width: 56px;
        height: 56px;
    }

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

    .login-title {
        font-size: 1.4rem;
    }

    .login-subtitle {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .analysis-grid {
        grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
        gap: 0.5rem;
    }

    .analysis-card {
        padding: 0.75rem 0.5rem;
    }

    .analysis-card .card-value {
        font-size: 1rem;
    }

    .modal-content {
        padding: 1.25rem;
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }

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

    .preview-control-bar {
        flex-direction: column !important;
        gap: 0.5rem !important;
        padding: 8px 12px !important;
    }
    
    .preview-control-bar > div {
        width: 100% !important;
        justify-content: center !important;
        gap: 8px !important;
    }
    
    .preview-control-bar span {
        display: none !important;
    }

    #zoomSlider {
        width: 80px !important;
    }
    
    .preview-control-bar .btn {
        padding: 0.35rem 0.6rem !important;
        font-size: 0.75rem !important;
    }
}

/* ==========================================================================
   ESTILOS ESPECIAIS DE IMPRESSÃO (@MEDIA PRINT) - OTIMIZADO PARA 1 PÁGINA A4
   ========================================================================== */
@media print {
    @page {
        size: A4 landscape;
        margin: 6mm 10mm 10mm 10mm; /* Margens para dar mais respiro nas laterais e rodapé */
        @top-left { content: ""; }
        @top-right { content: ""; }
        @bottom-left { content: ""; }
        @bottom-right {
            content: "Página " counter(page);
            font-size: 7.5pt;
            font-family: 'Inter', sans-serif;
            color: #475569;
        }
    }

    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, 
    .report-page-number,
    .preview-control-bar,
    .btn-delete-row,
    .btn-edit-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 */
    .metadata-grid {
        grid-template-columns: 2.1fr 1.6fr 1.6fr !important;
        gap: 0.5rem 1rem !important;
    }

    .meta-field {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.4rem !important;
        border: none !important;
        border-bottom: 0.5pt solid #cbd5e1 !important;
        padding: 0 0 0.2rem 0 !important;
        background: transparent !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    .meta-field label {
        min-width: max-content !important;
        white-space: nowrap !important;
        font-size: 8.5pt !important;
    }

    .meta-field input {
        border: none !important;
        background-color: transparent !important;
        padding: 0 !important;
        font-weight: bold !important;
        font-size: 8.5pt !important;
        width: 100% !important;
        box-shadow: none !important;
    }

    /* 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;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        text-align: left !important;
        gap: 1.5rem !important;
    }

    .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 1mm !important;
        border: 0.5pt solid #475569 !important;
        border-radius: 4px;
        overflow: hidden !important;
    }

    .analysis-card .card-value {
        font-size: 9pt !important;
    }

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

    .freight-input {
        font-size: 9pt !important;
    }

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

    /* Reset preview styles when printing */
    body.print-preview-active {
        background-color: #ffffff !important;
        padding: 0 !important;
    }
    
    body.print-preview-active .app-container {
        width: 100% !important;
        max-width: 100% !important;
        min-height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        transform: none !important;
        transform-origin: none !important;
    }
}

/* ==========================================================================
   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;
    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.print-landscape .app-container {
    width: 297mm !important;
    max-width: 297mm !important;
    min-height: 210mm !important;
}

body.print-preview-active.print-portrait .app-container {
    width: 210mm !important;
    max-width: 210mm !important;
    min-height: 297mm !important;
}

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-edit-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 {
    font-size: 7.2pt !important;
}

body.print-preview-active .report-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    text-align: left !important;
    gap: 1.5rem !important;
}

body.print-preview-active .metadata-grid {
    grid-template-columns: 2.1fr 1.6fr 1.6fr !important;
    gap: 0.5rem 1rem !important;
}

body.print-preview-active .meta-field {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.4rem !important;
    border: none !important;
    border-bottom: 0.5pt solid #cbd5e1 !important;
    padding: 0 0 0.2rem 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

body.print-preview-active .meta-field label {
    min-width: max-content !important;
    white-space: nowrap !important;
    font-size: 8.5pt !important;
}

body.print-preview-active .meta-field input {
    border: none !important;
    background-color: transparent !important;
    padding: 0 !important;
    font-weight: bold !important;
    font-size: 8.5pt !important;
    width: 100% !important;
    box-shadow: none !important;
}

/* Travar todas as edições no modo de visualização de impressão */
body.print-preview-active input,
body.print-preview-active select,
body.print-preview-active textarea,
body.print-preview-active [contenteditable],
body.print-preview-active .logo-box,
body.print-preview-active .logo-hover-badge,
body.print-preview-active .meta-field input,
body.print-preview-active #docTitle,
body.print-preview-active .supplier-name-input {
    pointer-events: none !important;
    user-select: none !important;
    cursor: default !important;
}

/* Manter a barra de controle superior de visualização totalmente interativa */
#previewControlBar,
#previewControlBar * {
    pointer-events: auto !important;
    user-select: auto !important;
}

body.print-preview-active .quotation-table {
    font-size: 7.2pt !important;
    width: 100% !important;
    table-layout: auto !important;
}

body.print-preview-active .quotation-table th, 
body.print-preview-active .quotation-table td {
    padding: 1mm 1.5mm !important;
    border: 0.5pt solid #475569 !important;
}

body.print-preview-active .cell-price-input {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    font-weight: 600 !important;
    text-align: right !important;
    font-size: 7.2pt !important;
    box-shadow: none !important;
    pointer-events: none !important;
}

body.print-preview-active .analysis-grid {
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 2mm !important;
}

body.print-preview-active .analysis-card {
    padding: 1.5mm 1mm !important;
    border: 0.5pt solid #475569 !important;
    border-radius: 4px !important;
    overflow: hidden !important;
}

body.print-preview-active .analysis-card .card-value {
    font-size: 9pt !important;
}

body.print-preview-active .freight-input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    pointer-events: none !important;
    padding: 0 !important;
    font-size: 9pt !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;
}

/* ============================================================ */
/* SISTEMA DE PERMISSÕES E ROLES DE SEGURANÇA */
/* ============================================================ */

/* Mapa de Cotação - Permissões */
body.no-perm-q-excluir .col-actions,
body.no-perm-q-excluir .btn-delete-row,
body.no-perm-q-excluir .row-actions-container,
body.no-perm-q-excluir .btn-history-delete {
    display: none !important;
}

body.no-perm-q-inserir .dropzone,
body.no-perm-q-inserir #btnAddNewRowGlobal,
body.no-perm-q-inserir .quick-actions,
body.no-perm-q-inserir .upload-section {
    display: none !important;
}

body.no-perm-q-imprimir #btnPrintPdf,
body.no-perm-q-imprimir #btnPreviewPrint {
    display: none !important;
}

body.no-perm-q-visualizar #btnTogglePreview {
    display: none !important;
}

body.no-perm-q-alterar .metadata-section input,
body.no-perm-q-alterar .supplier-configs input,
body.no-perm-q-alterar .item-price-input,
body.no-perm-q-alterar .freight-input {
    pointer-events: none !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    cursor: not-allowed;
}

body.no-perm-q-alterar [contenteditable="true"] {
    pointer-events: none !important;
}

body.no-perm-q-alterar #btnSaveQuotation,
body.no-perm-q-alterar #btnSaveQuotationFloating,
body.no-perm-q-alterar .btn-edit-row,
body.no-perm-q-alterar .logo-hover-badge {
    display: none !important;
}

/* Controle Financeiro - Permissões */
body.no-perm-f-ver .app-container {
    display: none !important;
}

body.no-perm-f-inserir #formSection {
    display: none !important;
}

body.no-perm-f-alterar .btn-edit,
body.no-perm-f-alterar .btn-pay,
body.no-perm-f-alterar .config-card,
body.no-perm-f-alterar #formSection {
    display: none !important;
}

body.no-perm-f-excluir .btn-delete {
    display: none !important;
}

body.no-perm-f-imprimir #btnPrintReport {
    display: none !important;
}

body.no-perm-f-visualizar .reports-card {
    display: none !important;
}

/* Painel de Permissões (Administrador) */
.permissions-section {
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.permissions-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    margin-top: 1rem;
}

.user-select-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.permissions-details {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.permissions-module h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.perms-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.perms-checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

.perms-checkbox-grid input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

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

/* SISTEMA DE ABAS - TABELA DE COTAÇÃO */
.tabs-container {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn i {
    font-size: 1rem;
}

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

.tab-btn.active {
    color: var(--primary-color);
    background: var(--primary-light);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px 3px 0 0;
}

/* ==========================================================================
   ESTILOS DE BOTÕES INTUITIVOS E OCULTAÇÃO DE MODELOS ANTIGOS
   ========================================================================== */

/* 4. Ocultar botões Restaurar Modelo e Exportar para segurança de dados */
#btnResetDatabase,
#btnExportData,
.excel-actions {
    display: none !important;
}

/* 6. Botão Limpar com destaque visual intuitivo (Slate) */
.btn-secondary, #btnClearForm, #btnClear {
    background-color: #64748b !important;
    color: #ffffff !important;
    border: none !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(100, 116, 139, 0.2);
}
.btn-secondary:hover, #btnClearForm:hover, #btnClear:hover {
    background-color: #475569 !important;
    color: #ffffff !important;
}

/* 7. Botão Usar Logo Padrão (Volt Corporate Blue) */
#btnResetLogo {
    background-color: #1e3a8a !important;
    color: #ffffff !important;
    border: none !important;
    padding: 0.65rem 1.25rem !important;
    border-radius: var(--radius-sm) !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 5px rgba(30, 58, 138, 0.25);
    transition: background-color 0.2s ease !important;
}
#btnResetLogo:hover {
    background-color: #172554 !important;
}

/* 3 & 5. Cores vibrantes e intuitivas nos botões dos cards móbile (Pagar, Indicar, Editar, Excluir) */
.btn-pay, .mobile-card-actions .btn-pay, .btn-row-action.btn-pay {
    background-color: #10b981 !important;
    color: #ffffff !important;
    border: none !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.25);
}
.btn-pay:hover { background-color: #059669 !important; }

.btn-indicate, .mobile-card-actions .btn-indicate, .btn-row-action.btn-indicate {
    background-color: #3b82f6 !important;
    color: #ffffff !important;
    border: none !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.25);
}
.btn-indicate:hover { background-color: #2563eb !important; }

.btn-edit, .mobile-card-actions .btn-edit, .btn-row-action.btn-edit {
    background-color: #f59e0b !important;
    color: #ffffff !important;
    border: none !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.25);
}
.btn-edit:hover { background-color: #d97706 !important; }

.btn-delete, .mobile-card-actions .btn-delete, .btn-row-action.btn-delete {
    background-color: #ef4444 !important;
    color: #ffffff !important;
    border: none !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.25);
}
.btn-delete:hover { background-color: #dc2626 !important; }

/* ==========================================================================
   ESTILOS DE PRESENÇA ONLINE E MICRO-ANIMAÇÕES
   ========================================================================== */
.badge-online {
    background-color: #16a34a !important; /* Verde */
    color: #ffffff !important;
}

.badge-offline {
    background-color: #64748b !important; /* Slate */
    color: #ffffff !important;
}

@keyframes pulsePresence {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.6;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}
