:root {
    --primary: #b71c1c;
    --primary-gradient: linear-gradient(135deg, #b71c1c 0%, #8a0b0b 100%);
    --secondary: #ff5252;
    --bg-color: #f4f7fa;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --shadow-sm: 0 1.7px 6.8px rgba(0,0,0,0.04); /* 15% a menos */
    --shadow-md: 0 8.5px 25.5px rgba(0,0,0,0.08); /* 15% a menos */
    --radius: 13.6px; /* 16px - 15% */
    --success-bg: #d4edda;
    --success-text: #155724;
    --error-bg: #f8d7da;
    --error-text: #721c24;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto; 
}

header {
    background: var(--primary-gradient);
    color: white;
    padding: 34px 20px 68px; /* Redução de 15% */
    border-bottom-left-radius: 25.5px; /* Redução de 15% */
    border-bottom-right-radius: 25.5px; /* Redução de 15% */
    text-align: left;
    position: relative;
    z-index: 1;
}

header h1 { 
    font-family: 'Poppins', sans-serif;
    font-size: 1.4875rem; /* 1.75rem - 15% */
    font-weight: 700;
    margin-bottom: 3.4px; /* Redução de 15% */
    letter-spacing: -0.425px; /* Redução de 15% */
}

header p { opacity: 0.9; font-size: 0.8075rem; /* 0.95rem - 15% */ font-weight: 400; }

/* --- Containers --- */
.container {
    flex: 1;
    padding: 0 17px 17px; /* Redução de 15% */
    max-width: 510px; /* 600px - 15% */
    margin: -34px auto 0; /* -40px - 15% */
    width: 100%;
    position: relative;
    z-index: 2;
}

/* Container específico para calculadoras */
.calc-container {
    background-color: var(--card-bg);
    padding: 21.25px; /* 25px - 15% */
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    text-align: center;
    margin-top: 0; 
}

/* --- Menu (Mantido) --- */
#install-btn { 
    display: none; 
    background: #10b981; 
    color: white; 
    border: none; 
    padding: 13.6px; /* 16px - 15% */
    border-radius: var(--radius); 
    width: 100%; 
    margin-bottom: 17px; /* 20px - 15% */
    font-family: 'Poppins', sans-serif; 
    font-weight: 600; 
    cursor: pointer; 
    box-shadow: 0 6.8px 17px rgba(16, 185, 129, 0.3); /* Redução de 15% */
    align-items: center; 
    justify-content: center; 
    gap: 8.5px; /* 10px - 15% */
    transition: transform 0.2s; 
    animation: pulse 2s infinite; 
    font-size: 0.85rem; /* Reduzindo fonte */
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); } 70% { box-shadow: 0 0 0 8.5px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }
#install-btn:active { transform: scale(0.98); }

.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13.6px; /* 16px - 15% */ }
.menu-item { 
    background: var(--card-bg); 
    border-radius: var(--radius); 
    padding: 20.4px 13.6px; /* 24px/16px - 15% */
    text-decoration: none; 
    color: var(--text-main); 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    box-shadow: var(--shadow-sm); 
    border: 1px solid rgba(255,255,255,0.5); 
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); 
    text-align: center; 
    height: 119px; /* 140px - 15% */
    position: relative; 
    overflow: hidden; 
}
.menu-item:hover { transform: translateY(-4.25px); /* -5px - 15% */ box-shadow: var(--shadow-md); }
.menu-item:active { transform: scale(0.98); }
.icon-box { 
    width: 42.5px; /* 50px - 15% */
    height: 42.5px; /* 50px - 15% */
    background: #fff0f0; 
    border-radius: 11.9px; /* 14px - 15% */
    display: flex; 
    align-items: center; 
    justify-content: center; 
    margin-bottom: 10.2px; /* 12px - 15% */
}
.menu-item i { color: var(--primary); stroke-width: 2.5px; width: 20px; height: 20px; /* Redução nos ícones */ }
.menu-item span { font-weight: 600; font-size: 0.7225rem; /* 0.85rem - 15% */ line-height: 1.3; color: var(--text-main); }
.menu-item small { display: block; font-weight: 400; color: var(--text-muted); font-size: 0.6375rem; /* 0.75rem - 15% */ margin-top: 1.7px; /* 2px - 15% */ }
.menu-item.ava .icon-box { background: #fff3e0; } .menu-item.ava i { color: #f57c00; }
.menu-item.sei .icon-box { background: #e3f2fd; } .menu-item.sei i { color: #1976d2; }
.menu-item.sae .icon-box { background: #f3e5f5; } .menu-item.sae i { color: #9c27b0; }

footer { text-align: center; padding: 25.5px 17px; /* Redução de 15% */ font-size: 0.6375rem; /* 0.75rem - 15% */ color: var(--text-muted); margin-top: auto; }
footer a { color: var(--primary); text-decoration: none; }

@media (min-width: 600px) {
    .menu-grid { grid-template-columns: repeat(3, 1fr); }
    header { text-align: center; padding-bottom: 68px; } /* Ajuste Desktop - 15% */
    .container { margin-top: -42.5px; /* -50px - 15% */ }
}

/* --- Elementos da Calculadora --- */

/* Botão de Ajuda */
.btn-help-link {
    background: none; border: none; color: var(--primary); font-size: 0.7225rem; /* 0.85rem - 15% */ font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 5.1px; /* 6px - 15% */ margin-bottom: 17px; /* 20px - 15% */ padding: 6.8px 10.2px; /* 8px/12px - 15% */ border-radius: 6.8px; /* 8px - 15% */ background-color: #fff0f0; transition: background 0.2s;
}
.btn-help-link:hover { background-color: #ffe0e0; }

.input-group { text-align: left; margin-bottom: 12.75px; /* 15px - 15% */ }
.input-group label { display: block; font-weight: 600; margin-bottom: 5.1px; /* 6px - 15% */ color: var(--text-main); font-size: 0.765rem; /* 0.9rem - 15% */ }
.input-group input { width: 100%; padding: 11.9px; /* 14px - 15% */ border: 1px solid #e5e7eb; border-radius: 8.5px; /* 10px - 15% */ font-size: 13.6px; /* 16px - 15% */ box-sizing: border-box; background-color: #f9fafb; transition: border-color 0.2s; }
.input-group input:focus { outline: none; border-color: var(--primary); background-color: white; }

.btn-calc, .btn-simular, .btn-back { width: 100%; padding: 11.9px; /* 14px - 15% */ border: none; border-radius: 8.5px; /* 10px - 15% */ font-size: 0.85rem; /* 1rem - 15% */ font-weight: 600; cursor: pointer; margin-top: 8.5px; /* 10px - 15% */ font-family: 'Inter', sans-serif; transition: opacity 0.2s; }
.btn-calc { background-color: var(--primary); color: white; }
.btn-simular { background-color: #ffb74d; color: #4e342e; }
.btn-back { background: transparent; color: var(--text-muted); margin-top: 17px; /* 20px - 15% */ font-size: 0.765rem; /* 0.9rem - 15% */ }
.btn-calc:active, .btn-simular:active { opacity: 0.8; }

#resultado { margin-top: 17px; /* 20px - 15% */ padding: 12.75px; /* 15px - 15% */ border-radius: 8.5px; /* 10px - 15% */ display: none; line-height: 1.5; }
.aprovado { background-color: var(--success-bg); color: var(--success-text); border: 1px solid #c3e6cb; }
.reprovado { background-color: var(--error-bg); color: var(--error-text); border: 1px solid #f5c6cb; }

/* --- MODAL (POPUP) --- */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); z-index: 1000; align-items: center; justify-content: center; padding: 17px; /* 20px - 15% */ backdrop-filter: blur(3px); }
.modal-content { background: white; width: 100%; max-width: 500px; border-radius: 17px; /* 20px - 15% */ padding: 20.4px; /* 24px - 15% */ position: relative; max-height: 90vh; overflow-y: auto; box-shadow: 0 17px 34px rgba(0,0,0,0.2); /* 20px/40px - 15% */ animation: slideUp 0.3s ease-out; }
@keyframes slideUp { from { transform: translateY(17px); /* 20px - 15% */ opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13.6px; /* 16px - 15% */ border-bottom: 1px solid #eee; padding-bottom: 8.5px; /* 10px - 15% */ }
.modal-header h3 { font-size: 0.935rem; /* 1.1rem - 15% */ color: var(--text-main); font-weight: 700; }
.close-modal { background: none; border: none; font-size: 1.275rem; /* 1.5rem - 15% */ color: var(--text-muted); cursor: pointer; line-height: 1; }
.modal-body p { margin-bottom: 6.8px; /* 8px - 15% */ font-weight: 600; color: var(--primary); font-size: 0.765rem; /* 0.9rem - 15% */ margin-top: 10.2px; /* 12px - 15% */ }
.tutorial-img { width: 100%; border-radius: 6.8px; /* 8px - 15% */ border: 1px solid #eee; margin-bottom: 4.25px; /* 5px - 15% */ }


/* Botão de Instalar (PWA) */
#install-btn {
    /* Mantido o que foi redefinido no bloco index/style e ajustado em 15% */
    display: none; 
    background: #10b981; 
    color: white;
    border: none;
    padding: 13.6px; /* 16px - 15% */
    border-radius: var(--radius);
    width: 100%;
    margin-bottom: 17px; /* 20px - 15% */
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6.8px 17px rgba(16, 185, 129, 0.3); /* 8px/20px - 15% */
    align-items: center; 
    justify-content: center;
    gap: 8.5px; /* 10px - 15% */
    transition: transform 0.2s;
    animation: pulse 2s infinite;
}

/* Animação de pulso suave */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 8.5px rgba(16, 185, 129, 0); } /* 10px - 15% */
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

#install-btn:active { transform: scale(0.98); }


/* ================================================== */
/* --- ESTILOS DO BLOCO <style> DENTRO DE index.html --- */
/* (Estes estilos SOBRESCREVEM os de cima se conflitarem, e foram reduzidos em 15%) */
/* ================================================== */

/* Redefinição/Ajuste de Variáveis (index.html) */
:root {
    --primary: #b71c1c;
    --primary-gradient: linear-gradient(135deg, #b71c1c 0%, #8a0b0b 100%);
    --secondary: #ff5252;
    --bg-color: #f4f7fa;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --shadow-sm: 0 1.7px 6.8px rgba(0,0,0,0.04);
    --shadow-md: 0 8.5px 25.5px rgba(0,0,0,0.08);
    --radius: 10.2px; /* 12px - 15% */
    --success-bg: #d4edda;
    --success-text: #155724;
    --error-bg: #f8d7da;
    --error-text: #721c24;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header (Ajustado) --- */
header {
    background: var(--primary-gradient);
    color: white;
    padding: 34px 20.4px 68px; /* 40px/24px/80px - 15% */ 
    border-bottom-left-radius: 25.5px; /* 30px - 15% */
    border-bottom-right-radius: 25.5px; /* 30px - 15% */
    text-align: center; /* Centralizei para ficar igual PC */
    position: relative;
    z-index: 1;
}

header h1 { 
    font-family: 'Poppins', sans-serif;
    font-size: 1.275rem; /* 1.5rem - 15% */ 
    font-weight: 700;
    margin-bottom: 3.4px; /* 4px - 15% */
    letter-spacing: -0.425px; /* -0.5px - 15% */
}

header p { opacity: 0.9; font-size: 0.765rem; /* 0.9rem - 15% */ font-weight: 400; }

/* --- Containers (Ajustado) --- */
.container {
    flex: 1;
    padding: 0 8.5px 17px; /* 10px/20px - 15% */
    max-width: 765px; /* 900px - 15% */
    margin: -34px auto 0; /* -40px - 15% */
    width: 100%;
    position: relative;
    z-index: 2;
}

.calc-container {
    background-color: var(--card-bg);
    padding: 17px; /* 20px - 15% */
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    text-align: center;
    margin-top: 0; 
}

/* --- MENU GRID (AGORA FIXO EM 6 COLUNAS E MENOR - SOBRESCRITA) --- */
.menu-grid { 
    display: grid; 
    grid-template-columns: repeat(6, 1fr); /* ALTERAÇÃO: 6 colunas SEMPRE */
    gap: 4.25px; /* 5px - Redução */
}

.menu-item { 
    background: var(--card-bg); 
    border-radius: var(--radius); 
    padding: 5.1px 2.55px; /* Redução para caber 6 colunas */
    text-decoration: none; 
    color: var(--text-main); 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: flex-start; /* Alinha no topo */
    box-shadow: var(--shadow-sm); 
    border: 1px solid rgba(255,255,255,0.5); 
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); 
    text-align: center; 
    height: 68px; /* Redução para caber 6 colunas */
    position: relative; 
    overflow: hidden; 
}

.menu-item:hover { transform: translateY(-2px); /* Redução */ box-shadow: var(--shadow-md); }
.menu-item:active { transform: scale(0.98); }

/* Caixa do ícone pequena para caber 6 colunas */
.icon-box { 
    width: 25.5px; /* 30px - Redução */
    height: 25.5px; /* 30px - Redução */
    background: #fff0f0; 
    border-radius: 6.8px; /* 8px - Redução */
    display: flex; 
    align-items: center; 
    justify-content: center; 
    margin-bottom: 4.25px; /* 5px - Redução */
    transition: background 0.3s; 
}

/* Ícone SVG pequeno para caber 6 colunas */
.menu-item i { 
    color: var(--primary); 
    stroke-width: 2.5px;
    width: 11.9px; /* 14px - Redução */
    height: 11.9px; /* 14px - Redução */ 
}

/* Texto pequeno para não quebrar com 6 colunas */
.menu-item span { 
    font-weight: 600; 
    font-size: 0.51rem; /* 0.6rem - Redução */
    line-height: 1.1; 
    color: var(--text-main); 
    word-break: break-word; 
}

.menu-item small { 
    display: none; /* Escondi o subtítulo (small) para caber 6 colunas no celular */
}

/* Cores */
.menu-item.ava .icon-box { background: #fff3e0; } .menu-item.ava i { color: #f57c00; }
.menu-item.sei .icon-box { background: #e3f2fd; } .menu-item.sei i { color: #1976d2; }
.menu-item.sae .icon-box { background: #f3e5f5; } .menu-item.sae i { color: #9c27b0; }

footer { text-align: center; padding: 25.5px 17px; /* 30px/20px - 15% */ font-size: 0.6375rem; /* 0.75rem - 15% */ color: var(--text-muted); margin-top: auto; }
footer a { color: var(--primary); text-decoration: none; }


/* --- Media Query para Desktop/Tablet (AJUSTADO PARA 6 COLUNAS) --- */
@media (min-width: 600px) {
    .menu-grid {
        grid-template-columns: repeat(6, 1fr); /* Mantenho 6 colunas */
        gap: 8.5px; /* 10px - Ajustado */
    }
    .container { 
        margin-top: -42.5px; /* -50px - 15% */ 
        padding: 0 17px 17px; /* 20px - 15% */
    }
    .menu-item {
        height: 80px; /* 90px - 15% */
        padding: 6.8px; /* 8px - Ajustado */
    }

    .icon-box { 
        width: 34px; /* 40px - Ajustado */
        height: 34px; /* 40px - Ajustado */
        margin-bottom: 5.1px; /* 6px - Ajustado */
    }

    .menu-item i { 
        width: 15.3px; /* 18px - Ajustado */
        height: 15.3px; /* 18px - Ajustado */ 
    }
    
    .menu-item span {
        font-size: 0.6375rem; /* 0.75rem - Ajustado */
    }
    
    /* Reabilita o texto pequeno no desktop */
    .menu-item small {
        display: block; 
        font-size: 0.45rem; /* 0.6rem - Ajustado */
        color: var(--text-muted);
        margin-top: 1.5px; /* 2px - Ajustado */
    }
}

/* --- Alerta Fixo (Exclusivo do index) --- */
.alert-box-static {
    background-color: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: var(--radius);
    padding: 17px; /* 20px - 15% */
    margin-top: 25.5px; /* 30px - 15% */
    text-align: center;
    color: #b71c1c;
    box-shadow: var(--shadow-sm);
}

.alert-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6.8px; /* 8px - 15% */
    font-weight: 700;
    font-size: 0.935rem; /* 1.1rem - 15% */
    margin-bottom: 8.5px; /* 10px - 15% */
    color: #b71c1c;
}

/* Botão Instalar (Redefinido/Ajustado) */
#install-btn {
    display: none; 
    background: #10b981; 
    color: white;
    border: none;
    padding: 13.6px; /* 16px - 15% */
    border-radius: var(--radius);
    width: 100%;
    margin-bottom: 17px; /* 20px - 15% */
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6.8px 17px rgba(16, 185, 129, 0.3); /* 8px/20px - 15% */
    align-items: center; 
    justify-content: center;
    gap: 8.5px; /* 10px - 15% */
    transition: transform 0.2s;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 8.5px rgba(16, 185, 129, 0); } /* 10px - 15% */
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

#install-btn:active { transform: scale(0.98); }

/* --- Estilos do Aviso (Injetados via JS no index.html) --- */
/* Estes devem ser mantidos, pois são usados no JS do index, e ajustados em 15% */

#aviso-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

#aviso-box {
    background: white;
    padding: 21.25px; /* 25px - 15% */
    border-radius: 12.75px; /* 15px - 15% */
    max-width: 90%;
    width: 340px; /* 400px - 15% */
    text-align: center;
    box-shadow: 0 3.4px 12.75px rgba(0,0,0,0.3); /* 4px/15px - 15% */
    font-family: sans-serif;
    animation: surgir 0.3s ease-out;
}

#aviso-box h2 {
    color: #d32f2f;
    margin-top: 0;
}

#aviso-box p {
    color: #333;
    font-size: 11.9px; /* 14px - 15% */
    line-height: 1.5;
    margin-bottom: 17px; /* 20px - 15% */
}

.btn-aviso {
    padding: 8.5px 17px; /* 10px/20px - 15% */
    border: none;
    border-radius: 6.8px; /* 8px - 15% */
    cursor: pointer;
    font-weight: bold;
    font-size: 11.9px; /* 14px - 15% */
    margin: 4.25px; /* 5px - 15% */
    transition: 0.2s;
}

#btn-concordo {
    background-color: #d32f2f;
    color: white;
}

#btn-nao-concordo {
    background-color: #e0e0e0;
    color: #333;
}

@keyframes surgir {
    from { transform: scale(0.68); /* 0.8 - 15% */ opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}