:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
    --sidebar-bg: #051e18;
    --sidebar-text: #a4b0be;
    --sidebar-active: #ffffff;
    --accent-green: #2ecc71;
    --accent-red: #e74c3c;
    --bg-body: #f1f2f6;
    --card-bg: #ffffff;
    --text-primary: #2f3542;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

body {
    display: flex;
    height: 100vh;
    background-color: var(--bg-body);
    color: var(--text-primary);
    overflow: hidden;
}

/* --- Sidebar Navegação (Comum) --- */
.sidebar, .sidebar-nav {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 20px;
    transition: width 0.3s;
    flex-shrink: 0;
    height: 100vh;
    position: relative; /* Ajustado para ser relativo no financeiro e fixed no mapa se necessário, mas flexbox resolve */
}

/* No mapa a sidebar é fixed, vamos tratar isso no CSS específico ou unificar */
/* Para unificar, vamos assumir que a estrutura flex do body resolve para o financeiro. 
   Para o mapa, o mapa ocupa o resto. */

.sidebar.collapsed, .sidebar-nav.collapsed {
    width: var(--sidebar-collapsed-width);
    padding: 20px 10px;
}

.brand {
    color: white;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    white-space: nowrap;
    overflow: hidden;
}
.brand i { color: var(--accent-red); }

.sidebar.collapsed .brand-text, .sidebar-nav.collapsed .brand-text { display: none; }
.sidebar.collapsed .brand, .sidebar-nav.collapsed .brand { justify-content: center; }

.toggle-btn {
    background: none; border: none; color: var(--sidebar-text); cursor: pointer; font-size: 18px;
}
.sidebar.collapsed .brand .toggle-btn, .sidebar-nav.collapsed .brand .toggle-btn { display: none; }

.sidebar-toggle-wrapper {
    display: flex; justify-content: flex-end; margin-bottom: 20px;
}
.sidebar.collapsed .sidebar-toggle-wrapper, .sidebar-nav.collapsed .sidebar-toggle-wrapper { justify-content: center; }

.nav-menu {
    list-style: none;
    flex-grow: 1;
    padding: 0;
}

.nav-item {
    margin-bottom: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(255,255,255,0.1);
    color: var(--sidebar-active);
}

.nav-link.active {
    border-left: 4px solid var(--accent-green);
}

.sidebar.collapsed .nav-link, .sidebar-nav.collapsed .nav-link { justify-content: center; padding: 15px; }
.sidebar.collapsed .nav-link span, .sidebar-nav.collapsed .nav-link span { display: none; }

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: white;
    white-space: nowrap;
    overflow: hidden;
}
.user-avatar {
    width: 40px; height: 40px; min-width: 40px;
    background: #ccc;
    border-radius: 50%;
    background-image: url('https://ui-avatars.com/api/?name=User&background=random');
    background-size: cover;
}
.sidebar.collapsed .user-info, .sidebar-nav.collapsed .user-info { display: none; }

/* Utilitários */
.btn-primary {
    background-color: var(--accent-red);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}
.btn-primary:hover { background-color: #c0392b; }

/* Styles for Tree Menu (Accordion) in Sidebar */
.nav-item-has-submenu {
    position: relative;
    display: flex;
    flex-direction: column;
}

.nav-link.has-submenu {
    justify-content: space-between;
    cursor: pointer;
}

/* Chevron icon via CSS or FontAwesome class on HTML? 
   Using pseudo-element is cleaner but needs FA font-family. 
   Let's stick to a clean CSS arrow for compatibility or try FA code.
*/
.nav-link.has-submenu::after {
    content: '\f078'; /* fa-chevron-down */
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 0.75em;
    transition: transform 0.3s ease;
    margin-left: auto;
    transform: rotate(-90deg); /* Start pointing right */
    color: var(--sidebar-text);
}

/* Rotate chevron when open (point down) */
.nav-item-has-submenu.open .nav-link.has-submenu::after {
    transform: rotate(0deg);
    color: var(--accent-green);
}

.nav-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: rgba(0, 0, 0, 0.25);
    border-left: 3px solid transparent;
}

/* Open state for submenu */
.nav-item-has-submenu.open .nav-submenu {
    max-height: 500px;
    border-left-color: var(--accent-green); /* Visual indicator line for the block */
}

.nav-link-sub {
    display: flex;
    align-items: center;
    padding: 12px 15px 12px 50px; /* Deep indentation */
    color: #b2bec3;
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.2s ease;
    position: relative;
}

/* Hover effect */
.nav-link-sub:hover {
    color: white;
    background-color: rgba(255,255,255,0.05);
    padding-left: 55px; /* Subtle movement */
}

/* Bullet indicator specifically for tree look */
.nav-link-sub::before {
    content: '';
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background-color: #636e72;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.nav-link-sub:hover::before {
    background-color: var(--accent-green);
}

.sidebar.collapsed .nav-submenu, .sidebar-nav.collapsed .nav-submenu {
    display: none !important;
}

