/* --- VARIÁVEIS CSS PARA TEMA --- */
:root {
    /* Modo Escuro (Padrão) */
    --bg-primary: #100e17;
    --bg-secondary: #17141d;
    --bg-tertiary: #1c1a24;
    --bg-quaternary: #2e3033;
    --text-primary: white;
    --text-secondary: #ccc;
    --text-muted: #aaa;
    --border-color: #2e3033;
    --accent-primary: #009ad9;
    --accent-secondary: #ff8c00;
    --success-color: #00d1b2;
    --card-shadow: -1rem 0 3rem #000;
}

/* Modo Claro */
[data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e9ecef;
    --bg-quaternary: #dee2e6;
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --accent-primary: #007bff;
    --accent-secondary: #fd7e14;
    --success-color: #28a745;
    --card-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* --- SCROLLBARS PARA MODO CLARO --- */
[data-theme="light"] ::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: var(--bg-quaternary);
    border: 2px solid var(--bg-tertiary);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

[data-theme="light"] ::-webkit-scrollbar-corner {
    background: var(--bg-tertiary);
}

[data-theme="light"] * {
    scrollbar-color: var(--bg-quaternary) var(--bg-tertiary);
}

/* --- ESTILOS GERAIS --- */
body {
    background-color: var(--bg-primary);
    font-family: 'Open Sans', sans-serif;
    color: var(--text-primary);
    margin: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- ANIMAÇÕES GLOBAIS OTIMIZADAS --- */
* {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Desabilitar animações para elementos que não precisam */
input, select, textarea, button {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* Otimizar transições para melhor performance */
.card, .modal-content, .btn {
    will-change: transform, box-shadow;
    backface-visibility: hidden;
}

/* --- ESTILOS CUSTOMIZADOS PARA SCROLLBARS --- */
/* Scrollbar para Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-quaternary);
    border-radius: 6px;
    border: 2px solid var(--bg-tertiary);
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

::-webkit-scrollbar-corner {
    background: var(--bg-tertiary);
}

/* Scrollbar para Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--bg-quaternary) var(--bg-tertiary);
}

/* Scrollbar para elementos específicos com scroll */
.container,
.modal-content,
.parcelas-list,
.dropdown-options {
    scrollbar-width: thin;
    scrollbar-color: var(--bg-quaternary) var(--bg-tertiary);
}

/* Scrollbar mais fina para elementos pequenos */
.dropdown-options,
.parcelas-list {
    scrollbar-width: thin;
}

.dropdown-options::-webkit-scrollbar,
.parcelas-list::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

/* Removido scrollbar horizontal - não é mais necessário com flexbox */

/* Animação de entrada suave para elementos */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

main {
    padding: 20px;
}

/* --- NAVEGAÇÃO PRINCIPAL --- */
.main-navigation {
    margin-bottom: 30px;
}

.nav-tabs {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.nav-tab {
    margin-right: 30px;
}

.nav-tab:last-child {
    margin-right: 0;
}

.nav-link {
    display: block;
    padding: 15px 0;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 400;
    font-size: 16px;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link.active {
    color: var(--text-primary);
    font-weight: 500;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
}

/* --- ESTILO PARA O HEADER E MENU DE PERFIL --- */
.main-header { padding: 10px 30px; display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 1002; }

.theme-toggle-container {
    display: flex;
    align-items: center;
}

.theme-toggle-btn {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.theme-toggle-btn:hover {
    background-color: var(--bg-tertiary);
    transform: scale(1.1);
}

.theme-toggle-btn i {
    font-size: 16px;
    transition: transform 0.3s ease;
}
.profile-menu-container { position: relative; }
.profile-button { background-color: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 20px; padding: 4px 12px 4px 4px; display: flex; align-items: center; cursor: pointer; gap: 10px; color: var(--text-primary); transition: all 0.3s ease; }
.profile-button:hover { background-color: var(--bg-quaternary); }
.profile-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.profile-avatar-initial { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, rgba(0,154,217,1) 0%, rgba(217,147,0,1) 100%); display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 14px; }
.profile-name { font-weight: 300; }
.profile-dropdown { display: none; position: absolute; top: 110%; right: 0; background-color: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 8px; min-width: 200px; box-shadow: var(--card-shadow); overflow: hidden; }
.profile-dropdown.active { display: block; }
.dropdown-item { display: flex; align-items: center; gap: 12px; padding: 12px 15px; color: var(--text-secondary); text-decoration: none; font-size: 0.9rem; transition: background-color 0.2s; }
.dropdown-item:hover { background-color: var(--bg-quaternary); color: var(--text-primary); }
.dropdown-item i { width: 16px; text-align: center; }
.dropdown-divider { height: 1px; background-color: #2e3033; margin: 5px 0; }
.dropdown-item-logout { color: #ff3860; }

/* --- ESTILO PARA A TELA DE LOGIN --- */
body.login-page-body, body.login-page-body main {
    height: 100vh;
    padding: 0;
    margin: 0;
    overflow: hidden;
}
.login-wrapper { display: flex; justify-content: center; align-items: center; width: 100%; height: 100%; }
.login-box { background-color: #17141d; padding: 30px 40px; border-radius: 10px; width: 100%; max-width: 400px; box-shadow: -1rem 0 3rem #000; }

/* --- PREÇOS EM PARCELAS (formato desconto) --- */
.parcela-preco { display: flex; align-items: baseline; gap: 8px; }
.parcela-preco .price { color: var(--success, #03a2e1); font-weight: 800; letter-spacing: .2px; }
.parcela-preco .price .currency { margin-right: 2px; }
.parcela-preco .price .cents { font-size: 0.6em; vertical-align: super; font-weight: 700; }
.parcela-preco .old-price { color: var(--text-secondary); text-decoration: line-through; opacity: .7; font-size: .9em; }
.parcela-preco .old-price .currency { margin-right: 2px; }
.parcela-preco .old-price .cents { font-size: 0.7em; vertical-align: super; }
.error-message { color: #ff3860; text-align: center; margin-bottom: 1rem; font-size: 0.9rem; }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, input:-webkit-autofill:active { -webkit-box-shadow: 0 0 0 30px #2e3033 inset !important; -webkit-text-fill-color: white !important; caret-color: white !important; }

/* --- ESTILOS GERAIS DA PÁGINA DE EMPRÉSTIMOS --- */
.header-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.main-title { text-align: center; font-weight: 300; margin-bottom: 0; }
.buttons-container { display: flex; gap: 15px; }
.container { width: 100%; max-width: 1000px; margin: 20px auto; display: none; justify-content: center; flex-wrap: nowrap; overflow-x: auto; gap: 15px; scroll-behavior: smooth; padding: 50px 15px; }
.container.active { display: flex; }

/* --- ESTILOS DOS CARDS --- */
.card { 
    display: flex; 
    flex-direction: column; 
    height: 280px; 
    width: 220px; 
    background-color: var(--bg-secondary); 
    border-radius: 10px; 
    box-shadow: var(--card-shadow); 
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); 
    position: relative; 
    padding: 15px; 
    box-sizing: border-box; 
    margin-top: 30px; 
    flex-shrink: 0; 
    cursor: pointer;
    animation: fadeInUp 0.6s ease-out;
}

.card:hover { 
    transform: translateY(-20px) scale(1.02); 
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.card.dragging { 
    opacity: 0.5; 
    transform: rotate(5deg) scale(1.05); 
    z-index: 1000; 
    transition: all 0.2s ease;
}

.card.drag-over { 
    border: 2px dashed var(--accent-primary); 
    background-color: var(--bg-tertiary); 
    animation: pulse 1s infinite;
}

.card.expanded {
    animation: bounce 0.6s ease-out;
}
.card-logo { width: 50px; height: 50px; border-radius: 50%; object-fit: contain; background-color: white; padding: 5px; position: absolute; top: -30px; left: calc(50% - 30px); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4); border: 2px solid #2e3033; }
.card .title { color: var(--text-primary); font-weight: 300; font-size: 1.2rem; text-align: center; margin-top: 25px; margin-bottom: 10px; }
.card .bar { width: 90%; height: 5px; margin: 0 auto 15px auto; position: relative; }
.card .emptybar { background-color: var(--bg-quaternary); width: 100%; height: 100%; border-radius: 5px; }
.card .filledbar { position: absolute; top: 0px; z-index: 3; width: 0px; height: 100%; border-radius: 5px; background: linear-gradient(90deg, rgba(0,154,217,1) 0%, rgba(217,147,0,1) 65%, rgba(255,186,0,1) 100%); transition: width 0.6s ease-out; }
/* Removido: .card:hover .filledbar { width: 80%; } - Agora a barra sempre mostra o progresso real */
.card .card-content { font-size: 0.9rem; color: var(--text-secondary); text-align: center; flex-grow: 1; }
.card .card-content p { margin: 0 0 8px 0; }
.card .card-footer { text-align: center; font-size: 1.3rem; font-weight: bold; color: var(--success-color); padding-top: 10px; }
.status { padding: 3px 8px; border-radius: 12px; font-size: 0.8em; font-weight: bold; }
.status-ativo { background-color: rgba(0, 154, 217, 0.2); color: #009ad9; }
.status-quitado { background-color: rgba(169, 169, 169, 0.2); color: #a9a9a9; }

/* --- ESTILOS COMPARTILHADOS PARA MENUS DE INSTITUIÇÕES --- */
/* Aplicar a todos os menus de instituições */
.category-menu, 
.snip1189,
#menu-instituicoes,
#menu-categorias { 
    list-style: none; 
    padding: 0; 
    margin: 0 0 40px 0; 
    text-align: left; 
    border-bottom: 2px solid #2e3033; 
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.category-menu li, 
.snip1189 li,
#menu-instituicoes li,
#menu-categorias li { 
    display: inline-block; 
    margin: 0; 
    flex-shrink: 0;
}

.category-menu li a, 
.snip1189 li a,
#menu-instituicoes li a,
#menu-categorias li a { 
    color: #aaa; 
    text-decoration: none; 
    padding: 10px 20px; 
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    position: relative; 
    transition: color 0.3s; 
    cursor: pointer; 
}

.category-menu li a:hover, 
.snip1189 li a:hover,
#menu-instituicoes li a:hover,
#menu-categorias li a:hover { 
    color: white; 
}

.category-menu li.current a, 
.snip1189 li.current a,
#menu-instituicoes li.current a,
#menu-categorias li.current a { 
    color: white; 
    font-weight: bold; 
}

.category-menu li.current a::after, 
.snip1189 li.current a::after,
#menu-instituicoes li.current a::after,
#menu-categorias li.current a::after { 
    content: ''; 
    position: absolute; 
    width: 100%; 
    height: 2px; 
    background: linear-gradient(90deg, rgba(0,154,217,1) 0%, rgba(217,147,0,1) 65%, rgba(255,186,0,1) 100%); 
    left: 0; 
    bottom: -1px; 
}

/* Garantir que o item "Todos" tenha a mesma espessura em todos os menus */
.category-menu li.menu-item-static.current a::after, 
.snip1189 li.menu-item-static.current a::after,
#menu-instituicoes li.menu-item-static.current a::after,
#menu-categorias li.menu-item-static.current a::after { 
    content: ''; 
    position: absolute; 
    width: 100%; 
    height: 2px; 
    background: linear-gradient(90deg, rgba(0,154,217,1) 0%, rgba(217,147,0,1) 65%, rgba(255,186,0,1) 100%); 
    left: 0; 
    bottom: -1px; 
}
.menu-logo { width: 20px; height: 20px; border-radius: 50%; background-color: white; object-fit: contain; }
.menu-item-draggable { cursor: grab; }
.menu-item-draggable.dragging { opacity: 0.5; background: #2e3033; }

/* Estilo para contador de itens nos menus */
.menu-count {
    background-color: var(--accent-primary);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
}

/* Estilo para indicador de instituição sem empréstimos/cartões */
.instituicao-vazia {
    color: var(--accent-secondary);
    font-size: 0.8rem;
    margin-left: 5px;
    opacity: 0.7;
}

.instituicao-vazia:hover {
    opacity: 1;
}

/* --- ESTILOS DO MODAL DE INSTITUIÇÕES --- */
.modal-large {
    max-width: 800px;
    width: 90%;
}

.instituicoes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.instituicao-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.instituicao-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: var(--accent-primary);
}

.instituicao-card-logo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin: 0 auto 10px;
    object-fit: contain;
    background: white;
    padding: 5px;
}

.instituicao-card-nome {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.instituicao-card-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.instituicao-card-sem-dados {
    color: var(--accent-secondary);
    font-style: italic;
}

/* --- ESTILOS DE PAGINAÇÃO --- */
.pagination-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.page-btn {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover {
    background-color: var(--bg-quaternary);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.page-btn.active {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    box-shadow: 0 2px 8px rgba(0, 154, 217, 0.3);
}

/* --- ESTILOS DO SLIDER DE PARCELAS --- */
.parcelas-slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 12px;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.slider-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

.parcelas-slider {
    flex: 1;
    height: 6px;
    background: var(--bg-quaternary);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.parcelas-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 154, 217, 0.3);
    transition: all 0.3s ease;
}

.parcelas-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0, 154, 217, 0.4);
}

.parcelas-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 154, 217, 0.3);
    transition: all 0.3s ease;
}

.parcelas-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0, 154, 217, 0.4);
}

.slider-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-primary);
    min-width: 20px;
    text-align: center;
}

/* --- ESTILOS DOS MODAIS E FORMULÁRIOS --- */
.btn { 
    border: 1px solid #444; 
    color: #ccc; 
    background: #1c1a24; 
    padding: 10px 20px; 
    border-radius: 5px; 
    cursor: pointer; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    font-weight: bold; 
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}
.btn-primary     { background: linear-gradient(90deg, rgba(100,100,100,1) 0%, rgba(255,140,0,1) 50%, rgba(102,0,153,1) 100%);}

.btn-secondary { background: #2e3033; border: none; color: white; }
.btn-danger { background: #dc3545; border: none; color: white; }
.btn:hover { filter: brightness(1.2); }
.btn i { margin-right: 8px; }

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    overflow-y: auto;
    animation: fadeIn 0.3s ease-out;
}

.modal.show {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background-color: var(--bg-secondary);
    margin: 40px auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    width: 90%;
    max-width: 750px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    animation: fadeInUp 0.4s ease-out;
    transform-origin: center;
}

.modal-header { padding: 1rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; font-weight: 300; color: var(--text-primary); }
.close-modal { color: var(--text-muted); cursor: pointer; transition: color 0.3s; }
.close-modal:hover { color: var(--text-primary); }
.modal-body { padding: 1rem; }
.modal-footer { padding: 1rem; border-top: 1px solid var(--border-color); text-align: right; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; color: var(--text-muted); }
.form-group input, .form-group select { width: 100%; padding: 6px; background-color: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: 5px; color: var(--text-primary); box-sizing: border-box; transition: all 0.3s ease; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--accent-primary); }

/* --- ESTILOS DO DROPDOWN CUSTOMIZADO --- */
.custom-dropdown { position: relative; cursor: pointer; }
.dropdown-selected { width: 100%; padding: 10px; background-color: #2e3033; border: 1px solid #444; border-radius: 5px; color: white; box-sizing: border-box; display: flex; align-items: center; gap: 10px; }
.dropdown-selected::after { content: '▼'; font-size: 0.8em; margin-left: auto; color: #aaa; }
.dropdown-options { display: none; position: absolute; top: 100%; left: 0; right: 0; background-color: #1c1a24; border: 1px solid #444; border-radius: 5px; list-style: none; margin-top: 5px; padding: 5px; z-index: 1001; max-height: 200px; overflow-y: auto; }
.custom-dropdown.active .dropdown-options { display: block; }
.dropdown-options li { padding: 10px; display: flex; align-items: center; gap: 10px; border-radius: 5px; transition: background-color 0.2s; }
.dropdown-options li:hover { background-color: #2e3033; }
.option-logo { width: 24px; height: 24px; border-radius: 50%; object-fit: contain; }

/* --- CORREÇÃO E AJUSTES FINAIS NOS BOTÕES E CARDS --- */
.modal-footer .btn {
    padding: 10px 20px;
    min-width: 100px;
    text-align: center;
}

.card .edit-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #aaa;
    cursor: pointer;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.3s, color 0.3s;
}
.card:hover .edit-icon {
    opacity: 1;
}
.card .edit-icon:hover {
    color: white;
}

.category-menu .edit-icon-menu,
.snip1189 .edit-icon-menu,
#menu-instituicoes .edit-icon-menu,
#menu-categorias .edit-icon-menu {
    color: #666;
    font-size: 12px;
    margin-left: 5px;
    opacity: 0.6;
    transition: all 0.3s;
}
.category-menu a:hover .edit-icon-menu,
.snip1189 a:hover .edit-icon-menu,
#menu-instituicoes a:hover .edit-icon-menu,
#menu-categorias a:hover .edit-icon-menu {
    color: white;
    opacity: 1;
}

/* --- CORREÇÃO PARA O TAMANHO DA LOGO --- */
.login-logo {
    display: block;
    max-width: 220px; /* Aumentado de 150px para 250px */
    height: auto;
    margin: -15px auto -25px auto; /* Aumentada a margem inferior */
}

/* Removido carrossel horizontal - agora usa flexbox com wrap */
.menu-nome {
    display: inline;
    font-size: 0.9rem;
    margin-left: 5px;
}

.profile-dropdown {
    display: none;
    position: absolute;
    top: 110%;
    right: 0;
    background-color: #17141d;
    border: 1px solid #2e3033;
    border-radius: 8px;
    min-width: 200px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
    overflow: hidden;
    z-index: 1002;
}
.profile-dropdown.active {
    display: block;
}

.ordem-feedback {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background-color: var(--success-color);
    color: white;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--card-shadow);
    z-index: 1001;
    transition: all 0.3s ease;
    animation: slideIn 0.5s ease-out;
}

.hidden {
    opacity: 0;
    pointer-events: none;
}
.visible {
    opacity: 1;
    pointer-events: all;
}

.form-group-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.form-group-row .form-group {
    flex: 1 1 calc(33.333% - 10px); /* Tenta 3 por linha */
    min-width: 180px;
}

/* Responsivo: quebra para 2 colunas em telas menores */
@media (max-width: 768px) {
    .form-group-row .form-group {
        flex: 1 1 calc(50% - 10px);
    }
}

/* Responsivo: quebra para 1 coluna em telas muito pequenas */
@media (max-width: 480px) {
    .form-group-row .form-group {
        flex: 1 1 100%;
    }
}

/* --- ESTILOS PARA LINHAS DE FORMULÁRIO (CAMPOS LADO A LADO) --- */
.form-row {
    display: flex;
    gap: 15px; /* Cria um espaço entre os campos */
    align-items: flex-start;
}

.form-row .form-group {
    flex: 1; /* Faz com que cada campo na linha ocupe o mesmo espaço */
    min-width: 0; /* Necessário para o flexbox funcionar corretamente */
}

/* Adicionado para o layout de duas colunas no modal de empréstimo */
.form-columns {
    display: flex;
    gap: 20px;
}

.form-column {
    flex: 1;
    min-width: 0;
}

/* Estilos para seção de parcelas */
.form-section {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.form-section h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 16px;
}

.parcela-item {
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.parcela-header {
    min-width: 80px;
    font-weight: bold;
    color: #495057;
}

.parcela-fields {
    display: flex;
    gap: 10px;
    flex: 1;
}

.parcela-fields .form-group {
    margin: 0;
    flex: 1;
}

.parcela-fields label {
    font-size: 12px;
    margin-bottom: 4px;
}

.parcela-fields input {
    font-size: 13px;
    padding: 6px 8px;
}

/* --- ESTILOS PARA EXPANSÃO DOS CARDS --- */
.card.expanded {
    height: auto;
    min-height: 280px;
    width: 280px;
    max-width: 400px;
    transform: translateY(-20px) scale(1.05);
    z-index: 10;
}

.parcela-item-hover .edit-parcela-icon {
    position: absolute;
    right: 206px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.3s, color 0.3s;
    color: #aaa;
    cursor: pointer;
    font-size: 14px;
    padding: 5px;
}

.parcela-item-hover:hover .edit-parcela-icon {
    opacity: 1;
}

.parcela-item-hover .edit-parcela-icon:hover {
    color: white;
}

.card-details {
    display: none;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #2e3033;
}

.card.expanded .card-details {
    display: block;
}

.parcelas-list {
    /* max-height: 200px; */
    overflow-y: auto;
    overflow-x: hidden;
    margin-top: 10px;
}

/* CSS Range para controle de parcelas */
.parcelas-range-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 10px;
    background-color: var(--bg-quaternary);
    border-radius: 8px;
}

.parcelas-range-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.parcelas-range {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.parcelas-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

.parcelas-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.parcelas-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

.parcelas-range::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.parcelas-range-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
    min-width: 30px;
    text-align: center;
}

.parcela-item-hover {
    display: flex;
    justify-content: space-between; /* Restaurado */
    align-items: center;
    padding: 8px 12px;
    margin: 5px 0;
    background-color: var(--bg-quaternary);
    border-radius: 6px;
    font-size: 0.9rem;
    min-height: 40px;
    position: relative; /* Mantido para o ícone */
}

.parcela-item-hover:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.parcela-item-hover.paga {
    background-color: rgba(0, 154, 217, 0.2);
    border-left: 3px solid #009ad9;
}

.parcela-item-hover.pendente {
    background-color: rgba(255, 140, 0, 0.1);
    border-left: 3px solid #ff8c00;
}

.parcela-numero {
    font-weight: bold;
    color: #ccc;
    min-width: 40px;
}

.parcela-valor {
    color: #00d1b2;
    font-weight: bold;
    flex: 1;
    text-align: center;
}

.parcela-status {
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 60px;
    text-align: center;
    white-space: nowrap;
}

.parcela-status.paga {
    background-color: #009ad9;
    color: white;
}

.parcela-status.pendente {
    background-color: #ff8c00;
    color: white;
}

.parcela-status {
    cursor: pointer;
    transition: all 0.2s ease;
}

.parcela-status:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.estatisticas-parcelas {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    padding: 10px;
    background-color: #1c1a24;
    border-radius: 6px;
    font-size: 0.9rem;
}

.estatisticas-financeiras {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    padding: 10px;
    background-color: #2a252f;
    border-radius: 6px;
    font-size: 0.9rem;
    border: 1px solid #3a3540;
}

.estatistica-item {
    text-align: center;
}

.estatistica-label {
    color: #aaa;
    font-size: 0.8rem;
}

.estatistica-valor {
    color: white;
    font-weight: bold;
}

.estatistica-valor.economia {
    color: #00d1b2;
    font-weight: bold;
}

/* --- INDICADOR DE ATALHOS --- */
#shortcut-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    padding: 12px 16px;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    font-size: 14px;
    font-weight: 500;
    user-select: none;
}

#shortcut-indicator:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.shortcut-indicator-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shortcut-indicator-content i {
    font-size: 16px;
}

/* --- MODAL DE AJUDA DE ATALHOS --- */
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.shortcut-category h4 {
    color: var(--text-primary);
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 2px solid var(--accent-primary);
    padding-bottom: 5px;
}

.shortcut-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

kbd {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-primary);
    min-width: 80px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.shortcuts-tip {
    background: var(--bg-tertiary);
    border: 1px solid var(--accent-primary);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 20px;
}

.shortcuts-tip i {
    color: var(--accent-secondary);
    margin-right: 8px;
}

/* --- MELHORIAS DE ANIMAÇÃO --- */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* Animações para cards */
.card {
    animation: fadeInUp 0.6s ease-out;
}

.card:nth-child(odd) {
    animation: slideInLeft 0.6s ease-out;
}

.card:nth-child(even) {
    animation: slideInRight 0.6s ease-out;
}

/* Animações para modais */
.modal-content {
    animation: scaleIn 0.3s ease-out;
}

/* Animações para botões */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::after {
    left: 100%;
}

/* Animações para hover em cards - removida animação pulse que causava frenesi */

/* Melhorias no tema claro */
[data-theme="light"] .card {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .modal-content {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] #shortcut-indicator {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Responsividade para o indicador de atalhos */
@media (max-width: 768px) {
    #shortcut-indicator {
        bottom: 10px;
        right: 10px;
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .shortcuts-grid {
        grid-template-columns: 1fr;
    }
}