/* ================================================================
   REPORT — Editor de relatório ambiental com overlay full-screen
   Estilos do editor contenteditable, toolbar, scene anchors,
   overlay full-screen/split-screen, TOC sidebar, read mode.

   Extraido de constellation.css + novos estilos para a remodelagem
   do modulo de relatorio (2026-02-19).
   ================================================================ */

/* ----------------------------------------------------------------
   EMBEDDED MODE (tab Report no HUD Constellation)
   Container e expansao do HUD quando Report ativo
   ---------------------------------------------------------------- */

.report-editor-container {
    height: 100%;
    overflow-y: auto;
    background: var(--bottom-bg);
    display: flex;
    flex-direction: column;
}

/* Scrollbar visivel no embedded mode */
.report-editor-container::-webkit-scrollbar { width: 6px; }
.report-editor-container::-webkit-scrollbar-track { background: transparent; }
.report-editor-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
.report-editor-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.28);
}
.report-editor-container {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* Report mode: expande painel via custom property (sem !important hack) */
/* Altura controlada por --bottom-panel-height em switchConstellationTab() */

/* Resize handle no topo do HUD expandido */
.report-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    cursor: ns-resize;
    z-index: 20;
    background: transparent;
}
.report-resize-handle:hover,
.report-resize-handle:active {
    background: color-mix(in srgb, var(--bottom-accent) 30%, transparent);
}

/* ----------------------------------------------------------------
   TOOLBAR — Barra de ferramentas de formatacao
   ---------------------------------------------------------------- */

.report-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    background: var(--overlay-medium);
    border-bottom: 1px solid var(--bottom-border);
    flex-shrink: 0;
}

.report-toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 6px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm, 4px);
    color: var(--bottom-text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    gap: 4px;
}
.report-toolbar-btn:hover {
    background: var(--bottom-hover);
    color: var(--bottom-text);
}
.report-toolbar-btn.active {
    background: color-mix(in srgb, var(--bottom-accent) 15%, transparent);
    color: var(--bottom-accent);
    border-color: color-mix(in srgb, var(--bottom-accent) 30%, transparent);
}

.report-toolbar-separator {
    width: 1px;
    height: 16px;
    background: var(--bottom-border);
    margin: 0 4px;
}

/* ----------------------------------------------------------------
   CONTENTEDITABLE — Area editavel do relatorio
   ---------------------------------------------------------------- */

.report-editor-content {
    flex: 1;
    padding: 12px 16px;
    color: var(--bottom-text);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px;
    line-height: 1.6;
    overflow-y: auto;
    outline: none;
    min-height: 0;
}

/* Scrollbar visivel em tema escuro — sem isso, Windows overlay scrollbar fica invisivel */
.report-editor-content::-webkit-scrollbar { width: 8px; }
.report-editor-content::-webkit-scrollbar-track { background: transparent; }
.report-editor-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-md);
}
.report-editor-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
.report-editor-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.report-editor-content:empty::before {
    content: attr(data-placeholder);
    color: var(--bottom-text-faint);
    font-style: italic;
}
.report-editor-content h1,
.report-editor-content h2,
.report-editor-content h3 {
    color: var(--bottom-text);
    margin: 12px 0 6px;
}
.report-editor-content h1 { font-size: 18px; font-weight: 700; }
.report-editor-content h2 { font-size: 15px; font-weight: 600; }
.report-editor-content h3 { font-size: 13px; font-weight: 600; }
.report-editor-content p { margin: 0 0 8px; }
.report-editor-content ul,
.report-editor-content ol { padding-left: 24px; margin: 4px 0; }
.report-editor-content li { margin: 2px 0; }
.report-editor-content b,
.report-editor-content strong { color: var(--bottom-text); font-weight: 700; }

/* Blockquote — citacao com barra lateral */
.report-editor-content blockquote {
    border-left: 3px solid var(--bottom-accent);
    margin: 8px 0;
    padding: 6px 12px;
    color: var(--bottom-text-muted);
    font-style: italic;
    background: color-mix(in srgb, var(--bottom-accent) 5%, transparent);
}

/* Horizontal rule */
.report-editor-content hr {
    border: none;
    border-top: 1px solid var(--bottom-border);
    margin: 16px 0;
}

/* Simple table */
.report-editor-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
    font-size: 12px;
}
.report-editor-content th,
.report-editor-content td {
    border: 1px solid var(--bottom-border);
    padding: 4px 8px;
    text-align: left;
}
.report-editor-content th {
    background: var(--overlay-medium);
    font-weight: 600;
}

/* ----------------------------------------------------------------
   SCENE ANCHOR — Marcador inline de cena 3D
   ---------------------------------------------------------------- */

.report-scene-anchor {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: color-mix(in srgb, var(--bottom-accent) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--bottom-accent) 30%, transparent);
    border-radius: 12px;
    color: var(--bottom-accent);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    vertical-align: middle;
    transition: all 0.15s ease;
}
.report-scene-anchor:hover {
    background: color-mix(in srgb, var(--bottom-accent) 25%, transparent);
    border-color: color-mix(in srgb, var(--bottom-accent) 50%, transparent);
}
.report-scene-anchor--active {
    background: color-mix(in srgb, var(--bottom-accent) 30%, transparent);
    box-shadow: 0 0 6px color-mix(in srgb, var(--bottom-accent) 30%, transparent);
}
.report-scene-anchor--orphan {
    background: rgba(239, 83, 80, 0.15);
    border-color: rgba(239, 83, 80, 0.3);
    color: #EF5350;
}

/* Scene thumbnail tooltip — preview da camera ao hover */
.report-scene-tooltip {
    position: fixed;
    width: 220px;
    padding: 4px;
    background: var(--bottom-bg-solid);
    border: 1px solid var(--bottom-border);
    border-radius: var(--radius-md, 8px);
    box-shadow: var(--shadow-xl);
    z-index: 60;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.report-scene-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}
.report-scene-tooltip img {
    width: 100%;
    border-radius: var(--radius-sm, 4px);
    display: block;
}
.report-scene-tooltip-label {
    padding: 4px 6px 2px;
    font-size: 10px;
    color: var(--bottom-text-muted);
    text-align: center;
}

/* ----------------------------------------------------------------
   SCENE PICKER — Dropdown para selecionar cena
   ---------------------------------------------------------------- */

.report-scene-picker {
    position: absolute;
    background: var(--bottom-bg-solid);
    border: 1px solid var(--bottom-border);
    border-radius: var(--radius-md, 8px);
    padding: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    min-width: 180px;
    box-shadow: var(--shadow-xl);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.report-scene-picker-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    color: var(--bottom-text);
    font-size: 12px;
    border-radius: var(--radius-sm, 4px);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}
.report-scene-picker-item:hover {
    background: var(--bottom-hover);
}
.report-scene-picker-empty {
    padding: 8px 10px;
    color: var(--bottom-text-faint);
    font-size: 11px;
    font-style: italic;
}

/* ----------------------------------------------------------------
   OVERLAY — Full-screen document editor
   Painel full-viewport para edicao focada do relatorio
   ---------------------------------------------------------------- */

.report-overlay {
    position: absolute;
    inset: 0;
    z-index: 18;
    background: var(--bottom-bg);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}
.report-overlay.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Header bar — titulo, botoes de modo, fechar */
.report-overlay-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--overlay-medium);
    border-bottom: 1px solid var(--bottom-border);
    flex-shrink: 0;
    height: 44px;
}

.report-overlay-back {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm, 4px);
    color: var(--bottom-text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}
.report-overlay-back:hover {
    background: var(--bottom-hover);
    color: var(--bottom-text);
}

.report-overlay-title {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    color: var(--bottom-text);
    font-size: 14px;
    font-weight: 600;
    padding: 2px 8px;
    outline: none;
    transition: border-color 0.15s ease;
}
.report-overlay-title:focus {
    border-bottom-color: var(--bottom-accent);
}
.report-overlay-title::placeholder {
    color: var(--bottom-text-faint);
}

.report-overlay-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.report-overlay-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 10px;
    height: 28px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm, 4px);
    color: var(--bottom-text-muted);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.report-overlay-btn:hover {
    background: var(--bottom-hover);
    color: var(--bottom-text);
}
.report-overlay-btn.active {
    background: color-mix(in srgb, var(--bottom-accent) 15%, transparent);
    color: var(--bottom-accent);
    border-color: color-mix(in srgb, var(--bottom-accent) 30%, transparent);
}

/* ----------------------------------------------------------------
   OVERLAY BODY — Area com TOC sidebar + documento
   ---------------------------------------------------------------- */

.report-overlay-body {
    display: flex;
    flex: 1;
    min-height: 0;           /* Permite flex-shrink abaixo do conteudo */
    overflow: hidden;
}

/* Document wrapper — area scrollavel do editor no overlay */
.report-document {
    flex: 1;
    overflow-y: auto;        /* Scroll principal no overlay */
    min-height: 0;
}

/* Scrollbar visivel no overlay */
.report-document::-webkit-scrollbar { width: 8px; }
.report-document::-webkit-scrollbar-track { background: transparent; }
.report-document::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-md);
}
.report-document::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
.report-document {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

/* Quando em overlay mode, editor fica mais espaçoso */
.report-document .report-editor-content {
    padding: 40px 24px;
    max-width: 760px;
    margin: 0 auto;
    width: 100%;
    font-size: 14px;
    line-height: 1.7;
    overflow-y: visible;     /* Scroll delegado ao .report-document pai */
    flex: none;              /* Nao comprimir — conteudo determina altura */
}
.report-document .report-editor-content h1 { font-size: 22px; margin: 20px 0 10px; }
.report-document .report-editor-content h2 { font-size: 17px; margin: 16px 0 8px; }
.report-document .report-editor-content h3 { font-size: 14px; margin: 12px 0 6px; }

/* Scroll progress bar */
.report-progress {
    height: 3px;
    background: var(--bottom-border);
    flex-shrink: 0;
}
.report-progress-bar {
    height: 100%;
    background: var(--bottom-accent);
    width: 0%;
    transition: width 0.1s ease;
}

/* ----------------------------------------------------------------
   TABLE OF CONTENTS — Sidebar auto-gerada dos headings
   ---------------------------------------------------------------- */

.report-toc {
    width: 200px;
    flex-shrink: 0;
    border-right: 1px solid var(--bottom-border);
    padding: 16px 0;
    overflow-y: auto;
    transition: width 0.2s ease, padding 0.2s ease;
}
.report-toc.collapsed {
    width: 0;
    padding: 0;
    overflow: hidden;
    border-right: none;
}

.report-toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px 8px;
    border-bottom: 1px solid var(--bottom-border);
    margin-bottom: 8px;
}
.report-toc-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--bottom-text-faint);
}
.report-toc-toggle {
    background: transparent;
    border: none;
    color: var(--bottom-text-faint);
    cursor: pointer;
    padding: 2px;
    font-size: 12px;
}
.report-toc-toggle:hover { color: var(--bottom-text); }

.report-toc-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 4px 12px;
    background: transparent;
    border: none;
    border-left: 2px solid transparent;
    color: var(--bottom-text-muted);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.12s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.report-toc-item:hover {
    color: var(--bottom-text);
    background: color-mix(in srgb, var(--bottom-hover) 50%, transparent);
}
.report-toc-item.active {
    color: var(--bottom-accent);
    border-left-color: var(--bottom-accent);
}
.report-toc-item[data-level="2"] { padding-left: 24px; }
.report-toc-item[data-level="3"] { padding-left: 36px; }

/* ----------------------------------------------------------------
   SPLIT SCREEN — 3D viewport + Report lado a lado
   ---------------------------------------------------------------- */

.report-overlay.report-split-mode {
    left: 70%;                /* Report ocupa 30% direito da tela */
}

.report-split-divider {
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    z-index: 19;
    background: transparent;
    display: none;
}
.report-split-mode .report-split-divider {
    display: block;
}
.report-split-divider:hover,
.report-split-divider:active {
    background: color-mix(in srgb, var(--bottom-accent) 30%, transparent);
}

/* ----------------------------------------------------------------
   READ MODE — Modo leitura (sem edicao)
   ---------------------------------------------------------------- */

.report-read-mode .report-editor-toolbar {
    display: none;
}
.report-read-mode .report-editor-content {
    cursor: default;
}
.report-read-mode .report-resize-handle {
    display: none;
}

/* Expand button no report tab da constellation */
.report-expand-btn {
    position: absolute;
    top: 4px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm, 4px);
    color: var(--bottom-text-faint);
    font-size: 14px;
    cursor: pointer;
    z-index: 5;
    transition: all 0.15s ease;
}
.report-expand-btn:hover {
    background: var(--bottom-hover);
    color: var(--bottom-text);
    border-color: var(--bottom-border);
}

/* ================================================================
   EXPORT OPTIONS DIALOG
   Modal de opções de exportação (formato PDF/DOCX + seções)
   ================================================================ */

.report-export-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-dialog, 9000);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.report-export-dialog {
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 12px;
    width: 420px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
}

.report-export-header {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    color: var(--text-primary, #1a1a1a);
}

.report-export-group-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary, #666);
    margin-bottom: 0.5rem;
}

.report-export-format-group {
    margin-bottom: 1.2rem;
}

.report-export-radio {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    border-radius: var(--radius-xl);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s;
}
.report-export-radio:hover {
    background: var(--bg-secondary, #f5f5f5);
}
.report-export-radio input[type="radio"] {
    accent-color: var(--accent-color, #3b6bff);
}
.report-export-radio-icon {
    font-size: 1.1rem;
}

.report-export-section-group {
    margin-bottom: 1.2rem;
}

.report-export-toggle-all {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.report-export-link-btn {
    background: none;
    border: none;
    color: var(--accent-color, #3b6bff);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}
.report-export-link-btn:hover {
    opacity: 0.8;
}

.report-export-section-list {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.report-export-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.15s;
}
.report-export-checkbox:hover {
    background: var(--bg-secondary, #f5f5f5);
}
.report-export-checkbox input[type="checkbox"] {
    accent-color: var(--accent-color, #3b6bff);
}

.report-export-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #eee);
}

.report-export-btn {
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius-xl);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
}

.report-export-btn-cancel {
    background: var(--bg-secondary, #f0f0f0);
    color: var(--text-secondary, #666);
    border-color: var(--border-color, #ddd);
}
.report-export-btn-cancel:hover {
    background: var(--bg-tertiary, #e0e0e0);
}

.report-export-btn-export {
    background: var(--accent-color, #3b6bff);
    color: #fff;
}
.report-export-btn-export:hover {
    opacity: 0.9;
}

/* ----------------------------------------------------------------
   METRIC ANCHORS — chips inline para metricas no editor
   ---------------------------------------------------------------- */

.report-metric-anchor {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: color-mix(in srgb, var(--success-accent, #4caf50) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--success-accent, #4caf50) 30%, transparent);
    border-radius: 12px;
    color: var(--success-accent, #4caf50);
    font-size: 11px;
    font-weight: 500;
    cursor: default;
    -webkit-user-select: none;
    user-select: none;
    vertical-align: middle;
    transition: all 0.15s ease;
}
.report-metric-anchor:hover {
    background: color-mix(in srgb, var(--success-accent, #4caf50) 25%, transparent);
    border-color: color-mix(in srgb, var(--success-accent, #4caf50) 50%, transparent);
}

/* Metric Picker Dropdown */
.report-metric-picker {
    background: var(--panel-bg, #1e1e2e);
    border: 1px solid var(--border-color, #333);
    border-radius: var(--radius-xl);
    padding: 4px;
    min-width: 220px;
    max-height: 320px;
    overflow-y: auto;
    z-index: var(--z-dialog, 9000);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.report-metric-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 10px;
    border: none;
    background: transparent;
    color: var(--primary-text, #e0e0e0);
    font-size: 12px;
    text-align: left;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.1s ease;
}
.report-metric-picker-item:hover {
    background: color-mix(in srgb, var(--bottom-accent) 20%, transparent);
}
.report-metric-picker-icon {
    font-size: 14px;
    width: 20px;
    text-align: center;
    color: var(--success-accent, #4caf50);
}

/* Export dialog anchor info banner */
.report-export-anchor-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: color-mix(in srgb, var(--success-accent, #4caf50) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--success-accent, #4caf50) 30%, transparent);
    border-radius: var(--radius-lg);
    color: var(--primary-text, #e0e0e0);
    font-size: 11px;
    margin-bottom: 8px;
}

/* ================================================================
   REPORT TREE VIEW — Lista de relatorios por pastas
   Painel inferior da tab Report no HUD Constellation
   ================================================================ */

.report-tree {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding: 0;
}

/* Scrollbar do tree */
.report-tree::-webkit-scrollbar { width: 6px; }
.report-tree::-webkit-scrollbar-track { background: transparent; }
.report-tree::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
.report-tree::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.28);
}
.report-tree {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* Toolbar — botoes Novo Relatorio + Nova Pasta */
.report-tree-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--bottom-border);
    flex-shrink: 0;
}

.report-tree-toolbar-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    height: 24px;
    background: transparent;
    border: 1px solid var(--bottom-border);
    border-radius: var(--radius-sm, 4px);
    color: var(--bottom-text-muted);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.report-tree-toolbar-btn:hover {
    background: var(--bottom-hover);
    color: var(--bottom-text);
    border-color: var(--bottom-text-muted);
}

/* Tree body — area scrollavel com pastas e relatorios */
.report-tree-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
    min-height: 0;
}

/* ----------------------------------------------------------------
   FOLDER — Pasta na arvore
   ---------------------------------------------------------------- */

.report-tree-folder {
    display: flex;
    flex-direction: column;
}

.report-tree-folder-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background 0.1s ease;
    -webkit-user-select: none;
    user-select: none;
}
.report-tree-folder-header:hover {
    background: var(--bottom-hover);
}

.report-tree-folder-icon {
    width: 12px;
    font-size: var(--text-xs, 10px);
    color: var(--bottom-text-faint);
    transition: transform 0.15s ease;
    text-align: center;
    flex-shrink: 0;
}
.report-tree-folder-icon.expanded {
    transform: rotate(90deg);
}

.report-tree-folder-name {
    flex: 1;
    font-size: 11px;
    font-weight: 600;
    color: var(--bottom-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-tree-folder-name-input {
    flex: 1;
    font-size: 11px;
    font-weight: 600;
    color: var(--bottom-text);
    background: var(--bottom-bg);
    border: 1px solid var(--bottom-accent);
    border-radius: 3px;
    padding: 0 4px;
    outline: none;
}

.report-tree-folder-count {
    font-size: 10px;
    color: var(--bottom-text-faint);
    flex-shrink: 0;
}

.report-tree-folder-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.1s ease;
}
.report-tree-folder-header:hover .report-tree-folder-actions {
    opacity: 1;
}

.report-tree-folder-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: transparent;
    border: none;
    border-radius: 3px;
    color: var(--bottom-text-faint);
    font-size: 10px;
    cursor: pointer;
    padding: 0;
}
.report-tree-folder-action-btn:hover {
    background: var(--bottom-hover);
    color: var(--bottom-text);
}

/* Children container — indentacao por nivel */
.report-tree-children {
    padding-left: 16px;
}
.report-tree-children.collapsed {
    display: none;
}

/* Pasta vazia placeholder */
.report-tree-empty {
    padding: 4px 8px;
    font-size: 10px;
    color: var(--bottom-text-faint);
    font-style: italic;
}

/* ----------------------------------------------------------------
   REPORT ITEM — Relatorio dentro de pasta
   ---------------------------------------------------------------- */

.report-tree-item {
    display: flex;
    flex-direction: column;
    padding: 5px 8px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background 0.1s ease;
    border-left: 3px solid transparent;
    margin: 1px 0;
}
.report-tree-item:hover {
    background: var(--bottom-hover);
}
.report-tree-item.active {
    border-left-color: var(--bottom-accent);
    background: color-mix(in srgb, var(--bottom-accent) 8%, transparent);
}

.report-tree-item-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.report-tree-item-title {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: var(--bottom-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-tree-item-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.1s ease;
    flex-shrink: 0;
}
.report-tree-item:hover .report-tree-item-actions {
    opacity: 1;
}

.report-tree-item-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: transparent;
    border: none;
    border-radius: 3px;
    color: var(--bottom-text-faint);
    font-size: 10px;
    cursor: pointer;
    padding: 0;
}
.report-tree-item-action-btn:hover {
    background: var(--bottom-hover);
    color: var(--bottom-text);
}

.report-tree-item-meta {
    font-size: 10px;
    color: var(--bottom-text-faint);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-tree-item-preview {
    font-size: 11px;
    color: var(--bottom-text-muted);
    margin-top: 2px;
    max-height: 28px;
    overflow: hidden;
    line-height: 1.3;
}

/* ----------------------------------------------------------------
   CONTEXT MENU — Menu de contexto (right-click)
   ---------------------------------------------------------------- */

.report-tree-context-menu {
    position: fixed;
    background: var(--bottom-bg-solid, #1a1a2e);
    border: 1px solid var(--bottom-border);
    border-radius: var(--radius-lg);
    padding: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: var(--z-dialog, 9000);
    min-width: 140px;
}

.report-tree-context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 5px 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--bottom-text);
    font-size: 11px;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s ease;
}
.report-tree-context-menu-item:hover {
    background: var(--bottom-hover);
}
.report-tree-context-menu-item.danger {
    color: #ef5350;
}
.report-tree-context-menu-item.danger:hover {
    background: rgba(239, 83, 80, 0.1);
}
.report-tree-context-menu-separator {
    height: 1px;
    background: var(--bottom-border);
    margin: 3px 4px;
}
