#aba-reequilibrio {
    --reeq-navy: #0b3c5d;
    --reeq-navy-dark: #072b43;
    --reeq-amber: #c46a10;
    --reeq-green: #1a7a4a;
    --reeq-red: #b72020;
    --reeq-slate: #5a7a8c;
    --reeq-border: #d9e3ea;
    --reeq-bg: #f3f6f8;
    background: var(--reeq-bg);
    min-height: calc(100vh - 170px);
    padding: 18px;
    color: #172b38;
    font-family: "Segoe UI", Inter, system-ui, sans-serif;
}

#conteudo-reequilibrio { max-width: 1900px; margin: 0 auto; }

.reeq-drawer-layer,
.reeq-modal-layer,
.reeq-toast-host {
    --reeq-navy: #0b3c5d;
    --reeq-navy-dark: #072b43;
    --reeq-amber: #c46a10;
    --reeq-green: #1a7a4a;
    --reeq-red: #b72020;
    --reeq-slate: #5a7a8c;
}

.reeq-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px;
    margin-bottom: 14px;
    border: 1px solid #cfdae2;
    border-top: 4px solid var(--reeq-navy);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(15, 43, 61, .07);
}

.reeq-kicker,
.reeq-header__title .reeq-kicker {
    color: var(--reeq-amber);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .12em;
}

.reeq-header h1 { margin: 3px 0 4px; color: var(--reeq-navy); font-size: 24px; font-weight: 850; }
.reeq-header p { margin: 0; max-width: 720px; color: #607583; font-size: 12px; line-height: 1.45; }
.reeq-header__tools { display: flex; align-items: flex-end; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.reeq-scenario-select { display: flex; flex-direction: column; gap: 3px; min-width: 210px; }
.reeq-scenario-select span { color: #607583; font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.reeq-scenario-select select {
    height: 36px;
    padding: 0 32px 0 10px;
    border: 1px solid #aebfca;
    border-radius: 6px;
    background: #fff;
    color: #17384d;
    font-size: 12px;
    font-weight: 700;
}

.reeq-btn {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    font: 700 11px/1.1 "Segoe UI", sans-serif;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease;
    white-space: nowrap;
}
.reeq-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(15, 43, 61, .14); }
.reeq-btn:disabled { opacity: .42; cursor: not-allowed; }
.reeq-btn--primary { background: var(--reeq-navy); color: #fff; border-color: var(--reeq-navy-dark); }
.reeq-btn--amber { background: var(--reeq-amber); color: #fff; border-color: #a4550b; }
.reeq-btn--success { background: var(--reeq-green); color: #fff; border-color: #12633b; }
.reeq-btn--ghost { background: #fff; color: #34576b; border-color: #afc0cb; }

.reeq-cards { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 10px; margin-bottom: 12px; }
.reeq-card {
    min-width: 0;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid #d6e0e6;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 2px 7px rgba(14, 42, 59, .055);
}
.reeq-card__icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; background: #e6f0f6; color: var(--reeq-navy); }
.reeq-card__icon--slate { background: #edf2f5; color: var(--reeq-slate); }
.reeq-card__icon--amber { background: #fff0e0; color: var(--reeq-amber); }
.reeq-card__icon--green { background: #e6f4ec; color: var(--reeq-green); }
.reeq-card > div:nth-child(2) { min-width: 0; }
.reeq-card span { display: block; color: #718692; font-size: 9px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.reeq-card strong { display: block; overflow: hidden; margin: 2px 0; color: #18374a; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.reeq-card small { display: block; overflow: hidden; color: #718692; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.reeq-card__metric { min-width: 92px; text-align: right; }
.reeq-card__metric b { display: block; margin-bottom: 4px; color: #18374a; font-size: 12px; font-variant-numeric: tabular-nums; }
.reeq-card__metric small { font-size: 9px; }

.reeq-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; padding: 3px 6px; border: 1px solid; border-radius: 999px; font-size: 9px; font-weight: 900; letter-spacing: .05em; }
.reeq-badge--neutro { background: #eff3f5; border-color: #cad6dc; color: #496574; }
.reeq-badge--pendente { background: #fff0e0; border-color: #edc18e; color: #a4550b; }
.reeq-badge--alterado { background: #fff0e0; border-color: #dc9e5b; color: #8f4807; }
.reeq-badge--ok { background: #e6f4ec; border-color: #a9d4bd; color: #12633b; }
.reeq-badge--erro, .reeq-badge--bloqueado { background: #fceaea; border-color: #e2a9a9; color: var(--reeq-red); }

.reeq-workbench { overflow: hidden; border: 1px solid #ccd9e1; border-radius: 10px; background: #fff; box-shadow: 0 3px 12px rgba(15, 43, 61, .07); }
.reeq-workbench__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 11px; border-bottom: 1px solid #d9e3e9; background: #f7f9fa; }
.reeq-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.reeq-filter { padding: 6px 10px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: #5d7482; font-size: 10px; font-weight: 800; cursor: pointer; }
.reeq-filter:hover { background: #eaf0f3; }
.reeq-filter.ativo { background: var(--reeq-navy); color: #fff; }
.reeq-search { width: min(340px, 100%); display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid #bbcbd4; border-radius: 6px; background: #fff; color: #7a8f9b; }
.reeq-search input { width: 100%; height: 32px; padding: 0; border: 0; outline: 0; background: transparent; color: #243f4f; font-size: 11px; }

.reeq-table-scroll { max-height: 62vh; overflow: auto; }
.reeq-table { width: 100%; min-width: 1720px; border-collapse: separate; border-spacing: 0; font-size: 10.5px; }
.reeq-table th { position: sticky; top: 0; z-index: 2; padding: 9px 7px; border-right: 1px solid #d9e3e9; border-bottom: 1px solid #bccbd4; background: #eaf0f3; color: #274858; font-size: 9px; font-weight: 900; letter-spacing: .025em; text-align: center; text-transform: uppercase; white-space: nowrap; }
.reeq-table td { padding: 8px 7px; border-right: 1px solid #e4ebef; border-bottom: 1px solid #e2e9ed; background: #fff; vertical-align: middle; }
.reeq-table tbody tr { cursor: pointer; transition: filter .13s ease; }
.reeq-table tbody tr:hover td { background: #f2f7fa; }
.reeq-table tbody tr:focus { outline: 2px solid #63a6ca; outline-offset: -2px; }
.reeq-table .reeq-row--pendente td { background: #fff9f2; }
.reeq-table .reeq-row--pendente td:first-child { box-shadow: inset 3px 0 var(--reeq-amber); }
.reeq-table .reeq-row--alterada td:first-child { box-shadow: inset 3px 0 var(--reeq-green); }
.reeq-table code { color: var(--reeq-navy); font-size: 10px; font-weight: 800; }
.reeq-cell--item { color: #597281; font-weight: 800; text-align: center; }
.reeq-cell--descricao { min-width: 260px; max-width: 380px; }
.reeq-cell--descricao strong { display: block; color: #203c4c; font-weight: 700; line-height: 1.25; }
.reeq-cell--center { text-align: center; }
.reeq-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.reeq-num--strong { color: #16384b; font-weight: 850; }
.reeq-num--positivo { color: var(--reeq-amber); }
.reeq-num--negativo { color: var(--reeq-red); }
.reeq-diagnostico { display: inline-flex; gap: 4px; align-items: center; margin-top: 3px; color: var(--reeq-red); font-size: 9px; }
.reeq-open { width: 28px; height: 28px; border: 1px solid #bbcbd4; border-radius: 6px; background: #fff; color: var(--reeq-navy); cursor: pointer; }
.reeq-open:hover { background: var(--reeq-navy); color: #fff; }
.reeq-table tfoot td { position: sticky; bottom: 0; padding: 9px 7px; border-top: 2px solid #aec0ca; background: #eaf0f3; color: #183b4e; font-weight: 900; }
.reeq-table-note { padding: 7px 11px; border-top: 1px solid #dae4e9; background: #f8fafb; color: #617985; font-size: 10px; }
.reeq-table-note i { margin-right: 5px; color: var(--reeq-navy); }
.reeq-preview-warning { padding: 8px 11px; border-top: 1px solid #ebcfaa; background: #fff6ea; color: #8a4d0c; font-size: 10px; }
.reeq-table-empty { padding: 34px !important; color: #6b818e; text-align: center !important; }

.reeq-state, .reeq-empty { min-height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 42px 20px; border: 1px dashed #b9c9d2; border-radius: 12px; background: #fff; color: #657d8b; text-align: center; }
.reeq-state > i, .reeq-empty > i { color: var(--reeq-navy); font-size: 36px; }
.reeq-state h2, .reeq-empty h2, .reeq-empty h3 { max-width: 680px; margin: 0; color: #193b4e; font-size: 20px; }
.reeq-state p, .reeq-empty p { max-width: 650px; margin: 0 0 8px; font-size: 12px; }
.reeq-state--locked > i { color: var(--reeq-amber); }
.reeq-state--error > i { color: var(--reeq-red); }
.reeq-empty--compact { min-height: 300px; border: 0; }
.reeq-empty--compact h3 { font-size: 17px; }
.reeq-spinner { width: 28px; height: 28px; display: inline-block; border: 3px solid #cfdae1; border-top-color: var(--reeq-navy); border-radius: 50%; animation: reeq-spin .75s linear infinite; }
@keyframes reeq-spin { to { transform: rotate(360deg); } }

.reeq-drawer-layer { position: fixed; inset: 0; z-index: 850; }
.reeq-drawer-layer[hidden] { display: none; }
.reeq-drawer-backdrop { position: absolute; inset: 0; background: rgba(8, 25, 36, .4); backdrop-filter: blur(1px); }
.reeq-drawer { position: absolute; top: 0; right: 0; width: min(1040px, 97vw); height: 100%; overflow: hidden; border-left: 1px solid #9fb3bf; background: #f3f6f8; box-shadow: -12px 0 36px rgba(5, 24, 35, .2); transform: translateX(100%); transition: transform .2s ease; }
.reeq-drawer-layer.aberta .reeq-drawer { transform: translateX(0); }
#reeq-drawer-content, .reeq-drawer-shell { height: 100%; }
.reeq-drawer-shell { display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
.reeq-drawer-header { min-height: 76px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--reeq-navy); color: #fff; }
.reeq-drawer-header span { color: #a8c5d6; font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.reeq-drawer-header h2 { margin: 3px 0 5px; color: #fff; font-size: 15px; line-height: 1.25; }
.reeq-drawer-status { display: flex; align-items: center; gap: 7px; }
.reeq-mode-chip { color: #d8e8f0 !important; font-size: 9px !important; letter-spacing: 0 !important; text-transform: none; }
.reeq-drawer-close { width: 32px; height: 32px; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.25); border-radius: 6px; background: rgba(255,255,255,.08); color: #fff; cursor: pointer; }
.reeq-drawer-metrics { display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 1px solid #d2dde4; background: #fff; }
.reeq-drawer-metrics div { min-width: 0; padding: 9px 10px; border-right: 1px solid #e0e7eb; border-bottom: 1px solid #e0e7eb; }
.reeq-drawer-metrics span { display: block; color: #738893; font-size: 8px; font-weight: 900; text-transform: uppercase; }
.reeq-drawer-metrics b { display: block; overflow: hidden; margin-top: 2px; color: #1b3c4f; font-size: 10px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.reeq-readonly { padding: 8px 14px; border-bottom: 1px solid #e5c99f; background: #fff6ea; color: #8a4d0c; font-size: 10px; font-weight: 700; }
.reeq-drawer-notices:empty { display: none; }
.reeq-drawer-alert { padding: 8px 14px; border-bottom: 1px solid #e5c99f; background: #fff8ef; color: #8a4d0c; font-size: 10px; font-weight: 700; }
.reeq-drawer-body { min-height: 0; overflow-y: auto; padding: 12px; }
.reeq-drawer-footer { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; justify-content: flex-end; gap: 7px; padding: 10px 12px; border-top: 1px solid #cbd8df; background: #fff; box-shadow: 0 -4px 12px rgba(12, 38, 53, .06); }
.reeq-drawer-loading { height: calc(100% - 76px); display: flex; flex-direction: column; align-items: center; justify-content: center; color: #6c818d; }

.reeq-memory-empty { min-height: 330px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 30px; border: 1px dashed #b9c9d2; border-radius: 9px; background: #fff; text-align: center; }
.reeq-memory-empty > i { color: var(--reeq-navy); font-size: 30px; }
.reeq-memory-empty h3 { margin: 0; color: #1a3a4d; font-size: 16px; }
.reeq-memory-empty p { max-width: 420px; margin: 0 0 6px; color: #697f8b; font-size: 11px; line-height: 1.5; }
.reeq-memory { overflow: hidden; border: 1px solid #ccd9e0; border-radius: 9px; background: #fff; }
.reeq-memory-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border-bottom: 1px solid #d8e2e7; background: #f7f9fa; }
.reeq-memory-heading span { color: #708591; font-size: 9px; font-weight: 900; text-transform: uppercase; }
.reeq-memory-heading h3 { margin: 2px 0 0; color: var(--reeq-navy); font-size: 14px; }
.reeq-memory-heading > div:last-child { text-align: right; }
.reeq-memory-heading small { display: block; margin-top: 3px; color: #728792; font-size: 9px; }
.reeq-memory-diagnostic, .reeq-node-diagnostic { padding: 7px 10px; background: #fff4f4; color: #9a2020; font-size: 9.5px; line-height: 1.4; }
.reeq-root-ref { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 7px; align-items: center; padding: 8px 11px; border-bottom: 1px solid #e0e7eb; background: #edf3f6; }
.reeq-root-ref span { color: #728792; font-size: 8px; font-weight: 900; text-transform: uppercase; }
.reeq-root-ref code { color: var(--reeq-navy); font-size: 9px; font-weight: 900; }
.reeq-root-ref strong { overflow: hidden; color: #2a4656; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.reeq-tree { padding: 7px; }
.reeq-node-branch { margin-left: calc(var(--reeq-level, 0) * 8px); }
.reeq-node { margin: 5px 0; overflow: hidden; border: 1px solid #d7e1e6; border-radius: 7px; background: #fff; }
.reeq-node--editado { border-color: #dda364; background: #fff0e0; box-shadow: inset 3px 0 var(--reeq-amber); }
.reeq-node--impactado { border-left: 3px solid var(--reeq-amber); background: #fffaf4; }
.reeq-node-main { display: grid; grid-template-columns: 24px minmax(0, 1fr) 165px; gap: 7px; align-items: center; padding: 8px; }
.reeq-node-toggle { width: 23px; height: 23px; border: 1px solid #b9c8d0; border-radius: 5px; background: #fff; color: var(--reeq-navy); cursor: pointer; }
.reeq-node-terminal { display: grid; place-items: center; color: #91a4ae; font-size: 5px; }
.reeq-node-copy { min-width: 0; }
.reeq-node-copy > div { display: flex; gap: 5px; align-items: center; }
.reeq-node-copy code { color: var(--reeq-navy); font-size: 9.5px; font-weight: 900; }
.reeq-node-copy strong { display: block; margin: 2px 0; color: #233f4f; font-size: 10.5px; line-height: 1.25; }
.reeq-node-copy small { display: block; color: #748994; font-size: 8.5px; }
.reeq-node-tag { padding: 2px 4px; border-radius: 3px; background: var(--reeq-amber); color: #fff; font-size: 7px; font-weight: 900; }
.reeq-node-tag--impactado { border: 1px solid #d59a5a; background: #fff; color: #9a520b; }
.reeq-node-values { min-width: 115px; text-align: right; font-variant-numeric: tabular-nums; }
.reeq-node-values span, .reeq-node-values small { display: block; color: #728792; font-size: 8px; }
.reeq-node-values b { display: block; margin: 2px 0; color: #294858; font-size: 9.5px; }
.reeq-node-finance { display: grid; grid-template-columns: repeat(6, minmax(95px, 1fr)); gap: 1px; margin: 0 8px 7px 39px; border: 1px solid #dde6eb; border-radius: 5px; overflow: hidden; background: #dde6eb; }
.reeq-node-finance span { min-width: 0; padding: 5px 6px; background: #f8fafb; color: #728792; font-size: 7.5px; text-transform: uppercase; }
.reeq-node-finance b { display: block; overflow: hidden; margin-top: 2px; color: #294858; font-size: 9px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.reeq-node-actions { display: flex; justify-content: flex-end; gap: 5px; padding: 0 8px 7px; }
.reeq-node-action { padding: 4px 7px; border: 1px solid #bdcad1; border-radius: 5px; background: #fff; color: #34566a; font-size: 8.5px; font-weight: 800; cursor: pointer; }
.reeq-node-action--danger { color: var(--reeq-red); }
.reeq-node-children { margin-left: 15px; padding-left: 7px; border-left: 1px dashed #bdcbd3; }

.reeq-edit-form { margin: 0 8px 8px; padding: 10px; border: 1px solid #d49a5c; border-radius: 7px; background: #fffaf4; }
.reeq-edit-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.reeq-edit-title span { display: block; color: var(--reeq-amber); font-size: 8px; font-weight: 900; text-transform: uppercase; }
.reeq-edit-title strong { color: #294756; font-size: 10px; }
.reeq-edit-title button { border: 0; background: transparent; color: #6b7f8a; cursor: pointer; }
.reeq-edit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.reeq-edit-help { margin: 0 0 8px; color: #667e8a; font-size: 9px; line-height: 1.4; }
.reeq-field { display: block; margin: 7px 0; }
.reeq-field span { display: block; margin-bottom: 3px; color: #5f7581; font-size: 8.5px; font-weight: 850; }
.reeq-field input, .reeq-field textarea, .reeq-field select { width: 100%; box-sizing: border-box; padding: 7px 8px; border: 1px solid #b9c8d0; border-radius: 5px; background: #fff; color: #203d4d; font: 10px "Segoe UI", sans-serif; outline: none; }
.reeq-field input[readonly] { background: #eef3f5; color: #536d7b; }
.reeq-field input:focus, .reeq-field textarea:focus { border-color: #4385a7; box-shadow: 0 0 0 2px rgba(67,133,167,.12); }
.reeq-field textarea { min-height: 64px; resize: vertical; }
.reeq-field--full { grid-column: 1 / -1; }
.reeq-edit-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.reeq-edit-error, .reeq-modal-error { min-height: 14px; color: var(--reeq-red); font-size: 9px; font-weight: 700; }

.reeq-modal-layer { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 18px; }
.reeq-modal-layer[hidden] { display: none; }
.reeq-modal-backdrop { position: absolute; inset: 0; background: rgba(7,28,40,.48); }
.reeq-modal { position: relative; width: min(480px, 96vw); overflow: hidden; border-radius: 10px; background: #fff; box-shadow: 0 22px 70px rgba(4,23,34,.28); }
.reeq-modal header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--reeq-navy); color: #fff; }
.reeq-modal header span { color: #aec8d6; font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.reeq-modal header h2 { margin: 3px 0 0; font-size: 16px; }
.reeq-modal header button { border: 0; background: transparent; color: #fff; cursor: pointer; }
.reeq-modal form { padding: 15px 16px; }
.reeq-modal form > p { margin: 0 0 10px; color: #627985; font-size: 10px; line-height: 1.45; }
.reeq-modal footer { display: flex; justify-content: flex-end; gap: 7px; margin-top: 12px; }

.reeq-toast-host { position: fixed; right: 18px; bottom: 18px; z-index: 1000; display: grid; gap: 7px; }
.reeq-toast { max-width: 390px; padding: 10px 13px; border-radius: 7px; box-shadow: 0 8px 25px rgba(8,31,44,.2); color: #fff; font-size: 11px; font-weight: 750; }
.reeq-toast--sucesso { background: var(--reeq-green, #1a7a4a); }
.reeq-toast--erro { background: var(--reeq-red, #b72020); }

@media (max-width: 1350px) {
    .reeq-header { align-items: flex-start; flex-direction: column; }
    .reeq-header__tools { justify-content: flex-start; }
    .reeq-cards { grid-template-columns: repeat(2, minmax(240px, 1fr)); }
}

@media (max-width: 760px) {
    #aba-reequilibrio { padding: 9px; }
    .reeq-header { padding: 14px; }
    .reeq-header__tools { width: 100%; }
    .reeq-scenario-select { width: 100%; }
    .reeq-cards { grid-template-columns: 1fr; }
    .reeq-workbench__bar { align-items: stretch; flex-direction: column; }
    .reeq-search { width: 100%; }
    .reeq-drawer { width: 100vw; }
    .reeq-drawer-metrics { grid-template-columns: repeat(2, 1fr); }
    .reeq-edit-grid { grid-template-columns: 1fr; }
    .reeq-node-finance { grid-template-columns: repeat(2, 1fr); margin-left: 8px; }
    .reeq-drawer-footer .reeq-btn span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .reeq-drawer, .reeq-btn { transition: none; }
    .reeq-spinner { animation-duration: 1.5s; }
}
