/* DRE MODULAR - ESTILOS GERAIS & ARQUITETURA DE GAVETAS */
.dre-mod-container {
    padding: 24px 32px;
    background-color: #f8fafc;
    min-height: calc(100vh - 64px);
    box-sizing: border-box;
}

/* Header */
.dre-mod-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.dre-mod-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.dre-mod-brand-text h1 {
    font-size: 1.45rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    line-height: 1.2;
}

.dre-mod-brand-text .sub-brand {
    font-size: 0.82rem;
    color: #64748b;
    font-weight: 500;
}

.dre-mod-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Toolbar de Filtros */
.dre-mod-toolbar {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.dre-mod-filters-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.dre-mod-filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dre-mod-filter-item label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.dre-mod-filter-item select,
.dre-mod-filter-item input[type="date"] {
    height: 36px;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background-color: #f8fafc;
    color: #1e293b;
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    transition: all 0.2s;
}

.dre-mod-filter-item select:focus,
.dre-mod-filter-item input[type="date"]:focus {
    border-color: #3b82f6;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.select-model-highlight {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    min-width: 240px;
    height: 36px;
    padding: 0 36px 0 13px;
    border-radius: 9px;
    border: 1.5px solid #93c5fd !important;
    background-color: #eff6ff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231d4ed8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 15px 15px;
    font-size: 0.85rem;
    font-weight: 800 !important;
    color: #1e3a8a !important;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.10);
    transition: all 0.18s ease;
    outline: none;
}

.select-model-highlight:hover {
    background-color: #dbeafe !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.16);
}

.select-model-highlight:focus {
    background-color: #ffffff !important;
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

/* Tabela Principal com rolagem horizontal fixa no pé da tela + coluna/cabeçalho congelados */
.dre-mod-card-table {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: auto;
    max-height: calc(100vh - 215px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    scrollbar-gutter: stable;
}

.dre-mod-card-table::-webkit-scrollbar {
    width: 10px;
    height: 11px;
}

.dre-mod-card-table::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 8px;
}

.dre-mod-card-table::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 8px;
    border: 2px solid #f1f5f9;
}

.dre-mod-card-table::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.dre-mod-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.84rem;
    text-align: left;
    white-space: nowrap;
}

.dre-mod-table th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #f1f5f9;
    color: #334155;
    font-weight: 700;
    padding: 12px 14px;
    border-bottom: 2px solid #cbd5e1;
    border-right: 1px solid #e2e8f0;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dre-mod-table th:first-child {
    position: sticky;
    left: 0;
    top: 0;
    z-index: 8;
    background: #f1f5f9;
    box-shadow: 3px 0 6px -2px rgba(15, 23, 42, 0.12);
}

.dre-mod-table th:last-child {
    border-right: none;
}

.dre-mod-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

.dre-mod-table tbody td:first-child {
    position: sticky !important;
    left: 0;
    z-index: 3;
    background-color: #ffffff;
    box-shadow: 3px 0 6px -2px rgba(15, 23, 42, 0.08);
}

.dre-mod-table td:last-child {
    border-right: none;
}

.dre-mod-table tbody tr:hover td,
.dre-mod-table tbody tr:hover td:first-child {
    background-color: #f8fafc;
}

/* Linhas de Gavetas & Hierarquia Visual Clara */
.dre-line-code-txt {
    font-size: 0.74rem;
    color: #64748b;
    font-family: monospace;
    min-width: 30px;
    flex-shrink: 0;
}

.dre-line-title-txt {
    font-size: 0.86rem;
}

.dre-drawer-count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    color: #475569;
    background: #e2e8f0;
    padding: 1px 6px;
    border-radius: 999px;
    margin-left: 4px;
    line-height: 1.3;
}

.tr-drawer-parent td,
.tr-drawer-parent td:first-child {
    background-color: #f8fafc;
    font-weight: 700;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

/* Gaveta ABERTA: destaque azul na borda esquerda e cabeçalho suave */
.tr-drawer-parent.is-expanded:not(.tr-custom-color) td,
.tr-drawer-parent.is-expanded:not(.tr-custom-color) td:first-child {
    background-color: #eff6ff;
    border-top: 1px solid #bfdbfe;
    border-bottom: 1px solid #bfdbfe;
}

.tr-drawer-parent.is-expanded td:first-child {
    box-shadow: inset 4px 0 0 #0A58CA, 3px 0 6px -2px rgba(15, 23, 42, 0.10);
}

.tr-drawer-parent.is-expanded .dre-drawer-count-pill {
    background: #dbeafe;
    color: #1d4ed8;
}

.tr-drawer-parent.is-expanded .btn-drawer-toggle {
    background: #dbeafe;
    color: #0A58CA;
}

/* Sub-gaveta (Nível 1 dentro de uma gaveta pai) */
.tr-drawer-parent.drawer-depth-1:not(.tr-custom-color) td,
.tr-drawer-parent.drawer-depth-1:not(.tr-custom-color) td:first-child {
    background-color: #f1f5f9;
}

.tr-drawer-parent.drawer-depth-1 td:first-child {
    box-shadow: inset 4px 0 0 #6366f1, 3px 0 6px -2px rgba(15, 23, 42, 0.08);
}

.tr-drawer-parent.drawer-depth-1.is-expanded:not(.tr-custom-color) td,
.tr-drawer-parent.drawer-depth-1.is-expanded:not(.tr-custom-color) td:first-child {
    background-color: #eef2ff;
    border-bottom: 1px solid #c7d2fe;
}

/* Sublinhas folha dentro de gavetas (Nível 1, 2, 3) */
.tr-drawer-child td,
.tr-drawer-child td:first-child {
    background-color: #fafcff;
}

.tr-drawer-child.drawer-depth-1 td:first-child {
    box-shadow: inset 4px 0 0 #93c5fd, 3px 0 6px -2px rgba(15, 23, 42, 0.06);
}

.tr-drawer-child.drawer-depth-2 td:first-child,
.tr-drawer-child.drawer-depth-3 td:first-child {
    background-color: #f8fafc;
    box-shadow: inset 4px 0 0 #a5b4fc, 3px 0 6px -2px rgba(15, 23, 42, 0.06);
}

.tr-drawer-child .dre-line-title-txt {
    font-size: 0.80rem !important;
    font-weight: 500 !important;
    color: #475569 !important;
}

.tr-drawer-child .cell-val-primary {
    font-size: 0.80rem;
    font-weight: 500;
}

.tr-drawer-child.drawer-depth-2 .dre-line-title-txt,
.tr-drawer-child.drawer-depth-3 .dre-line-title-txt {
    font-size: 0.78rem !important;
    color: #64748b !important;
}

.tr-drawer-summary td,
.tr-drawer-summary td:first-child {
    background-color: #f1f5f9;
    font-weight: 800;
    border-top: 2px solid #cbd5e1;
    border-bottom: 2px solid #cbd5e1;
    color: #0f172a;
}

/* Indentação de Gavetas com conectores de árvore */
.cell-title-box {
    display: flex;
    align-items: center;
    gap: 7px;
}

.drawer-indent-level-0 {
    padding-left: 10px !important;
}

.drawer-indent-level-1 {
    padding-left: 34px !important;
    position: relative;
}

.drawer-indent-level-1::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #bfdbfe;
}

.drawer-indent-level-1::after {
    content: '';
    position: absolute;
    left: 18px;
    top: 50%;
    width: 12px;
    height: 1px;
    background: #93c5fd;
}

.drawer-indent-level-2 {
    padding-left: 56px !important;
    position: relative;
}

.drawer-indent-level-2::before {
    content: '';
    position: absolute;
    left: 38px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #c7d2fe;
}

.drawer-indent-level-2::after {
    content: '';
    position: absolute;
    left: 38px;
    top: 50%;
    width: 12px;
    height: 1px;
    background: #a5b4fc;
}

/* Botão Toggle da Gaveta */
.btn-drawer-toggle {
    background: none;
    border: none;
    padding: 2px 4px;
    cursor: pointer;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s;
}

.btn-drawer-toggle:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

.btn-drawer-toggle svg {
    transition: transform 0.2s;
}

.btn-drawer-toggle.collapsed svg {
    transform: rotate(-90deg);
}

/* Badges de Natureza */
.badge-natureza {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: inline-block;
}

.badge-natureza-receita {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.badge-natureza-deducao,
.badge-natureza-custo,
.badge-natureza-despesa {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.badge-natureza-margem,
.badge-natureza-total {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.badge-natureza-info {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

/* Células de Valores & Percentuais */
.cell-val-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.cell-val-primary {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #0f172a;
}

.cell-val-deduct {
    color: #dc2626;
}

/* Toolbar Moderna em 2 Linhas */
.dre-mod-toolbar-v2 {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    padding: 12px 16px !important;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.dre-mod-toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.dre-mod-toolbar-filters {
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
    justify-content: flex-start;
    align-items: flex-end;
}

.dre-mod-model-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.dre-mod-lbl-inline {
    font-size: 0.74rem;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dre-mod-btn-group,
.dre-mod-view-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.dre-mod-view-controls .btn {
    font-size: 0.75rem;
    padding: 5px 10px;
    height: 32px;
}

.dre-mod-quick-periods {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 3px;
    gap: 3px;
    height: 36px;
}

.dre-period-pill {
    border: none;
    background: transparent;
    color: #475569;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.dre-period-pill:hover {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.7);
}

.dre-period-pill.active {
    background: #0f172a;
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
}

.dre-mod-compare-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #1e293b;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.dre-mod-compare-pill:has(input:checked) {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
}

.dre-mod-compare-pill input {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: #2563eb;
}

/* Cabeçalho Agrupado em 2 Níveis (Banner do Mês + Subcolunas) */
.dre-mod-table thead tr.dre-mod-thead-group th {
    position: sticky;
    top: 0;
    z-index: 6;
    padding: 7px 12px;
    font-size: 0.74rem;
    font-weight: 800;
    text-align: center;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #cbd5e1;
    background: #e2e8f0;
    color: #0f172a;
}

.dre-mod-table thead tr.dre-mod-thead-group th.th-group-alt {
    background: #cbd5e1 !important;
    color: #0f172a !important;
}

.dre-mod-table thead tr.dre-mod-thead-group th.th-group-total {
    background: #1e3a8a !important;
    color: #ffffff !important;
}

.dre-mod-table thead tr.dre-mod-thead-sub th {
    position: sticky;
    top: 31px;
    z-index: 5;
    padding: 8px 10px;
    font-size: 0.70rem;
    font-weight: 700;
    border-bottom: 2px solid #94a3b8;
}

.dre-mod-table thead tr.dre-mod-thead-group th:first-child {
    left: 0;
    z-index: 9;
    text-align: left;
    vertical-align: middle;
    background: #f1f5f9 !important;
    border-bottom: 2px solid #94a3b8;
    box-shadow: 3px 0 6px -2px rgba(15, 23, 42, 0.14);
}

/* Distinção visual limpa: AV % (texto neutro) vs Variação (pílula ▲/▼) */
.cell-av-pct {
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #475569;
}

.cell-av-pct.av-neg {
    color: #991b1b;
}

.cell-av-pct.av-pos {
    color: #1e293b;
}

.cell-av-pct.av-zero {
    color: #94a3b8;
}

/* Separação visual clara entre blocos de meses e Total */
.dre-mod-table thead th.col-grp-start {
    border-left: 3px solid #94a3b8 !important;
}

.dre-mod-table tbody td.col-grp-start {
    border-left: 3px solid #cbd5e1 !important;
}

.dre-mod-table thead th.col-grp-alt {
    background-color: #e2e8f0 !important;
}

.dre-mod-table tbody tr:not(.tr-custom-color):not(.tr-drawer-summary) td.col-grp-alt {
    background-color: #f8fafc;
}

.dre-mod-table thead th.col-grp-total {
    background-color: #dbeafe !important;
    color: #1e3a8a !important;
}

.dre-mod-table tbody tr:not(.tr-custom-color) td.col-grp-total {
    background-color: rgba(239, 246, 255, 0.55);
}

.th-col-compare-prev {
    color: #64748b !important;
    font-size: 0.72rem !important;
}

.cell-val-prev {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    color: #64748b;
    font-size: 0.80rem;
}

.th-col-var {
    background: #eef2ff !important;
    color: #4338ca !important;
    font-size: 0.70rem !important;
    padding: 12px 8px !important;
    border-right: 1px solid #e2e8f0 !important;
}

.td-col-var {
    padding: 8px 8px !important;
    border-right: 1px solid #f1f5f9 !important;
}

.th-col-percent {
    color: #475569 !important;
    font-size: 0.72rem !important;
    padding: 12px 10px !important;
}

.td-col-percent {
    padding: 8px 10px !important;
}

/* Linha pintada com cor RGB personalizada */
.dre-mod-table tbody tr.tr-custom-color td,
.dre-mod-table tbody tr.tr-custom-color td:first-child,
.dre-mod-table tbody tr.tr-custom-color td.td-col-var,
.dre-mod-table tbody tr.tr-custom-color td.td-col-percent,
.dre-mod-table tbody tr.tr-custom-color:hover td,
.dre-mod-table tbody tr.tr-custom-color:hover td:first-child {
    background-color: var(--dre-row-bg) !important;
}

.dre-mod-table tbody tr.tr-custom-color.tr-custom-dark td,
.dre-mod-table tbody tr.tr-custom-color.tr-custom-dark td span:not(.cell-val-percent) {
    color: #ffffff !important;
}

/* Lançamentos Manuais na Gaveta */
.dre-manual-tag {
    display: inline-flex;
    align-items: center;
    font-size: 0.64rem;
    font-weight: 800;
    color: #4338ca;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    padding: 1px 6px;
    border-radius: 999px;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.btn-drawer-quick-manual {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 6px;
    border-radius: 5px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    opacity: 0.72;
    transition: all 0.15s ease;
}

.btn-drawer-quick-manual:hover {
    opacity: 1;
    background: #1d4ed8;
    color: #ffffff;
    border-color: #1d4ed8;
}

.td-manual-clickable {
    cursor: pointer !important;
    transition: background-color 0.14s ease;
}

.td-manual-clickable:hover {
    background-color: #eff6ff !important;
}

.td-manual-clickable .cell-val-primary {
    border-bottom: 1px dashed #93c5fd;
    padding-bottom: 1px;
}

.dre-manual-title-link {
    cursor: pointer;
}

.dre-manual-title-link:hover {
    text-decoration: underline;
    color: #1d4ed8 !important;
}

/* Células clicáveis de Drill-Down (Conta Contábil / COI) */
.td-drill-clickable {
    cursor: pointer !important;
    transition: background-color 0.14s ease;
}

.td-drill-clickable:hover {
    background-color: #dbeafe !important;
}

.td-drill-clickable:hover .cell-val-primary,
.td-drill-clickable:hover .cell-val-prev {
    text-decoration: underline;
}

/* Modal de Detalhamento Analítico (Raio-X Executivo) */
.dre-drill-modal-shell {
    max-width: 1180px;
    width: 96%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 25px 60px -12px rgba(15, 23, 42, 0.50);
    border: none;
    background: #f8fafc;
}

.dre-drill-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dre-drill-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dre-drill-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.22);
    border: 1px solid rgba(147, 197, 253, 0.35);
    color: #93c5fd;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dre-drill-type-badge {
    font-size: 0.66rem;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 999px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.dre-drill-close-btn {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.dre-drill-close-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(248, 113, 113, 0.5);
    color: #ffffff;
}

.dre-drill-body {
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
    flex: 1;
    background: #f8fafc;
}

.dre-drill-kpi-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.dre-drill-kpi {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 11px 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.dre-drill-kpi-lbl {
    display: block;
    font-size: 0.67rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dre-drill-kpi-val {
    display: block;
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    margin-top: 3px;
    font-variant-numeric: tabular-nums;
}

.dre-drill-breakdown-grid {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 10px;
}

.dre-drill-breakdown-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 13px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

.dre-drill-bk-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #f1f5f9;
}

.dre-drill-bk-head span {
    font-size: 0.72rem;
    font-weight: 800;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dre-drill-bk-head small {
    font-size: 0.68rem;
    color: #94a3b8;
    font-weight: 600;
}

.dre-drill-bk-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 112px;
    overflow-y: auto;
}

.dre-drill-bk-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 4px 6px;
    border-radius: 7px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.14s ease;
}

.dre-drill-bk-row:hover {
    background: #f1f5f9;
}

.dre-drill-bk-row.active {
    background: #eff6ff;
    border-color: #93c5fd;
}

.dre-drill-bk-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
}

.dre-drill-bk-name {
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dre-drill-bk-val {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.dre-drill-bk-bar-bg {
    height: 4px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.dre-drill-bk-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb 0%, #3b82f6 100%);
}

.dre-drill-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.dre-drill-search-wrap {
    flex: 1;
    min-width: 240px;
    position: relative;
    display: flex;
    align-items: center;
}

.dre-drill-search-wrap svg {
    position: absolute;
    left: 11px;
    pointer-events: none;
}

.dre-drill-search-wrap input {
    width: 100%;
    height: 36px;
    padding: 0 12px 0 34px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    font-size: 0.82rem;
    background: #ffffff;
    color: #0f172a;
    outline: none;
}

.dre-drill-search-wrap input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.dre-drill-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dre-drill-sort-select {
    height: 36px;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
}

.dre-drill-count-badge {
    font-size: 0.74rem;
    font-weight: 700;
    color: #475569;
    background: #e2e8f0;
    padding: 5px 10px;
    border-radius: 999px;
}

.dre-drill-pill-clear {
    height: 32px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid #fca5a5;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.73rem;
    font-weight: 800;
    cursor: pointer;
}

.dre-drill-btn-export {
    height: 36px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid #16a34a;
    background: #f0fdf4;
    color: #15803d;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dre-drill-btn-export:hover {
    background: #16a34a;
    color: #ffffff;
}

.dre-drill-table-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.dre-drill-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.80rem;
    table-layout: fixed;
}

.dre-drill-table thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: #f1f5f9;
    color: #334155;
    font-weight: 800;
    font-size: 0.69rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 10px 12px;
    border-bottom: 2px solid #cbd5e1;
    text-align: left;
}

.dre-drill-table tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

.dre-drill-table tbody tr:hover td {
    background: #f8fafc;
}

.dre-drill-loja-pill {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    color: #334155;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 1px 7px;
    border-radius: 5px;
    margin-top: 2px;
}

.dre-drill-nf-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: monospace;
    font-weight: 800;
    font-size: 0.80rem;
    color: #1d4ed8;
    text-decoration: none;
    padding: 2px 7px;
    border-radius: 6px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    transition: all 0.14s ease;
}

.dre-drill-nf-link:hover {
    background: #1d4ed8;
    color: #ffffff;
    border-color: #1d4ed8;
}

.dre-drill-val-bar {
    height: 3px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 4px;
    width: 100%;
}

.dre-drill-val-bar > div {
    height: 100%;
    border-radius: 999px;
}

.dre-drill-footer {
    padding: 11px 18px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cell-val-percent {
    display: inline-block;
    font-size: 0.74rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    padding: 2px 7px;
    border-radius: 999px;
    line-height: 1.3;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
}

.cell-val-percent.pct-pos {
    color: #15803d;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.cell-val-percent.pct-neg {
    color: #dc2626;
    background: #fef2f2;
    border-color: #fecaca;
}

.cell-val-percent.pct-zero {
    color: #64748b;
    background: #f8fafc;
    border-color: #e2e8f0;
}

.dre-mod-pct-base-tag {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: #0369a1;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    padding: 1px 6px;
    border-radius: 999px;
    margin-left: 6px;
    white-space: nowrap;
}

.btn-pct-toggle.active {
    background: #0A58CA !important;
    color: #ffffff !important;
    border-color: #0A58CA !important;
}

/* Comparativo de Anos */
.cell-compare-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.76rem;
}

.compare-row-curr {
    font-weight: 700;
    color: #0f172a;
}

.compare-row-prev {
    color: #64748b;
}

.compare-row-delta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    font-size: 0.70rem;
}

.compare-improved {
    color: #16a34a;
}

.compare-worsened {
    color: #dc2626;
}

/* Modais Gerais */
.dre-mod-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.dre-mod-modal-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-xl {
    width: 1280px;
    max-width: 96vw;
}

.modal-md {
    width: 680px;
    max-width: 92vw;
}

.dre-mod-modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
}

.dre-mod-modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
}

.dre-mod-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.dre-mod-modal-footer {
    padding: 14px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f8fafc;
}

/* Construtor de Estrutura em 2 Colunas */
.structure-builder-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 20px;
    height: 680px;
    max-height: 72vh;
}

.builder-tree-column {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.builder-tree-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.builder-tree-scroll {
    overflow-y: auto;
    overflow-x: hidden !important;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
}

.tree-line-item {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    margin-left: 0 !important;
}

.tree-line-item.is-child {
    border-left: 4px solid #0284c7 !important;
    background: #f8fafc;
    padding-left: 14px !important;
    margin-left: 0 !important;
}

.tree-line-item:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.tree-line-item.selected {
    border-color: #3b82f6;
    background: #e0f2fe;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.builder-form-column {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Accordion de Seções do Formulário */
.form-section-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.form-section-header {
    background: #f8fafc;
    padding: 10px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Chips de Contas / COIs */
.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 38px;
    padding: 6px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
}

.chip-item {
    background: #e2e8f0;
    color: #1e293b;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chip-item-remove {
    cursor: pointer;
    font-weight: 800;
    color: #64748b;
    border: none;
    background: none;
    padding: 0;
    line-height: 1;
}

.chip-item-remove:hover {
    color: #ef4444;
}



/* ==============================================================================
   TELA EXCLUSIVA: ESTÚDIO EXECUTIVO DA DRE MODULAR
   Layout de 3 Colunas com Alta Densidade de Informação e Estética Corporativa
   ============================================================================== */
.dre-cfg-wrapper {
    min-height: calc(100vh - 64px);
    background-color: #f8fafc;
    padding: 14px 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-family: var(--font-primary, 'Plus Jakarta Sans', -apple-system, sans-serif);
}

/* TOPBAR DO ESTÚDIO */
.dre-cfg-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    flex-wrap: wrap;
    gap: 12px;
}

.dre-cfg-topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.dre-cfg-btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    font-weight: 600;
    font-size: 0.78rem;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.dre-cfg-btn-back:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

.dre-cfg-titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dre-cfg-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dre-cfg-titles h1 {
    font-size: 1.10rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    line-height: 1.2;
}

.dre-cfg-subtitle {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 500;
}

.dre-cfg-status-pill {
    font-size: 0.65rem;
    font-weight: 700;
    background: #e0f2fe;
    color: #0284c7;
    border: 1px solid #bae6fd;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dre-cfg-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dre-cfg-model-picker {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dre-cfg-picker-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.dre-cfg-select-model {
    height: 34px;
    min-width: 220px;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #0f172a;
    background: #ffffff;
}
.dre-cfg-select-model:focus {
    border-color: #0284c7;
    outline: none;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.dre-cfg-model-actions {
    display: flex;
    gap: 4px;
}

.dre-cfg-btn-subtle {
    height: 34px;
    padding: 0 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.dre-cfg-btn-subtle:hover {
    background: #f8fafc;
    color: #0f172a;
    border-color: #94a3b8;
}

.dre-btn-danger:hover {
    background: #fef2f2 !important;
    color: #dc2626 !important;
    border-color: #fca5a5 !important;
}

.dre-cfg-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 16px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #ffffff;
    background: #0284c7;
    border: 1px solid #0369a1;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.2);
    transition: all 0.15s ease;
}
.dre-cfg-btn-primary:hover {
    background: #0369a1;
}

/* GRID PRINCIPAL DE 3 PAINÉIS */
.dre-cfg-main-grid {
    display: grid;
    grid-template-columns: 350px 430px minmax(480px, 1fr);
    gap: 14px;
    height: calc(100vh - 145px);
    min-height: 600px;
}

@media (max-width: 1440px) {
    .dre-cfg-main-grid {
        grid-template-columns: 320px 390px 1fr;
    }
}

.dre-cfg-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    overflow: hidden;
    height: 100%;
    box-sizing: border-box;
}

.dre-cfg-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.dre-cfg-panel-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dre-cfg-panel-title {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #1e293b;
}

.dre-cfg-panel-subtitle {
    font-size: 0.68rem;
    color: #64748b;
    font-weight: 500;
}

.dre-cfg-badge-count {
    font-size: 0.65rem;
    font-weight: 700;
    background: #e2e8f0;
    color: #334155;
    padding: 1px 6px;
    border-radius: 10px;
}

.dre-cfg-reorder-toolbar {
    display: flex;
    gap: 4px;
}

.dre-cfg-btn-icon {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
    font-size: 0.68rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.15s ease;
}
.dre-cfg-btn-icon:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* BARRA DE AÇÕES DO PAINEL 1 */
.dre-cfg-tree-actions {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.dre-cfg-tool-btn {
    height: 28px;
    padding: 0 4px;
    font-size: 0.68rem;
    font-weight: 700;
    background: #f8fafc;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    transition: all 0.15s ease;
}
.dre-cfg-tool-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}
.dre-tool-accent {
    background: #eff6ff !important;
    color: #0284c7 !important;
    border-color: #bae6fd !important;
}
.dre-tool-accent:hover {
    background: #dbeafe !important;
}
.dre-tool-danger {
    background: #fef2f2 !important;
    color: #b91c1c !important;
    border-color: #fecaca !important;
}
.dre-tool-danger:hover {
    background: #fee2e2 !important;
    border-color: #f87171 !important;
}

/* CAIXA DE BUSCA */
.dre-cfg-search-box {
    position: relative;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.dre-cfg-search-icon {
    position: absolute;
    left: 8px;
    pointer-events: none;
}

.dre-cfg-search-input {
    width: 100%;
    height: 30px;
    padding: 0 10px 0 28px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.74rem;
    background: #f8fafc;
    box-sizing: border-box;
}
.dre-cfg-search-input:focus {
    background: #ffffff;
    border-color: #0284c7;
    outline: none;
}

/* ÁRVORE DE LINHAS COM ROLAGEM LIMPA */
.dre-cfg-tree-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden !important;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 4px;
}

/* CARD DE LINHA NA ÁRVORE */
.studio-tree-item {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    margin-left: 0 !important;
    position: relative;
}

.studio-tree-item:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.studio-tree-item.selected {
    border-color: #0284c7 !important;
    background: #eff6ff !important;
    box-shadow: 0 0 0 1px #0284c7;
}

.studio-tree-item.is-drawer {
    background: #f8fafc;
    border-color: #cbd5e1;
    font-weight: 700;
}
.studio-tree-item.is-drawer.selected {
    border-color: #0284c7 !important;
    background: #eff6ff !important;
}

.studio-tree-item.is-child {
    background: #ffffff;
    border-left: 3px solid #0284c7 !important;
    margin-left: 0 !important;
}

.studio-tree-item-left {
    display: flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
    flex: 1 1 auto;
    min-width: 90px;
}

.tree-branch-icon {
    color: #0284c7;
    font-weight: 800;
    font-size: 0.72rem;
    flex-shrink: 0;
    width: 14px;
    min-width: 14px;
    text-align: center;
}

.btn-tree-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    min-width: 18px;
    height: 18px;
    padding: 0;
    margin-right: 2px;
    border: 1px solid #cbd5e1;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 0.62rem;
    font-weight: 800;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
    flex-shrink: 0;
    z-index: 2;
}
.btn-tree-toggle:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

.tree-toggle-spacer {
    display: inline-block;
    width: 18px;
    min-width: 18px;
    margin-right: 2px;
    flex-shrink: 0;
}

.tree-child-count {
    font-size: 0.65rem;
    font-weight: 700;
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 4px;
    flex-shrink: 0;
}

.tree-code-badge {
    font-family: monospace;
    font-size: 0.72rem;
    font-weight: 800;
    color: #0284c7;
    background: #f0f9ff;
    padding: 1px 4px;
    border-radius: 3px;
    border: 1px solid #e0f2fe;
    flex-shrink: 0;
}

.tree-title-text {
    font-size: 0.78rem;
    color: #1e293b;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.studio-tree-item-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
}

.tree-type-pill {
    font-size: 0.60rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    transition: opacity 0.1s ease;
}
.pill-DRAWER { background: #e0e7ff; color: #3730a3; }
.pill-COI_GROUP { background: #e0f2fe; color: #0369a1; }
.pill-CMV { background: #fef2f2; color: #b91c1c; }
.pill-FORMULA { background: #f3e8ff; color: #7e22ce; }
.pill-ACCOUNT_GROUP { background: #f1f5f9; color: #475569; }
.pill-FIXED_VALUE { background: #fef3c7; color: #b45309; }

/* Ações flutuantes no hover */
.studio-tree-hover-actions {
    display: none;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.studio-tree-item:hover .studio-tree-hover-actions {
    display: flex;
}

.studio-tree-item:hover .tree-type-pill {
    display: none;
}

.btn-hover-act {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    font-size: 0.62rem;
    font-weight: 700;
    border-radius: 3px;
    padding: 1px 4px;
    cursor: pointer;
    line-height: 1.2;
}
.btn-hover-act:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.btn-hover-del {
    color: #dc2626 !important;
    border-color: #fca5a5 !important;
}
.btn-hover-del:hover {
    background: #fef2f2 !important;
}

/* PAINEL 2: EDITOR DA LINHA */
.dre-cfg-editor-form-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 6px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dre-cfg-editor-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.dre-cfg-empty-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.dre-cfg-editor-empty h4 {
    margin: 0 0 4px 0;
    color: #1e293b;
    font-size: 0.90rem;
    font-weight: 700;
}

.dre-cfg-editor-empty p {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.4;
}

.dre-cfg-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.dre-cfg-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f8fafc;
}

.dre-cfg-card-step {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0284c7;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dre-cfg-card-title {
    font-size: 0.75rem;
    font-weight: 800;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dre-cfg-form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.dre-cfg-field {
    display: flex;
    flex-direction: column;
}

.dre-cfg-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dre-cfg-field-hint {
    font-size: 0.65rem;
    color: #64748b;
    margin-top: 2px;
}

.dre-cfg-input, .dre-cfg-select {
    width: 100%;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.76rem;
    background: #ffffff;
    color: #0f172a;
    box-sizing: border-box;
}
.dre-cfg-input:focus, .dre-cfg-select:focus {
    border-color: #0284c7;
    outline: none;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.12);
}

.dre-code-font {
    font-family: monospace;
    font-weight: 700;
}

.dre-cfg-input-action-group {
    display: flex;
    gap: 4px;
}

.dre-cfg-btn-inline {
    height: 32px;
    padding: 0 8px;
    font-size: 0.70rem;
    font-weight: 700;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
}
.dre-cfg-btn-inline:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.dre-cfg-engine-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px 12px;
    margin-top: 10px;
}

.dre-cfg-preset-group {
    display: flex;
    gap: 3px;
}

.btn-cmv-preset {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-cmv-preset:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.btn-cmv-preset.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

.dre-cfg-info-banner {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 10px;
    font-size: 0.70rem;
    color: #0369a1;
    line-height: 1.4;
}

.dre-cfg-info-title {
    font-weight: 800;
    margin-bottom: 2px;
}

.dre-cfg-operators-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.btn-formula-op {
    font-size: 0.72rem;
    font-weight: 800;
    font-family: monospace;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #1e293b;
    cursor: pointer;
}
.btn-formula-op:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}
.btn-op-clear {
    background: #fee2e2 !important;
    color: #dc2626 !important;
    border-color: #fca5a5 !important;
}

.dre-cfg-chips-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.dre-cfg-checkbox-row {
    display: flex;
    gap: 16px;
    margin-top: 10px;
}

.dre-cfg-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
}

/* PAINEL 3: PRÉ-VISUALIZAÇÃO FINANCEIRA */
.dre-cfg-preview-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dre-cfg-pill-sim {
    font-size: 0.62rem;
    font-weight: 800;
    background: #dbeafe;
    color: #1d4ed8;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dre-cfg-preview-actions {
    display: flex;
    gap: 4px;
}

.dre-cfg-preview-scroll {
    flex: 1;
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
}

.dre-cfg-preview-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.76rem;
}

.dre-cfg-preview-table thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    padding: 8px 10px;
    font-weight: 800;
    color: #475569;
    font-size: 0.70rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    z-index: 5;
}

.dre-cfg-preview-table tbody td {
    padding: 6px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

.dre-cfg-preview-table tr.preview-row-drawer td {
    background: #f8fafc;
    font-weight: 800;
    color: #0f172a;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #cbd5e1;
}

.dre-cfg-preview-table tr.preview-row-child td {
    background: #ffffff;
    font-size: 0.74rem;
}

.dre-cfg-preview-table tr:hover td {
    background: #f8fafc !important;
}

.dre-cfg-preview-table tfoot td {
    position: sticky;
    bottom: 0;
    background: #f1f5f9;
    color: #0f172a;
    font-weight: 800;
    padding: 8px 10px;
    border-top: 2px solid #cbd5e1;
    font-size: 0.76rem;
}

/* BARRA DE KPIS DA SIMULAÇÃO */
.dre-cfg-kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    padding-top: 10px;
    margin-top: 8px;
    border-top: 1px solid #e2e8f0;
}

@media (max-width: 1400px) {
    .dre-cfg-kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.dre-kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.dre-kpi-title {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dre-kpi-val {
    font-size: 0.82rem;
    font-weight: 800;
    font-family: monospace;
    white-space: nowrap;
}
.dre-kpi-val.text-primary { color: #0284c7; }
.dre-kpi-val.text-danger { color: #dc2626; }
.dre-kpi-val.text-success { color: #16a34a; }
.dre-kpi-val.text-bold { color: #0f172a; }

/* Abas de Visao do Modal Raio-X (COI: Notas vs Formas de Pagamento) */
.dre-drill-mode-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 4px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    width: fit-content;
}

.dre-drill-mode-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.16s ease;
}

.dre-drill-mode-tab:hover {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.65);
}

.dre-drill-mode-tab.active {
    background: #ffffff;
    color: #0f172a;
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.dre-drill-mode-tab.active svg {
    color: #0284c7;
}

.dre-drill-pay-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.dre-drill-pay-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dre-drill-pay-cat-pill:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.dre-drill-pay-cat-pill.active {
    border-color: #0284c7;
    background: #f0f9ff;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.14);
}

.dre-drill-pay-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dre-drill-pay-cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    border: 1px solid transparent;
}
