/* LittleRich - estilos propios (complementan Bootstrap 5) */

html, body {
    height: 100%;
}

body {
    background-color: #f4f6f9;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1 0 auto;
}

.footer {
    flex-shrink: 0;
    background: #fff;
}

.topbar .navbar-brand {
    letter-spacing: .3px;
}

.topbar .nav-link.active {
    font-weight: 600;
    color: #fff;
}

#botStatusBadge {
    font-weight: 500;
    font-size: .75rem;
    white-space: nowrap;
}

/* Tarjetas KPI */
.kpi-card {
    border: 0;
    border-radius: .75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
    height: 100%;
}

.kpi-card .kpi-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #6c757d;
}

.kpi-card .kpi-value {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
}

.kpi-card .kpi-sub {
    font-size: .8rem;
    color: #6c757d;
}

.kpi-card .kpi-icon {
    font-size: 1.6rem;
    opacity: .35;
}

/* Colores de PnL */
.pnl-pos {
    color: #198754;
    font-weight: 600;
}

.pnl-neg {
    color: #dc3545;
    font-weight: 600;
}

.pnl-zero {
    color: #6c757d;
}

/* Tarjetas de sección */
.card {
    border-radius: .75rem;
}

.card-header {
    background: #fff;
    font-weight: 600;
    border-bottom: 1px solid #eef0f3;
}

.table-sm > :not(caption) > * > * {
    padding: .35rem .5rem;
}

.table th {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: #6c757d;
    font-weight: 600;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

.table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mono {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: .85em;
}

/* Filas de log con error */
.log-error {
    background-color: #fff5f5 !important;
}

.log-warning {
    background-color: #fffbea !important;
}

pre.exception {
    font-size: .75rem;
    max-height: 320px;
    overflow: auto;
    background: #212529;
    color: #f8f9fa;
    padding: .75rem;
    border-radius: .5rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Indicador de estado del bot */
.status-dot {
    display: inline-block;
    width: .7rem;
    height: .7rem;
    border-radius: 50%;
    margin-right: .35rem;
}

.status-dot.on { background: #198754; box-shadow: 0 0 0 4px rgba(25, 135, 84, .15); }
.status-dot.off { background: #6c757d; }
.status-dot.warn { background: #ffc107; }
.status-dot.err { background: #dc3545; box-shadow: 0 0 0 4px rgba(220, 53, 69, .15); }

/* Línea de tiempo de eventos */
.timeline {
    list-style: none;
    padding-left: 0;
    margin: 0;
    position: relative;
}

.timeline::before {
    content: "";
    position: absolute;
    left: .6rem;
    top: .25rem;
    bottom: .25rem;
    width: 2px;
    background: #e9ecef;
}

.timeline li {
    position: relative;
    padding-left: 2.2rem;
    padding-bottom: .9rem;
}

.timeline li .tl-icon {
    position: absolute;
    left: 0;
    top: 0;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
}

.timeline li .tl-time {
    font-size: .75rem;
    color: #6c757d;
}

/* Login */
.auth-body {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

.auth-main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-foot {
    margin: 1.5rem 0 0;
    text-align: center;
    color: rgba(255, 255, 255, .6);
    font-size: .85rem;
}

/* Crédito «Powered by Kompass Labs» (pie del panel y del login). */
.lr-powered {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: middle;
}

.lr-powered img {
    display: block;
    width: 140px;
    height: auto;
    transition: opacity .15s ease;
}

.lr-powered:hover img {
    opacity: .8;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

.auth-card .brand {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: .3px;
}

/* Gráficos */
.chart-box {
    position: relative;
    height: 300px;
}

.chart-box.tall {
    height: 380px;
}

/* Definiciones (detalle de posición) */
.dl-grid {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 1rem;
    row-gap: .3rem;
    font-size: .9rem;
}

.dl-grid dt {
    color: #6c757d;
    font-weight: 500;
}

.dl-grid dd {
    margin: 0;
}

.text-break-all {
    word-break: break-all;
}

@media (max-width: 575.98px) {
    .kpi-card .kpi-value {
        font-size: 1.2rem;
    }

    .dl-grid {
        grid-template-columns: 1fr;
    }
}
