/* ==========================================================================
   🎋 BAMBU INVEST - PALETA DE CORES & DESIGN SYSTEM OFICIAL
   Preto: #000000 | Cinza Escuro: #797B7B | Cinza 2: #646465
   Verde Escuro: #0F3827 | Verde Claro: #266244 | Fundo: #F7F5F0 | Branco: #FFFFFF
   ========================================================================== */

:root {
    --bambu-black: #000000;
    --bambu-gray-dark: #797B7B;
    --bambu-gray-2: #646465;
    --bambu-green-dark: #0F3827;
    --bambu-green-light: #266244;
    --bambu-bg: #F7F5F0;
    --bambu-white: #FFFFFF;
    --bambu-border: #e2e0d8;
}

.bambu-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: var(--bambu-black);
    line-height: 1.5;
    box-sizing: border-box;
}

.bambu-wrapper * {
    box-sizing: border-box;
}

/* CARDS */
.bambu-card {
    background: var(--bambu-white);
    border: 1px solid var(--bambu-border);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(15, 56, 39, 0.04);
    margin-bottom: 25px;
}

/* BOTÕES */
.bambu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    border: none;
}

.bambu-btn-primary {
    background-color: var(--bambu-green-dark) !important;
    color: var(--bambu-white) !important;
}

.bambu-btn-primary:hover {
    background-color: var(--bambu-green-light) !important;
    color: var(--bambu-white) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 56, 39, 0.15);
}

.bambu-btn-secondary {
    background-color: transparent !important;
    border: 1px solid var(--bambu-gray-dark) !important;
    color: var(--bambu-green-dark) !important;
}

.bambu-btn-secondary:hover {
    background-color: var(--bambu-bg) !important;
    border-color: var(--bambu-green-dark) !important;
}

.bambu-btn-accent {
    background-color: var(--bambu-green-light) !important;
    color: var(--bambu-white) !important;
}

.bambu-btn-accent:hover {
    background-color: var(--bambu-green-dark) !important;
}

/* PROGRESS BAR */
.bambu-progress-bar-wrap {
    background: #e5e5dc;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 25px;
}

.bambu-progress-bar {
    background: linear-gradient(90deg, var(--bambu-green-dark), var(--bambu-green-light));
    height: 100%;
    transition: width 0.4s ease;
}

/* BADGES & PILLS */
.bambu-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

.bambu-badge-green {
    background: #e6ede9;
    color: var(--bambu-green-dark);
    border: 1px solid #c2d6cb;
}

.bambu-badge-gray {
    background: #f0f0eb;
    color: var(--bambu-gray-2);
    border: 1px solid #d9d8cf;
}

/* ABAS / TABS */
.bambu-tabs-header {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--bambu-border);
    margin-bottom: 25px;
    overflow-x: auto;
}

.bambu-tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--bambu-gray-2);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    white-space: nowrap;
}

.bambu-tab-btn:hover {
    color: var(--bambu-green-dark);
}

.bambu-tab-btn.active {
    color: var(--bambu-green-dark);
    border-bottom-color: var(--bambu-green-dark);
}

/* INPUTS & SELECTS */
.bambu-input, .bambu-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1cfc7;
    border-radius: 8px;
    font-size: 15px;
    background: #ffffff;
    color: var(--bambu-black);
    transition: border-color 0.2s;
}

.bambu-input:focus, .bambu-select:focus {
    outline: none;
    border-color: var(--bambu-green-dark);
    box-shadow: 0 0 0 3px rgba(15, 56, 39, 0.1);
}

/* TABELAS */
.bambu-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 14px;
}

.bambu-table th {
    background: #f2f0e8;
    color: var(--bambu-green-dark);
    font-weight: 700;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 2px solid var(--bambu-border);
}

.bambu-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #ebe9e1;
    color: var(--bambu-black);
}

.bambu-table tr:hover {
    background: #faf9f5;
}

/* ALERTAS */
.bambu-alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
}

.bambu-alert-warning {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

.bambu-alert-success {
    background: #edf5f0;
    border-left: 4px solid var(--bambu-green-dark);
    color: var(--bambu-green-dark);
}

.bambu-alert-info {
    background: #f4f4ef;
    border-left: 4px solid var(--bambu-gray-dark);
    color: var(--bambu-black);
}

/* MODAL */
.bambu-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    overflow-y: auto;
    padding: 20px 10px;
    box-sizing: border-box;
}

.bambu-modal-content {
    background: #ffffff;
    max-width: 850px;
    margin: 30px auto;
    border-radius: 14px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    position: relative;
}

/* ===================== Panorama do ativo (aba Busca e pop-up) ===================== */
.bambu-panorama { font-size: 13.5px; color: #1f2937; }
.bambu-pan-cabecalho { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; padding: 14px 16px; background: #f8faf9; border: 1px solid #e2e8f0; border-radius: 10px; }
.bambu-pan-logo { width: 48px; height: 48px; border-radius: 8px; object-fit: contain; background: #fff; border: 1px solid #e2e8f0; }
.bambu-pan-titulo { flex: 1; min-width: 220px; }
.bambu-pan-ticker-linha { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bambu-pan-ticker { font-size: 26px; font-weight: 800; color: #0F3827; letter-spacing: 0.5px; }
.bambu-pan-nome { font-size: 14px; color: #475569; margin-top: 2px; }
.bambu-pan-modo { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.bambu-pan-modo-live { background: #dcfce7; color: #166534; }
.bambu-pan-modo-sim { background: #fef3c7; color: #92400e; }
.bambu-pan-preco-box { text-align: right; min-width: 170px; }
.bambu-pan-preco-rotulo { display: block; font-size: 11.5px; color: #64748b; text-transform: uppercase; letter-spacing: 0.4px; }
.bambu-pan-preco { display: block; font-size: 30px; font-weight: 800; color: #0F3827; line-height: 1.1; }
.bambu-pan-var { font-size: 13px; font-weight: 600; }
.bambu-pan-pos { color: #15803d; }
.bambu-pan-neg { color: #b91c1c; }
.bambu-pan-salvar { padding: 6px 14px !important; font-size: 13px !important; }
.bambu-pan-salvar.bambu-pan-salvo { background: #dcfce7 !important; color: #166534 !important; border-color: #86efac !important; }
.bambu-pan-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.bambu-pan-kpi { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.bambu-pan-kpi-rotulo { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: 0.3px; }
.bambu-pan-kpi-valor { font-size: 16px; font-weight: 700; color: #0F3827; }
.bambu-pan-kpi-sub { font-size: 11px; color: #94a3b8; }
.bambu-pan-secao { margin-top: 14px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; }
.bambu-pan-secao > summary { cursor: pointer; padding: 12px 16px; font-weight: 700; color: #0F3827; font-size: 15px; list-style: none; display: flex; align-items: center; }
.bambu-pan-secao > summary::-webkit-details-marker { display: none; }
.bambu-pan-secao > summary::before { content: '▸'; margin-right: 8px; color: #94a3b8; transition: transform .15s; }
.bambu-pan-secao[open] > summary::before { transform: rotate(90deg); }
.bambu-pan-secao-corpo { padding: 4px 16px 16px 16px; }
.bambu-pan-secao-corpo h4 { margin: 14px 0 8px 0; font-size: 13.5px; color: #0F3827; }
.bambu-pan-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.bambu-pan-resumo { line-height: 1.55; color: #334155; text-align: justify; }
.bambu-pan-tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.bambu-pan-tabela th, .bambu-pan-tabela td { padding: 7px 10px; border-bottom: 1px solid #eef2f6; text-align: left; vertical-align: top; }
.bambu-pan-tabela th { background: #f1f5f9; font-weight: 700; color: #334155; font-size: 12px; white-space: nowrap; }
.bambu-pan-tabela td.bambu-pan-num, .bambu-pan-quadro td:not(:first-child), .bambu-pan-quadro th:not(:first-child) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bambu-pan-formula { color: #64748b; font-size: 12px; }
.bambu-pan-obs { color: #64748b; font-size: 12px; margin: 6px 0 0 0; }
.bambu-pan-vazio { color: #64748b; font-size: 12.5px; font-style: italic; }
.bambu-pan-aviso { color: #92400e; background: #fffbeb; border: 1px solid #fde68a; padding: 8px 12px; border-radius: 6px; font-size: 12px; margin-top: 10px; }
.bambu-pan-scroll { overflow-x: auto; margin-bottom: 14px; }
.bambu-pan-scroll-alto { max-height: 320px; overflow-y: auto; }
.bambu-pan-graf-controles { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; margin: 6px 0 10px 0; }
.bambu-pan-periodos { display: flex; gap: 4px; flex-wrap: wrap; }
.bambu-pan-per { border: 1px solid #cbd5e1; background: #fff; color: #334155; border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.bambu-pan-per.active { background: #0F3827; color: #fff; border-color: #0F3827; }
.bambu-pan-benchs { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: #334155; align-items: center; }
.bambu-pan-benchs label { cursor: pointer; }
.bambu-pan-benchs label.bambu-pan-indisp { color: #94a3b8; cursor: help; }
.bambu-pan-graf-wrap { position: relative; height: 340px; }
.bambu-pan-graf-nota { font-size: 12px; color: #64748b; margin-top: 8px; }
.bambu-pan-subtabs { display: flex; gap: 6px; margin: 8px 0 12px 0; }
.bambu-pan-subtabs button { border: 1px solid #cbd5e1; background: #fff; border-radius: 6px; padding: 5px 14px; font-size: 12.5px; cursor: pointer; }
.bambu-pan-subtabs button.active { background: #0F3827; color: #fff; border-color: #0F3827; }
.bambu-pan-metodo { margin-bottom: 18px; }
.bambu-pan-metodo p { color: #475569; font-size: 13px; margin: 0 0 8px 0; }
.bambu-pan-glossario details { border-bottom: 1px solid #eef2f6; padding: 6px 0; }
.bambu-pan-glossario summary { cursor: pointer; font-weight: 600; color: #0F3827; }
.bambu-pan-glossario p { margin: 4px 0 4px 14px; font-size: 12.5px; color: #334155; }
.bambu-pan-glossario code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; }
.bambu-pan-carregando { padding: 20px; text-align: center; color: #475569; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 8px; }
/* Pop-up */
.bambu-pan-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55); z-index: 99999; display: none; align-items: center; justify-content: center; padding: 3vh 3vw; }
.bambu-pan-overlay.aberta { display: flex; }
.bambu-pan-janela { background: #fff; width: 1100px; max-width: 94vw; height: 88vh; border-radius: 12px; box-shadow: 0 25px 60px rgba(0,0,0,0.35); display: flex; flex-direction: column; overflow: hidden; }
.bambu-pan-janela.bambu-pan-maximizada { width: 100vw; max-width: 100vw; height: 100vh; border-radius: 0; }
.bambu-pan-janela-barra { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; background: #0F3827; color: #fff; font-weight: 600; font-size: 14px; flex-shrink: 0; }
.bambu-pan-janela-botoes button { background: transparent; border: 1px solid rgba(255,255,255,0.35); color: #fff; border-radius: 6px; width: 32px; height: 28px; margin-left: 6px; cursor: pointer; font-size: 14px; line-height: 1; }
.bambu-pan-janela-botoes button:hover { background: rgba(255,255,255,0.15); }
.bambu-pan-janela-corpo { overflow-y: auto; padding: 16px; flex: 1; }
body.bambu-pan-sem-scroll { overflow: hidden; }
@media (max-width: 640px) { .bambu-pan-preco-box { text-align: left; } .bambu-pan-janela { height: 94vh; } }

/* Ticker clicável (abre o panorama do ativo) — usado no Painel */
.bambu-ticker-btn { background: transparent; border: 1px solid transparent; padding: 3px 6px; border-radius: 5px; cursor: pointer; color: #0F3827; font-size: 13px; display: inline-flex; align-items: center; text-decoration: underline; text-decoration-color: rgba(15, 56, 39, 0.4); transition: all 0.2s ease; font-family: inherit; }
.bambu-ticker-btn:hover, .bambu-ticker-btn:focus, .bambu-ticker-btn:active { background: #e8f2ec !important; border-color: #0F3827 !important; color: #0F3827 !important; text-decoration-color: #0F3827; box-shadow: none; }
.bambu-ticker-btn span { color: inherit; }
