/* ==================================================================================================
   DASHBOARD.CSS - Estilos exclusivos do dashboard (sidebar, busca, gráfico, usinas, etc.)
   ==================================================================================================*/

/* ============================================================
   BLOCO: SIDEBAR (Menu lateral)
   ============================================================ */

.sidebar {
    background-color: var(--bg-sidebar); /* Fundo escuro */
    height: 100vh;
    overflow-y: auto;
    padding: 16px 12px;
    width: 256px;
    transform: translateX(0);
    transition: transform 0.3s ease, width 0.3s ease;
    font-family: 'Inter', sans-serif;
    border-right: 1px solid var(--border);
}

/* Quando recolhida, some da tela */
.sidebar.collapsed {
    transform: translateX(-100%) !important;
    width: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

/* Cabeçalho da sidebar (logo + botão colapso) */
.sidebar .px-6.py-5 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.sidebar.collapsed .px-6.py-5 {
    display: none; /* Esconde cabeçalho quando recolhido */
}

/* Botão de colapso (seta dupla) */
#collapseSidebarBtn {
    color: #94a3b8;
    padding: 4px;
    transition: color 0.2s ease;
    background: transparent;
    border: none;
    cursor: pointer;
}
#collapseSidebarBtn:hover {
    color: #ffffff;
}
#collapseSidebarBtn i {
    width: 18px;
    height: 18px;
}

/* ============================================================
   BLOCO: CATEGORIAS E SUBMENUS (dentro da sidebar)
   ============================================================ */

/* Cada categoria (ex: "Principal", "Usinas") */
.sidebar-category {
    margin-bottom: 10px;
}

/* Cabeçalho da categoria (clicável para expandir) — texto pequeno em
   caixa alta, sem ícone (só as telas dentro da categoria, no submenu,
   mantêm ícone — pedido do usuário pra bater com a referência). */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 1rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.sidebar-header > span > svg:first-child,
.sidebar-header > span > i:first-child { display: none; }
.sidebar-header:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-primary);
}
/* Categoria ativa — azul fixo (não muda com o tema claro/escuro), pedido
   explícito do usuário pra voltar a essa cor em vez do verde/teal da marca. */
.sidebar-header.active-cat {
    background: rgba(59, 130, 246, 0.12);
    border-left-color: #3b82f6;
    color: #3b82f6;
}
.sidebar-header.active-cat svg { color: #3b82f6; }
/* Ícone da categoria ativa ganha um "chip" de fundo, igual ao resto do
   site (modal de usuário, cards de permissões) — antes ficava só o traço
   colorido, sem destaque nenhum comparado ao texto ao lado. */
.sidebar-header.active-cat > span > svg:first-child {
    background: rgba(59, 130, 246, 0.18);
    border-radius: 7px;
    padding: 3px;
    box-sizing: content-box;
    width: 18px !important; height: 18px !important;
}
/* Seta de expansão - gira quando aberto */
.sidebar-header .nav-arrow {
    transition: transform 0.3s ease;
}
.sidebar-header.open .nav-arrow {
    transform: rotate(90deg);
}

/* Submenu (itens dentro da categoria) - colapsável */
.sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    background: rgba(0, 0, 0, 0.2);
    border-left: 3px solid transparent;
}
.sidebar-submenu.open {
    max-height: 1000px;
}
/* A barra teal de categoria ativa (.sidebar-header.active-cat) ficava só na
   linha do cabeçalho e sumia de repente onde o submenu expandido começa —
   dava a impressão de uma linha quebrada/desalinhada no bloco todo. Estende
   a mesma borda pro submenu quando é o da categoria ativa, pra virar uma
   barra contínua do topo até o fim do bloco aberto. */
.sidebar-header.active-cat + .sidebar-submenu.open {
    border-left-color: #3b82f6;
}

/* Item do submenu (ex: "Visão Geral") — pílula arredondada, como um botão.
   Indentação maior (margin-left 20px, antes 8px) pra ficar claro que esses
   itens são "filhos" da categoria acima, não itens do mesmo nível — e
   ícone menor (12px, antes 14px), mais discreto que o texto. */
.submenu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.7rem;
    margin: 1px 8px 1px 20px;
    border-radius: 8px;
    font-size: 0.76rem;
    color: var(--text-muted);
    transition: all 0.2s;
    cursor: pointer;
}
.submenu-item i, .submenu-item svg { width: 12px !important; height: 12px !important; }
.submenu-item:hover {
    /* Azul fixo, mesmo motivo do .active logo abaixo — sem isso, passar o
       mouse mostrava um verde solto no meio de uma sidebar toda azul. */
    background: rgba(59, 130, 246, 0.2);
    color: var(--wcr-tinta);
}
/* Item ativo — pílula azul sólida preenchida (sem risco/barra vertical na
   esquerda — o usuário testou essa variante com barra e preferiu a caixa
   cheia de volta). Mantém o tamanho compacto do resto do submenu. */
.submenu-item.active {
    color: #fff;
    background: #3b82f6;
    font-weight: 600;
}
.submenu-item.active:hover {
    background: #3b82f6;
}

/* Subcategoria aninhada (ex: "Alarmes" dentro de "Operação") */
.sidebar-nested-category {
    margin: 4px 0;
}
.sidebar-nested-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 1rem 0.4rem 1.2rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    font-size: 0.8rem;
    font-weight: 500;
    border-left: 3px solid transparent;
}
.sidebar-nested-header:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}
.sidebar-nested-header.open .nav-arrow {
    transform: rotate(90deg);
}
.sidebar-nested-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}
.sidebar-nested-submenu.open {
    max-height: 200px;
}
.sidebar-nested-submenu .submenu-item {
    padding-left: 2.0rem;
}

/* ============================================================
   BLOCO: LOGOUT (botão de encerrar sessão)
   ============================================================ */

.logout-box {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.6);
}
/* Luz vermelha percorrendo o contorno */
.logout-box::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: conic-gradient(from 0deg, transparent 0deg, transparent 250deg, rgba(239, 68, 68, 0.15) 200deg, rgba(239, 68, 68, 1) 330deg, #ef4444 360deg);
    animation: ledAroundBox 4s linear infinite;
    filter: blur(4px);
    z-index: -2;
}
.logout-box::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: #0f172a;
    z-index: -1;
}
@keyframes ledAroundBox {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.logout-box button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: #ef4444;
    border-radius: 8px;
    transition: background 0.2s ease;
    font-size: 0.875rem;
    cursor: pointer;
}
.logout-box button:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* ============================================================
   BLOCO: MAIN CONTENT (área principal)
   ============================================================ */

.main-content {
    margin-left: 5px;
    /* Sem transição de propósito: animar o margin-left arrastava o
       cabeçalho inteiro (hambúrguer + logo) junto quando a sidebar
       recolhe/expande, dando a impressão de que eles "cresciam" ou se
       moviam. A tentativa anterior de resolver isso com position:fixed
       quebrou o clique do hambúrguer (ele ficava sobreposto errado com a
       sidebar em telas largas) — voltei o botão pro fluxo normal e só
       tirei a animação mesmo: agora a troca é instantânea, sem arrastar. */
    transition: none;
    background: var(--bg-base);
}
.sidebar.collapsed ~ .main-content {
    margin-left: 0 ;
}

/* ============================================================
   BLOCO: CAIXA DE BUSCA GLOBAL (header do dashboard)
   ============================================================ */

/* Input de busca */
#globalSearch {
    height: 44px;
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 44px ;
}
#globalSearch::placeholder {
    color: #4b5563;
}
#globalSearch:focus {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Ícone da lupa (dentro do input) */
#searchContainer [data-lucide="search"] {
    position: absolute;
    left: 14px ;
    top: calc(21px) ;
    transform: translateY(-50%) ;
    width: 18px;
    height: 18px;
    color: #64748b;
    pointer-events: none;
    z-index: 10;
}

/* Botão "X" para limpar a busca */
#clearSearch {
    position: absolute;
    right: 12px ;
    top: calc(21px) ;
    transform: translateY(-50%) ;
    color: #64748b;
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    transition: color 0.2s ease;
    z-index: 10;
}
#clearSearch:hover {
    color: #ffffff;
}

/* Atalho Ctrl+K (ao lado do input) — centralizado no campo de busca (44px de altura),
   não no bloco inteiro (#searchContainer também contém a fileira de filtros abaixo) */
.search-shortcut {
    position: absolute;
    right: 48px ;
    top: 22px ;
    transform: translateY(-50%) ;
    display: flex;
    align-items: center;
    gap: 4px;
    pointer-events: none;
    z-index: 10;
}
.search-shortcut kbd {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 5px;
    padding: 2px 6px;
    font-size: 0.65rem;
    font-family: 'Inter', sans-serif;
    color: #64748b;
}
#globalSearch:focus ~ .search-shortcut {
    display: none;
}

/* Filtros da busca (Todas, Usinas, Telas, etc.) — tudo numa linha só, com scroll
   horizontal discreto se a tela for estreita demais pra caber tudo */
#searchFilterBar {
    display: inline-flex;
    max-width: 100%;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    padding: 4px 8px;
    background: rgba(15, 23, 42, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.06);
    overflow-x: auto;
    scrollbar-width: none;
}
#searchFilterBar::-webkit-scrollbar { display: none; }
#searchFilterBar > * { flex-shrink: 0; }
#searchFilterBar .filter-btn {
    font-size: 0.7.5rem ;
    padding: 4px 14px ;
    border-radius: 999px;
    font-weight: 500;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    border: 1px solid transparent;
}
#searchFilterBar .filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}
#searchFilterBar .filter-btn.bg-blue-600 {
    background: #2563eb ;
    color: #ffffff ;
    border-color: #3b82f6;
}
#searchFilterBar span {
    font-size: 0.6rem;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-right: 4px;
}

/* ============================================================
   BLOCO: RESULTADOS DA BUSCA (dropdown)
   ============================================================ */

#searchResults {
    animation: searchFadeIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes searchFadeIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Cada item de resultado */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px ;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    border-left: 3px solid transparent;
}
.search-result-item:last-child {
    border-bottom: none;
}
.search-result-item:hover {
    background: rgba(59, 130, 246, 0.12) ;
    border-left-color: #3b82f6;
    transform: translateX(4px);
    box-shadow: inset 0 0 20px rgba(59, 130, 246, 0.05);
}

/* Ícone do resultado */
.search-result-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
    transition: all 0.2s ease;
}
.search-result-item:hover .search-result-icon {
    transform: scale(1.05);
}
/* Cores por tipo */
.search-result-icon.usina { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.search-result-icon.os { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.search-result-icon.estoque { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.search-result-icon.menu { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }

/* Título e descrição do resultado */
.search-result-info h4 {
    font-size: 0.9rem ;
    font-weight: 600 ;
    color: #f1f5f9 ;
    margin-bottom: 2px;
}
.search-result-info p {
    font-size: 0.75rem ;
    color: #64748b ;
}

/* Badge do tipo */
.search-result-type {
    margin-left: auto;
    font-weight: 700 ;
    letter-spacing: 0.08em ;
    padding: 4px 12px ;
    border-radius: 20px ;
    font-size: 0.6rem ;
    flex-shrink: 0;
}
.search-result-type.usina { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.2); }
.search-result-type.menu { background: rgba(139, 92, 246, 0.2); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.2); }
.search-result-type.os { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.2); }
.search-result-type.estoque { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.2); }
.search-result-type.drawer { background: rgba(236, 72, 153, 0.2); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.2); }

/* Mensagem "nenhum resultado" */
.search-no-results {
    padding: 32px 16px ;
    text-align: center;
    color: #475569;
}
.search-no-results i[data-lucide] { opacity: 0.4; }
.search-no-results strong { color: #94a3b8; font-weight: 600; }

/* Cabeçalho da categoria de resultados */
.search-category-header {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.03) ;
    font-size: 0.6rem ;
    color: #64748b ;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    border-top: 1px solid rgba(148, 163, 184, 0.08);
}
.search-category-header i[data-lucide] { color: #3b82f6; opacity: 0.6; }

/* Destaque do termo buscado */
.search-highlight {
    background: rgba(59, 130, 246, 0.35) ;
    color: #93c5fd ;
    font-weight: 700 ;
    padding: 2px 6px ;
    border-radius: 4px ;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ============================================================
   BLOCO: GRÁFICO (CHART.JS) - Visão Geral
   ============================================================ */

#geracaoChart {
    width: 100% !important;
    height: 280px !important;
    min-height: 280px;
    max-height: 280px;
    display: block !important;
}

/* ============================================================
   BLOCO: SPINNER DE LOADING
   ============================================================ */

#loadingSpinner {
    transition: opacity 0.3s ease;
    opacity: 0;
}
#loadingSpinner:not(.hidden) {
    display: flex !important;
    opacity: 1;
}

/* ============================================================
   BLOCO: USINAS (seção de usinas)
   ============================================================ */

#section-usinas {
    padding: 0.5rem 0 1.5rem;
}

/* Botões das abas de usinas */
#usinaTabButtons {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}
.usina-tab-btn {
    width: 100%;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 0.7rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.95), rgba(10, 15, 28, 0.95));
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.25s ease;
}
.usina-tab-btn:hover {
    border-color: rgba(59, 130, 246, 0.45);
    color: white;
}
.usina-tab-btn.active {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: white;
    border-color: #60a5fa;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.24);
}

/* Card de cada usina (painel) */
.usina-panel-card {
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 24px;
    padding: 24px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.80)), radial-gradient(circle at top right, rgba(59, 130, 246, 0.16), transparent 40%);
    box-shadow: 0 20px 45px rgba(2, 6, 23, 0.35);
    backdrop-filter: blur(14px);
}

/* Cabeçalho do painel da usina */
.usina-panel-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}
.usina-panel-icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.24), rgba(6, 182, 212, 0.16));
    border: 1px solid rgba(96, 165, 250, 0.28);
    box-shadow: inset 0 0 18px rgba(255,255,255,0.04);
}

/* Badge de status da usina */
.usina-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.usina-badge-ok { background: rgba(16, 185, 129, 0.12); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.25); }
.usina-badge-warning { background: rgba(245, 158, 11, 0.12); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.25); }
.usina-badge-danger { background: rgba(239, 68, 68, 0.12); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.25); }

/* Grid de métricas da usina */
.usina-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.usina-metric-card {
    background: rgba(2, 6, 23, 0.48);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 16px;
    padding: 14px;
}
.usina-metric-card span {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin-bottom: 6px;
}
.usina-metric-card strong {
    color: white;
    font-size: 1rem;
    font-weight: 700;
}

/* Barra de progresso da disponibilidade */
.usina-progress-block {
    margin-bottom: 16px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(2, 6, 23, 0.48);
    border: 1px solid rgba(148, 163, 184, 0.14);
}
.usina-progress-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: #e2e8f0;
    font-size: 0.95rem;
    font-weight: 600;
}
.usina-progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
    overflow: hidden;
}
.usina-progress-fill {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #22c55e, #3b82f6);
}

/* Grid inferior (informações operacionais e manutenção) */
.usina-bottom-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.usina-info-card {
    padding: 14px;
    border-radius: 16px;
    background: rgba(2, 6, 23, 0.48);
    border: 1px solid rgba(148, 163, 184, 0.14);
}
.usina-info-card h4 {
    color: white;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 10px;
}
.usina-info-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.75;
}

/* ============================================================
   BLOCO: NAV DROPDOWN (menu suspenso do header)
   ============================================================ */

.nav-dropdown {
    position: absolute;
    top: 70px;
    right: 20px;
    width: 90%;
    max-width: 420px;
    background: rgba(19, 26, 46, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.5);
    z-index: 60;
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}
.nav-dropdown.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Painéis do dropdown (lista e detalhes) */
.dropdown-pane {
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.dropdown-pane.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
    position: relative;
}
.dropdown-pane.inactive-left {
    opacity: 0;
    transform: translateX(-30px);
    pointer-events: none;
    position: absolute;
    top: 24px;
    left: 24px;
    right: 24px;
}
.dropdown-pane.inactive-right {
    opacity: 0;
    transform: translateX(30px);
    pointer-events: none;
    position: absolute;
    top: 24px;
    left: 24px;
    right: 24px;
}

/* ============================================================
   BLOCO: DRAWER (painel lateral informativo)
   ============================================================ */

.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.10);
    opacity: 0;
    pointer-events: none;
    transition: opacity 450ms cubic-bezier(0.22, 1, 0.36, 1);
}
.drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.drawer-panel {
    position: fixed;
    top: 16px;
    right: 16px;
    bottom: 16px;
    width: 420px;
    background: rgba(10, 18, 35, 0.93);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateX(110%);
    transition: transform 450ms cubic-bezier(0.22, 1, 0.36, 1);
}
.drawer-overlay.open .drawer-panel {
    transform: translateX(0);
    /* sombra só aberto: fechado o painel fica fora da tela e a sombra vazava na borda */
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.45);
}

/* Animação de entrada dos itens do drawer */
.drawer-item {
    opacity: 0;
    transform: translateY(15px);
}
.drawer-overlay.open .drawer-item {
    animation: drawerFadeIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.drawer-overlay.open .drawer-item:nth-child(1) { animation-delay: 0.1s; }
.drawer-overlay.open .drawer-item:nth-child(2) { animation-delay: 0.2s; }
.drawer-overlay.open .drawer-item:nth-child(3) { animation-delay: 0.3s; }
.drawer-overlay.open .drawer-item:nth-child(4) { animation-delay: 0.4s; }
.drawer-overlay.open .drawer-item:nth-child(5) { animation-delay: 0.5s; }
@keyframes drawerFadeIn {
    to { opacity: 1; transform: translateY(0); }
}

/* Efeito ripple (bolinha ao clicar) */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0);
    animation: rippleEffect 0.6s ease-out;
    pointer-events: none;
}
@keyframes rippleEffect {
    to { transform: scale(4); opacity: 0; }
}

/* ============================================================
   BLOCO: OUTROS COMPONENTES DO DASHBOARD
   ============================================================ */

/* .top-glow: efeito de brilho no topo do dashboard removido a pedido
   (deixava cara de gerado por IA) — classe mantida vazia por compatibilidade. */
.top-glow {}

/* Header do dashboard (fixo) */
.dashboard-header {
    background: rgba(10, 15, 30, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 0.5 rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Avatar do perfil */
.profile-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, #3b82f6, #1e3a8a);
}

/* Breadcrumb (localização) */
#breadcrumb {
    font-size: 0.75rem;
    color: #64748b;
}

/* Animação de entrada dos cards (cascata). Sem opacity:0 de propósito —
   essa animação é reiniciada (classe tirada/recolocada) toda vez que a
   pessoa troca de seção, e clicando rápido o suficiente entre seções o
   card ficava preso no frame inicial (invisível) reinicialização atrás de
   reinicialização. Só o deslize (translateY) anima; opacity fica sempre 1,
   então o card nunca fica invisível, não importa quantas vezes a animação
   for cortada no meio. */
.card-animated {
    opacity: 1;
    transform: translateY(20px);
    animation: cardFadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes cardFadeInUp {
    from { opacity: 1; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.card-animated:nth-child(1) { animation-delay: 0.05s; }
.card-animated:nth-child(2) { animation-delay: 0.10s; }
.card-animated:nth-child(3) { animation-delay: 0.15s; }
.card-animated:nth-child(4) { animation-delay: 0.20s; }
.card-animated:nth-child(5) { animation-delay: 0.25s; }
.card-animated:nth-child(6) { animation-delay: 0.30s; }
.card-animated:nth-child(7) { animation-delay: 0.35s; }
.card-animated:nth-child(8) { animation-delay: 0.40s; }

/* Cards de atalho (hover) */
.card-shortcut {
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.card-shortcut:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px -8px rgba(59, 130, 246, 0.2);
}

/* Placeholder do gráfico (pulso) */
.graph-placeholder {
    animation: graphPulse 2s ease-in-out infinite;
}
@keyframes graphPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, rgba(30,41,59,0.5) 25%, rgba(51,65,85,0.7) 50%, rgba(30,41,59,0.5) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: 8px;
}
@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-card {
    height: 120px;
    border-radius: 12px;
}
.skeleton-line {
    height: 12px;
    margin-bottom: 8px;
    border-radius: 4px;
}

/* ==================================================================================================
   CORES DO DASHBOARD = CORES DO SITE PÚBLICO (operador e cliente)
   O dashboard é montado quase todo com classes utilitárias Tailwind (bg-slate-900, text-white etc.)
   e cores fixas — nada disso troca sozinho com o tema. Este bloco reescreve essas mesmas
   classes/seletores usando as variáveis --wcr-* (as mesmas do site público, definidas em global.css),
   então claro/escuro/alto contraste do dashboard viram automaticamente os mesmos do site público.
   Fica só ativo dentro do dashboard (body.modo-painel); o resto do site não é afetado.
   ================================================================================================== */

/* Fundos escuros/claros fixos (Tailwind) -> superfície de "card" do tema atual */
body.modo-painel [class~="bg-slate-950"],
body.modo-painel [class~="bg-slate-900"],
body.modo-painel [class~="bg-slate-900/40"],
body.modo-painel [class~="bg-slate-900/50"],
body.modo-painel [class~="bg-slate-900/60"],
body.modo-painel [class~="bg-slate-900/70"],
body.modo-painel [class~="bg-slate-900/95"] {
    background-color: var(--wcr-card);
}
body.modo-painel [class~="bg-slate-800"],
body.modo-painel [class~="bg-slate-800/50"],
body.modo-painel [class~="bg-slate-800/60"] {
    background-color: var(--wcr-papel);
}
body.modo-painel [class~="bg-slate-700"],
body.modo-painel [class~="bg-slate-700/50"],
body.modo-painel [class~="bg-slate-600"],
body.modo-painel [class~="bg-slate-600/50"],
body.modo-painel [class~="bg-slate-500"] {
    background-color: var(--wcr-papel-2);
}

/* Bordas fixas -> borda do tema atual */
body.modo-painel [class~="border-slate-800"],
body.modo-painel [class~="border-slate-700"],
body.modo-painel [class~="border-slate-700/50"],
body.modo-painel [class~="border-slate-700/60"] {
    border-color: var(--wcr-linha);
}

/* Texto claro/escuro fixo -> texto principal do tema atual */
body.modo-painel [class~="text-white"],
body.modo-painel [class~="text-slate-100"],
body.modo-painel [class~="text-slate-200"],
body.modo-painel [class~="text-slate-300"] {
    color: var(--wcr-tinta);
}
/* Texto secundário -> mesmo tom do tema atual */
body.modo-painel [class~="text-slate-400"],
body.modo-painel [class~="text-slate-500"],
body.modo-painel [class~="text-slate-600"] {
    color: var(--wcr-tinta-2);
}
body.modo-painel [class~="placeholder-slate-500"]::placeholder {
    color: var(--wcr-tinta-2);
}

/* Componentes com cor fixa no CSS (não são classes Tailwind) */
body.modo-painel #collapseSidebarBtn { color: var(--wcr-tinta-2); }
body.modo-painel #collapseSidebarBtn:hover { color: var(--wcr-verde); }
body.modo-painel .sidebar-header.active-cat {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
}
body.modo-painel .sidebar-header:hover,
body.modo-painel .sidebar-nested-header:hover {
    background: var(--wcr-papel-2);
}
body.modo-painel .logout-box { background: var(--wcr-card); border-color: rgba(220, 38, 38, .3); }
body.modo-painel .logout-box::after { background: var(--wcr-card); }
body.modo-painel #globalSearch::placeholder,
body.modo-painel #searchContainer [data-lucide="search"],
body.modo-painel #clearSearch,
body.modo-painel .search-shortcut kbd,
body.modo-painel #searchFilterBar span,
body.modo-painel #breadcrumb,
body.modo-painel .search-result-info p,
body.modo-painel .search-no-results,
body.modo-painel .usina-metric-card span,
body.modo-painel .usina-info-card ul {
    color: var(--wcr-tinta-2);
}
body.modo-painel .search-shortcut kbd { background: var(--wcr-papel-2); border-color: var(--wcr-linha); }
body.modo-painel #clearSearch:hover { color: var(--wcr-verde); }
body.modo-painel #searchFilterBar {
    background: var(--wcr-papel);
    border-color: var(--wcr-linha);
}
body.modo-painel #searchFilterBar .filter-btn {
    background: var(--wcr-papel-2);
    color: var(--wcr-tinta-2);
}
body.modo-painel #searchFilterBar .filter-btn:hover {
    background: var(--wcr-linha);
    color: var(--wcr-tinta);
}
body.modo-painel #searchResults {
    background: var(--wcr-card);
}
body.modo-painel .search-category-header { background: var(--wcr-papel); color: var(--wcr-tinta-2); }
body.modo-painel .search-result-info h4 { color: var(--wcr-tinta); }
body.modo-painel .search-no-results strong { color: var(--wcr-tinta-2); }
body.modo-painel .usina-tab-btn {
    background: var(--wcr-card);
    border-color: var(--wcr-linha);
    color: var(--wcr-tinta-2);
}
body.modo-painel .usina-panel-card {
    background: var(--wcr-card);
    border-color: var(--wcr-linha);
    box-shadow: var(--wcr-sombra);
}
body.modo-painel .usina-metric-card,
body.modo-painel .usina-progress-block,
body.modo-painel .usina-info-card {
    background: var(--wcr-papel);
    border-color: var(--wcr-linha);
}
body.modo-painel .usina-metric-card strong,
body.modo-painel .usina-info-card h4,
body.modo-painel .usina-progress-row {
    color: var(--wcr-tinta);
}
body.modo-painel .usina-progress-bar { background: var(--wcr-linha); }
body.modo-painel .nav-dropdown { background: var(--wcr-card); box-shadow: var(--wcr-sombra); }
body.modo-painel .drawer-panel { background: color-mix(in srgb, var(--wcr-card) 97%, transparent); border-color: var(--wcr-linha); }
body.modo-painel .dashboard-header { background: color-mix(in srgb, var(--wcr-card) 92%, transparent); }
body.modo-painel #clientView { background: var(--wcr-papel) !important; color: var(--wcr-tinta); }
/* Painel do cliente: mesma tipografia serifada dos títulos do site público
   (pedido do Walquir 18/09 — "ficar igual ao que já está no site"). O sistema
   de cores (--wcr-*) já era compartilhado no tema claro; faltava só isso. */
body.modo-painel #clientUsina,
body.modo-painel .usina-panel-header h3,
body.modo-painel .usina-info-card h4 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
}
.skeleton-line:last-child { width: 60%; }