/* ===================================================
   Scribcare BI — Folha de estilos global
   Paleta: #27374D | #526D82 | #96A9B7 | #DDE6ED | #1B8FC8
   =================================================== */

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #DDE6ED;
}

/* ===================== SIDEBAR ===================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 100vh;
    background-color: #27374D;
    display: flex;
    flex-direction: column;
    z-index: 200;
    box-shadow: 3px 0 12px rgba(0, 0, 0, 0.25);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-logo {
    padding: 22px 20px 14px;
    flex-shrink: 0;
}

.sidebar-divider {
    border: none;
    border-top: 1px solid #526D82;
    margin: 0 16px;
    opacity: 0.4;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 10px;
    flex: 1;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 8px;
    color: #96A9B7;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    border-left: 3px solid transparent;
    text-decoration: none !important;
}

.sidebar-item:hover {
    background-color: rgba(82, 109, 130, 0.35);
    color: #DDE6ED;
}

.sidebar-item-active {
    background-color: rgba(27, 143, 200, 0.14);
    color: #B1DDFF !important;
    border-left: 3px solid #1B8FC8;
}

.sidebar-item-active:hover {
    background-color: rgba(27, 143, 200, 0.22);
    color: #B1DDFF !important;
}

.sidebar-footer {
    padding: 0 10px 16px;
    flex-shrink: 0;
}

.sidebar-user-row {
    display: flex;
    align-items: center;
    color: #96A9B7;
    font-size: 12.5px;
    padding: 8px 14px 10px;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-username {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-refresh-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 9px 14px;
    margin-bottom: 6px;
    background-color: transparent;
    border: 1px solid #526D82;
    border-radius: 8px;
    color: #96A9B7;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.18s;
}

.sidebar-refresh-btn:hover {
    background-color: #1B8FC8;
    border-color: #1B8FC8;
    color: #fff;
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 9px 14px;
    background-color: transparent;
    border: 1px solid #526D82;
    border-radius: 8px;
    color: #96A9B7;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.18s;
}

.sidebar-logout-btn:hover {
    background-color: #A64B4C;
    border-color: #A64B4C;
    color: #fff;
}

/* ===================== MAIN CONTENT ===================== */

.main-content {
    margin-left: 220px;
    min-height: 100vh;
    background-color: #DDE6ED;
    padding: 28px 32px;
}

.page-header {
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 2px solid #96A9B7;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: #27374D;
    margin: 0 0 4px;
}

.page-subtitle {
    font-size: 13px;
    color: #526D82;
    margin: 0;
}

/* ===================== PLACEHOLDER ===================== */

.placeholder-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 58vh;
    gap: 12px;
    color: #526D82;
}

.placeholder-icon-lg {
    font-size: 72px;
    color: #96A9B7;
    line-height: 1;
}

.placeholder-label {
    font-size: 15px;
    color: #526D82;
    margin: 0;
}

/* ===================== LOGIN ===================== */

.login-page {
    min-height: 100vh;
    background: linear-gradient(145deg, #27374D 0%, #526D82 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 44px 40px 36px;
    width: 400px;
    max-width: 95vw;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
}

.login-logo-wrap {
    text-align: center;
    margin-bottom: 28px;
}

.login-title {
    font-size: 19px;
    font-weight: 700;
    color: #27374D;
    text-align: center;
    margin: 0 0 4px;
}

.login-subtitle {
    font-size: 13px;
    color: #526D82;
    text-align: center;
    margin: 0 0 28px;
}

.login-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: #27374D;
    margin-bottom: 5px;
}

.login-input {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid #DDE6ED;
    border-radius: 8px;
    font-size: 14px;
    color: #27374D;
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    margin-bottom: 16px;
}

.login-input:focus {
    border-color: #1B8FC8;
    box-shadow: 0 0 0 3px rgba(27, 143, 200, 0.12);
}

.login-btn {
    width: 100%;
    padding: 12px;
    background-color: #1B8FC8;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
    transition: background-color 0.18s;
    letter-spacing: 0.3px;
}

.login-btn:hover {
    background-color: #27374D;
}

.login-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.login-error {
    color: #A64B4C;
    font-size: 13px;
    text-align: center;
    min-height: 20px;
    margin-top: 10px;
}

/* ===================== SELEÇÃO DE CLIENTE ===================== */

.sel-cli-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.sel-cli-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1.5px solid #DDE6ED;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.sel-cli-card:hover {
    border-color: #1B8FC8;
    box-shadow: 0 2px 12px rgba(27, 143, 200, 0.15);
    background: #f4faff;
}

.sel-cli-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #27374D;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.sel-cli-name {
    font-size: 14px;
    font-weight: 600;
    color: #27374D;
}

.sel-cli-id {
    font-size: 11px;
    color: #96A9B7;
}

/* ===================== CONTEXT BAR ===================== */

.context-bar {
    position: fixed;
    top: 0;
    left: 220px;
    right: 0;
    height: 48px;
    background: #fff;
    border-bottom: 1px solid #DDE6ED;
    box-shadow: 0 2px 8px rgba(39, 55, 77, 0.07);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 8px;
    z-index: 100;
}

.ctx-bar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ctx-bar-label {
    font-size: 11.5px;
    font-weight: 600;
    color: #526D82;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.ctx-bar-icon {
    font-size: 14px;
    color: #96A9B7;
}

.ctx-bar-sep {
    width: 1px;
    height: 22px;
    background: #DDE6ED;
    margin: 0 8px;
}

.ctx-bar-dropdown .Select-control {
    border: 1.5px solid #DDE6ED !important;
    border-radius: 6px !important;
    min-height: 32px !important;
    font-size: 13px !important;
    color: #27374D !important;
    background: #fff !important;
}

.ctx-bar-dropdown .Select-value-label {
    color: #27374D !important;
    font-size: 13px !important;
}

.ctx-bar-dropdown .Select-placeholder {
    color: #96A9B7 !important;
}

.ctx-bar-dropdown .Select-menu-outer {
    border: 1.5px solid #DDE6ED !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 16px rgba(39, 55, 77, 0.12) !important;
    z-index: 9999 !important;
}

.ctx-bar-dropdown .Select-option {
    font-size: 13px !important;
    color: #27374D !important;
}

.ctx-bar-dropdown .Select-option.is-focused {
    background: rgba(27, 143, 200, 0.08) !important;
}

.ctx-bar-dropdown .Select-option.is-selected {
    background: rgba(27, 143, 200, 0.14) !important;
    color: #1B8FC8 !important;
}

.ctx-bar-dropdown .Select-arrow {
    border-top-color: #96A9B7 !important;
}

.main-content.with-context-bar {
    padding-top: 68px; /* 48px barra + 20px respiro */
}

/* ===================== SIDEBAR SUBMENU ===================== */

.sidebar-parent-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 8px;
    color: #96A9B7;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    border-left: 3px solid transparent;
    text-decoration: none !important;
}

.sidebar-parent-item:hover {
    background-color: rgba(82, 109, 130, 0.35);
    color: #DDE6ED;
}

.sidebar-parent-active {
    background-color: rgba(27, 143, 200, 0.14);
    color: #B1DDFF !important;
    border-left: 3px solid #1B8FC8;
}

.sidebar-parent-active:hover {
    background-color: rgba(27, 143, 200, 0.22);
    color: #B1DDFF !important;
}

/* Reset de browser para o botão de toggle de menu */
.sidebar-parent-btn {
    background: none;
    border: none;
    width: 100%;
    padding: 0;
    cursor: pointer;
    text-align: left;
    display: block;
    color: inherit;
    font: inherit;
}

.sidebar-submenu {
    display: flex;
    flex-direction: column;
    padding-left: 20px;
    gap: 2px;
    margin-top: 2px;
}

.sidebar-subitem {
    display: block;
    padding: 7px 14px;
    border-radius: 6px;
    color: #96A9B7;
    font-size: 12.5px;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    border-left: 2px solid transparent;
    text-decoration: none !important;
}

.sidebar-subitem:hover {
    background-color: rgba(82, 109, 130, 0.25);
    color: #DDE6ED;
}

.sidebar-subitem-active {
    background-color: rgba(27, 143, 200, 0.18);
    color: #B1DDFF !important;
    border-left: 2px solid #1B8FC8;
}

/* ===================== FILTER CARD ===================== */

.filter-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(39, 55, 77, 0.08);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
}

.filter-label {
    font-size: 11.5px;
    font-weight: 600;
    color: #526D82;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin: 0;
}

.period-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.period-arrow {
    color: #96A9B7;
    font-size: 16px;
    font-weight: 300;
    padding: 0 2px;
    flex-shrink: 0;
}

.dropdown-mes {
    width: 120px;
}

.dropdown-ano {
    width: 80px;
}

.dropdown-filter {
    min-width: 160px;
}

/* ===================== FONT SIZE CONTROL ===================== */

.fontsize-control {
    display: flex;
    align-items: center;
    border: 1.5px solid #DDE6ED;
    border-radius: 7px;
    overflow: hidden;
}

.fontsize-btn {
    padding: 6px 11px;
    background: #fff;
    border: none;
    border-right: 1.5px solid #DDE6ED;
    color: #526D82;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
    outline: none;
}

.fontsize-btn:last-child {
    border-right: none;
}

.fontsize-btn:hover {
    background: #DDE6ED;
    color: #27374D;
}

.fontsize-btn-active {
    background: #1B8FC8 !important;
    color: #fff !important;
}

/* ===================== CARDS BI ===================== */

.bi-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 2px 8px rgba(39, 55, 77, 0.08);
    margin-bottom: 20px;
}

.bi-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #526D82;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 6px;
}

.bi-card-value {
    font-size: 28px;
    font-weight: 700;
    color: #27374D;
    margin: 0;
}

.bi-card-sub {
    font-size: 12px;
    color: #96A9B7;
    margin: 4px 0 0;
}

/* ===================== BOTÃO CHAVE (TROCAR SENHA) ===================== */

.sidebar-key-btn {
    background: transparent;
    border: none;
    color: #96A9B7;
    cursor: pointer;
    padding: 2px 4px;
    margin-left: auto;
    font-size: 13px;
    line-height: 1;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

.sidebar-key-btn:hover {
    color: #DDE6ED;
    background: rgba(82, 109, 130, 0.3);
}

/* ===================== MODAL ===================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-card {
    background: #fff;
    border-radius: 14px;
    padding: 32px 28px 24px;
    width: 400px;
    max-width: 95vw;
    box-shadow: 0 12px 50px rgba(0, 0, 0, 0.25);
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: #96A9B7;
    font-size: 15px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.modal-close-btn:hover {
    background: #f0f0f0;
    color: #27374D;
}

/* ── AG Grid: centralizar cabeçalho de grupo de colunas ─────────────────────── */
.ag-header-group-cell-label { justify-content: center; }

/* Tabelas DRE / DFC: valores negativos na coluna R$ */
.dret-negative { color: #A64B4C !important; }
.dfct-negative { color: #A64B4C !important; }
.planprev-neg  { color: #c0392b !important; }
.pr-var-green  { color: #2E7D32 !important; }
.pr-var-yellow { color: #F9A825 !important; }
.pr-var-red    { color: #c0392b !important; }

/* ── Botões pequenos reutilizáveis ───────────────────────────────────────────── */
.btn-outline-sm {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    font-family: "Segoe UI", system-ui, sans-serif;
    color: #526D82;
    background: transparent;
    border: 1px solid #c8d6df;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-outline-sm:hover {
    background: #e8f0f5;
    border-color: #1B8FC8;
    color: #1B8FC8;
}

.btn-danger-sm {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    font-family: "Segoe UI", system-ui, sans-serif;
    color: #fff;
    background: #c0392b;
    border: 1px solid #c0392b;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-danger-sm:hover {
    background: #a93226;
    border-color: #a93226;
}

/* ── Tabs customizadas ───────────────────────────────────────────────────────── */
.custom-tabs {
    border-bottom: 2px solid #e8edf0;
    margin-bottom: 16px;
}
.custom-tab {
    padding: 10px 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #96A9B7 !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer;
}
.custom-tab:hover {
    color: #526D82 !important;
}
.custom-tab--selected {
    padding: 10px 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #1B8FC8 !important;
    border: none !important;
    border-bottom: 3px solid #1B8FC8 !important;
    background: transparent !important;
}

/* ============= INTERPRETAÇÃO — Modal centralizado ============= */

#interp-modal-dre .modal-dialog,
#interp-modal-dfc .modal-dialog {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* ============= AG-GRID — Cores AH% (verde positivo, vermelho negativo) ============= */

.dret-ah-pos {
    color: #27B6A5 !important;
    font-weight: 500 !important;
}
.dret-ah-neg {
    color: #A64B4C !important;
    font-weight: 500 !important;
}

.plan-acum-bold {
    font-weight: bold !important;
}

/* ============= AG-GRID — Ajustes de tema ============= */

/* ============= INTERPRETAÇÃO — (reservado para ajustes futuros) ============= */

/* ============= INTERPRETAÇÃO — Bolinha pulsante ============= */

@keyframes pulse-hint {
    0%   { transform: scale(1);   opacity: 1;   box-shadow: 0 0 0 0 rgba(27,143,200,0.5); }
    50%  { transform: scale(1.3); opacity: 0.8; box-shadow: 0 0 0 6px rgba(27,143,200,0); }
    100% { transform: scale(1);   opacity: 1;   box-shadow: 0 0 0 0 rgba(27,143,200,0); }
}

/* ============= FULLSCREEN ============= */

.fullscreen-btn {
    background: transparent;
    border: 1px solid #c8d6df;
    border-radius: 6px;
    color: #526D82;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    padding: 4px 8px;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.fullscreen-btn:hover {
    background: #e8f4f8;
    border-color: #1B8FC8;
    color: #1B8FC8;
}

/* Card em fullscreen: fundo branco, scroll se necessário */
.chart-card:fullscreen {
    background: #ffffff !important;
    padding: 20px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: auto !important;
}

/* Gráficos Plotly: ocupa a altura disponível */
.chart-card:fullscreen .fullscreen-graph {
    height: calc(100vh - 80px) !important;
    flex: 1 !important;
}

/* AG Grid: ocupa a altura disponível */
.chart-card:fullscreen .ag-theme-quartz {
    height: calc(100vh - 60px) !important;
    min-height: 0 !important;
}
