:root {
    --ita-green: #008C45;
    --ita-dark-green: #006b35;
    --ita-white: #F4F5F7;
    --ita-red: #CD212A;
    --dark-text: #2c3e50;
    --sidebar-width: 260px;
    --sidebar-width-collapsed: 70px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--ita-white);
    color: var(--dark-text);
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Evita rolagem lateral indesejada */
}

/* --- ESTILOS DE SOFT DELETE (INATIVOS) --- */
.badge-inativo { 
    background: #777; 
    color: white; 
    padding: 2px 6px; 
    border-radius: 4px; 
    font-size: 10px; 
    font-weight: bold; 
    margin-left: 5px; 
    vertical-align: middle;
    text-transform: uppercase;
}

.row-inativo { 
    background-color: #f2f2f2 !important; 
    color: #999 !important; 
}

.row-inativo td, 
.row-inativo div { 
    color: #999 !important; 
}

.row-inativo strong, 
.row-inativo b,
.row-inativo [data-label="Nome"],
.row-inativo [data-label="Título"],
.row-inativo [data-label="IP"] { 
    text-decoration: line-through; 
    color: #999 !important; 
}

.row-inativo .btn-action { 
    opacity: 0.6; 
}
.row-inativo .btn-action:hover { 
    opacity: 1; 
}

/* --- LAYOUT DE SIDEBAR --- */
.app-wrapper {
    display: flex;
    width: 100%;
    height: 100vh; /* Ocupa a altura total da tela */
    overflow: hidden;
    background: url('../uploads/bg-pattern.png'), #f4f7f6; /* Optional: background texture if available, else plain color */
    background-size: cover;
    background-position: center;
}

/* Sidebar Styling - Modern & Transparent */
.sidebar {
    width: var(--sidebar-width);
    /* Gradiente mais claro e com mais transparência conforme solicitado */
    background: linear-gradient(180deg, rgba(0, 110, 55, 0.6) 0%, rgba(0, 50, 25, 0.8) 100%);
    backdrop-filter: blur(20px); /* Desfoque mais intenso para efeito vidro fosco */
    -webkit-backdrop-filter: blur(20px);
    color: white;
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1000;
    flex-shrink: 0;
    /* Sombra mais marcada na direita */
    box-shadow: 10px 0 30px rgba(0,0,0,0.25);
    border-right: 1px solid rgba(255,255,255,0.15);
}

.sidebar-header {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 20px;
    font-weight: bold;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
    overflow: hidden;
    justify-content: center; /* Centraliza logo */
    background: transparent;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5); /* Sombra forte no texto */
}

.sidebar-logo {
    max-height: 40px; /* Reduzido de 50px */
    max-width: 150px; /* Reduzido de 180px */
    object-fit: contain;
    transition: all 0.3s;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding-top: 20px;
    padding-bottom: 100px; /* Adicionado espaço extra no final para evitar cortes */
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #ffffff; /* Branco puro para máximo contraste */
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 15px;
    font-weight: 500; /* Um pouco mais negrito */
    white-space: nowrap;
    overflow: hidden;
    border-left: 4px solid transparent;
    margin-bottom: 2px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8); /* Sombra para separar do fundo */
    cursor: pointer;
}

.sidebar-link:hover {
    background-color: rgba(255,255,255,0.15);
    padding-left: 25px;
    color: #fff;
    box-shadow: inset 5px 0 10px -5px rgba(0,0,0,0.05);
}

.sidebar-link.active {
    background: rgba(255,255,255,0.2); /* Vidro semi-transparente */
    border-left-color: #fff;
    font-weight: bold;
    color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border-radius: 0 25px 25px 0;
    margin-right: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* Estilo para Sub-itens (como o Modo Leitura dentro de Contas) */
.sidebar-link.sub-item {
    padding-left: 50px;
    background: transparent; 
    font-size: 14px;
    border-left: 4px solid transparent; /* Reseta borda */
}
.sidebar-link.sub-item .icon {
    font-size: 16px;
    min-width: 25px;
}
.sidebar-link.sub-item:hover {
    padding-left: 55px;
    background: rgba(255,255,255,0.1);
}
.sidebar-link.sub-item.active {
    background: rgba(255,255,255,0.15);
    border-left-color: rgba(255,255,255,0.6); /* Borda ativa mais suave para subitem */
}

/* ESTILOS DE MENU EXPANSÍVEL (ACORDEÃO) */
.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.6s ease-out; /* Transição um pouco mais suave */
    background: rgba(0, 0, 0, 0.15); /* Fundo mais escuro para o bloco do submenu */
}
.submenu.open {
    max-height: 5000px; /* Valor bem alto para garantir que nunca corte */
}

/* Seta do Menu Pai */
.sidebar-link .arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.3s;
    opacity: 0.8;
}
.sidebar-link.expanded .arrow {
    transform: rotate(180deg);
}


.sidebar-link i, .sidebar-link .icon {
    min-width: 30px;
    font-size: 18px;
    text-align: center;
    margin-right: 10px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    font-size: 12px;
    color: rgba(255,255,255,0.9);
    background: transparent;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Recolhimento da Sidebar (Desktop) */
.sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
}
.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .sidebar-link span,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .sidebar-logo {
    display: none; /* Esconde textos e logo grande */
}
.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 0;
}
.sidebar.collapsed .sidebar-header::after {
    content: "TI";
    color: white;
    font-weight: bold;
    font-size: 20px;
    letter-spacing: 1px;
}

.sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: 15px 0;
    margin-right: 0; /* Remove margem do efeito ativo */
    border-radius: 0;
}
.sidebar.collapsed .sidebar-link:hover {
    padding-left: 0;
    background-color: rgba(255,255,255,0.2);
}
.sidebar.collapsed .sidebar-link.sub-item {
    padding-left: 0; /* Reseta padding no modo recolhido */
}
.sidebar.collapsed .sidebar-link i, 
.sidebar.collapsed .sidebar-link .icon {
    margin-right: 0;
}
.sidebar.collapsed .arrow {
    display: none;
}

/* Área de Conteúdo Principal */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto; /* Scroll apenas no conteúdo */
    background-color: rgba(244, 247, 246, 0.9); /* Fundo conteúdo levemente transparente para misturar com bg */
    position: relative;
    width: 100%;
}

/* Ajuste no Header Box para o novo layout */
.top-bar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    padding: 15px 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 900;
}

.toggle-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--ita-green);
    margin-right: 15px;
    transition: color 0.2s;
}
.toggle-btn:hover { color: var(--ita-dark-green); }

/* Container Adjustments inside new layout */
.container {
    max-width: 1200px; /* Mais largo para aproveitar o dashboard */
    margin: 20px auto;
    padding: 20px;
    width: 95%;
}

/* Mobile Responsive Sidebar */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%; /* Esconde totalmente */
        height: 100%;
        width: 250px;
    }
    
    .sidebar.mobile-open {
        left: 0;
        box-shadow: 5px 0 15px rgba(0,0,0,0.5);
    }

    /* Overlay escuro quando menu mobile abre */
    .overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        backdrop-filter: blur(2px);
    }
    .overlay.active { display: block; }
}


/* --- ESTILOS ANTIGOS MANTIDOS --- */

/* Cards & Forms */
.card {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    border-top: 5px solid var(--ita-green);
}

h2 { color: var(--ita-green); border-bottom: none; padding-bottom: 0; margin: 0; }

/* Inputs */
.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 5px; font-weight: 600; }
input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Botões */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    color: white;
    text-decoration: none;
    display: inline-block;
}
.btn-success { background-color: var(--ita-green); }
.btn-success:hover { background-color: #006b35; }
.btn-danger { background-color: var(--ita-red); }

/* Tabela */
table { width: 100%; border-collapse: collapse; margin-top: 20px; background: white; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #ddd; }
th { background-color: var(--ita-green); color: white; }
tr:hover { background-color: #f1f1f1; }

.status-debito {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
}
.sim { background-color: #d4edda; color: #155724; }
.nao { background-color: #f8d7da; color: #721c24; }

/* --- NOVOS ESTILOS PARA OS CARDS DA HOME --- */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.module-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    text-decoration: none;
    color: var(--dark-text);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 5px solid var(--ita-green);
}

.module-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.module-icon {
    font-size: 40px;
    background: #f0f7f4;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--ita-green);
}

.module-info h4 {
    margin: 0 0 5px 0;
    font-size: 18px;
    color: var(--ita-dark-green);
}

.module-info p {
    margin: 0;
    font-size: 13px;
    color: #666;
}