/* TradeBook — tema escuro (mesma paleta da planilha de gestão) */
:root {
    --bg: #14171C;
    --panel: #1C2028;
    --panel-2: #242A34;
    --input: #2B3442;
    --border: #39414F;
    --text: #E6E8EB;
    --muted: #8B93A1;
    --gold: #D4A537;
    --gold-hover: #E2B54A;
    --blue: #4C8DF6;
    --green: #26A69A;
    --green-dark: #1E4D47;
    --red: #EF5350;
    --red-dark: #7A2B2A;
    --orange: #F0A04B;
    --purple: #9C6ADE;
    --radius: 10px;
    --sidebar: 230px;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; font-weight: 700; }
h1 { font-size: 1.5rem; color: var(--gold); }
h2 { font-size: 1.1rem; color: var(--gold); margin-top: 1.5rem; }
small, .muted { color: var(--muted); }
.pos { color: var(--green) !important; }
.neg { color: var(--red) !important; }
.zero { color: var(--text); }
.gold { color: var(--gold); }
.laranja { color: var(--orange) !important; }
.etiqueta-aviso { display: inline-block; margin-left: 6px; font-size: .72rem; font-weight: 600; color: var(--orange); }
.hidden { display: none !important; }

/* ---------- estrutura ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar);
    flex-shrink: 0;
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.marca {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.1rem 1.2rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gold);
    border-bottom: 1px solid var(--border);
}
.marca:hover { text-decoration: none; }
.marca img { width: 28px; height: 28px; }

.menu { list-style: none; margin: 0; padding: .6rem 0; flex: 1; }
.menu .grupo {
    padding: .9rem 1.2rem .3rem;
    font-size: .7rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}
.menu a, .menu button {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    padding: .55rem 1.2rem;
    color: var(--text);
    background: none;
    border: 0;
    border-left: 3px solid transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--panel-2); text-decoration: none; }
.menu a.ativo { border-left-color: var(--gold); background: var(--panel-2); color: var(--gold); }
.menu svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; }

.usuario { padding: .9rem 1.2rem; border-top: 1px solid var(--border); font-size: .85rem; color: var(--muted); }

.topo-mobile { display: none; }

.conteudo { flex: 1; min-width: 0; padding: 1.5rem 2rem 3rem; }

.cabecalho {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
}
.cabecalho .sub { color: var(--muted); font-size: .9rem; }
.acoes { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---------- painéis ---------- */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
}
.card + .card { margin-top: 1rem; }

.filtros {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: flex-end;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .9rem 1rem;
    margin-bottom: 1.2rem;
}
.filtros .campo { min-width: 140px; flex: 1 1 140px; margin: 0; }

.kpis {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: .8rem;
    margin-bottom: 1.2rem;
}
.kpi {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .9rem 1rem;
    text-align: center;
}
.kpi .rotulo { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.kpi .valor { font-size: 1.6rem; font-weight: 700; margin-top: .2rem; white-space: nowrap; }
.kpi .extra { font-size: .78rem; color: var(--muted); }
.kpi.destaque .valor { color: var(--gold); }

.graficos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.grafico { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.grafico.largo { grid-column: 1 / -1; }
.grafico h3 { font-size: .95rem; color: var(--text); text-align: center; margin-bottom: .6rem; }
.grafico .area { position: relative; height: 260px; }
.grafico.largo .area { height: 300px; }
.sem-dados { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }

.progresso { height: 10px; background: var(--panel-2); border-radius: 5px; overflow: hidden; margin-top: .4rem; }
.progresso span { display: block; height: 100%; background: var(--gold); width: 0; transition: width .4s; }

/* ---------- alertas ---------- */
.alerta {
    padding: .8rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid;
}
.alerta.sucesso { background: rgba(38, 166, 154, .12); border-color: var(--green); color: #9fe3db; }
.alerta.erro { background: rgba(239, 83, 80, .12); border-color: var(--red); color: #ffb3b1; }
.alerta.aviso { background: rgba(240, 160, 75, .12); border-color: var(--orange); color: #ffd3a3; }
.alerta.info { background: rgba(76, 141, 246, .1); border-color: var(--blue); color: #b9d2fb; }

/* ---------- formulários ---------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .9rem 1rem;
}
.form-grid .inteiro { grid-column: 1 / -1; }
.campo { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .2rem; }
.campo label { font-size: .8rem; color: var(--muted); font-weight: 700; }
.campo .ajuda { font-size: .75rem; color: var(--muted); }
.campo .erro-campo { font-size: .78rem; color: var(--red); }
input, select, textarea {
    width: 100%;
    background: var(--input);
    color: #fff;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: .55rem .7rem;
    font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
input[type=checkbox] { width: auto; accent-color: var(--gold); }
input[type=file] { padding: .4rem; }
textarea { min-height: 90px; resize: vertical; }
.campo-data { position: relative; display: block; }
.campo-data input[data-mascara] { padding-right: 2.4rem; }
.campo-data .seletor-data { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; color-scheme: dark; }
.botao-calendario {
    position: absolute; right: .3rem; top: 50%; transform: translateY(-50%);
    display: flex; align-items: center; padding: .3rem; border: 0; border-radius: 5px;
    background: transparent; color: var(--muted); cursor: pointer;
}
.botao-calendario:hover, .botao-calendario:focus-visible { color: var(--gold); background: var(--border); }
.checkbox { display: flex; gap: .5rem; align-items: center; font-size: .9rem; }
.campo.invalido input, .campo.invalido select { border-color: var(--red); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
legend { color: var(--gold); font-weight: 700; padding: 0 .4rem; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1rem;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: var(--input); text-decoration: none; }
.btn.primario { background: var(--gold); border-color: var(--gold); color: #14171C; }
.btn.primario:hover { background: var(--gold-hover); }
.btn.perigo { border-color: var(--red); color: var(--red); background: transparent; }
.btn.perigo:hover { background: rgba(239, 83, 80, .12); }
.btn.pequeno { padding: .3rem .6rem; font-size: .82rem; }
.inline { display: inline; }

/* ---------- tabelas ---------- */
.tabela-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--border); text-align: center; white-space: nowrap; }
th { background: var(--panel-2); color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; }
tbody tr:nth-child(even) { background: #191D24; }
tbody tr:hover { background: var(--panel-2); }
td.texto { text-align: left; white-space: normal; min-width: 180px; color: var(--muted); }
td.forte { font-weight: 700; }
tr.clicavel { cursor: pointer; }

.badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    background: var(--panel-2);
    color: var(--text);
}
.badge.take1 { background: var(--green-dark); color: #fff; }
.badge.take2 { background: #1F6B60; color: #fff; }
.badge.take3 { background: var(--green); color: #fff; }
.badge.take4 { background: #4DB6AC; color: #fff; }
.badge.loss { background: var(--red-dark); color: #fff; }
.badge.zero-a-zero { background: #4A4F59; color: #fff; }
.badge.sem-entrada { background: #33383F; color: var(--muted); }
.badge.compra { color: var(--green); background: rgba(38, 166, 154, .12); }
.badge.venda { color: var(--red); background: rgba(239, 83, 80, .12); }
.badge.backtest { background: rgba(156, 106, 222, .18); color: var(--purple); }
.badge.dentro { background: rgba(38, 166, 154, .12); color: var(--green); }
.badge.fora { background: rgba(239, 83, 80, .15); color: var(--red); }
.badge.normal { background: rgba(255, 255, 255, .06); color: var(--muted); }
.badge.virada { background: rgba(77, 144, 254, .15); color: #6EA8FE; }
.badge.real { background: rgba(212, 165, 55, .15); color: var(--gold); }

.paginacao { display: flex; gap: .4rem; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }

/* ---------- detalhe ---------- */
.dados { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .8rem; }
.dado { background: var(--panel-2); border-radius: 8px; padding: .6rem .8rem; }
.dado .rotulo { font-size: .7rem; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.dado .valor { font-size: 1.05rem; font-weight: 700; }
.prints { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.print { background: var(--panel-2); border-radius: 8px; padding: .5rem; }
.print img { width: 100%; border-radius: 6px; display: block; }
.print .legenda { display: flex; justify-content: space-between; align-items: center; margin-top: .4rem; font-size: .8rem; color: var(--muted); }

/* ---------- login ---------- */
.login-pagina { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-caixa { width: 100%; max-width: 380px; }
.login-caixa .marca { justify-content: center; border: 0; font-size: 1.6rem; padding-bottom: .4rem; }
.login-caixa .card { padding: 1.5rem; }
.login-caixa .btn { width: 100%; justify-content: center; margin-top: .6rem; }

/* ---------- celular ---------- */
@media (max-width: 900px) {
    .app { flex-direction: column; }
    .topo-mobile {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: .7rem 1rem;
        background: var(--panel);
        border-bottom: 1px solid var(--border);
        position: sticky;
        top: 0;
        z-index: 20;
    }
    .topo-mobile .marca { padding: 0; border: 0; font-size: 1.1rem; }
    .topo-mobile button { background: none; border: 0; color: var(--text); padding: .3rem; cursor: pointer; }
    .topo-mobile svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 2; }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 30;
        transform: translateX(-100%);
        transition: transform .2s;
        box-shadow: 0 0 30px rgba(0, 0, 0, .6);
    }
    .sidebar.aberta { transform: none; }
    .conteudo { padding: 1rem; }
    .graficos { grid-template-columns: minmax(0, 1fr); }
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
    .kpi .valor { font-size: 1.25rem; }
    h1 { font-size: 1.25rem; }
    .acoes .btn { flex: 1 1 auto; justify-content: center; }
}

/* valor secundário embaixo do principal (na conta Cent: o valor em USC, como no MT5) */
.secundario { display: block; font-size: .75rem; font-weight: normal; color: var(--muted); white-space: nowrap; }

/* Quadro de mesa proprietária no painel */
h2 .sub { font-size: .85rem; color: var(--muted); font-weight: 400; }
p.ajuda { font-size: .78rem; color: var(--muted); margin: .4rem 0 1.2rem; }
