*{box-sizing:border-box}

body{
    font-family:Arial,sans-serif;
    margin:0;
    padding:15px 40px;
    background:#f5f5f5;
    font-size:13px;
    color:#222
}

h1{
    font-size:22px;
    margin:5px 0 15px
}

h2{
    font-size:16px;
    margin:18px 0 8px
}

/* TARJETAS */

.stats{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(140px,1fr));
    gap:8px;
    margin-bottom:15px
}

.card{
    background:white;
    padding:10px 12px;
    border-radius:6px
}

.card .titulo{
    font-size:11px;
    color:#777;
    margin-bottom:4px
}

.card .valor{
    font-size:17px;
    font-weight:bold
}

.card .positivo,.card .negativo{
    font-size:11px;
    font-weight:bold;
    margin-top:3px
}

/* VARIACIÓN */

.positivo{color:green}
.negativo{color:red}

/* TABLA */

table{
    width:100%;
    border-collapse:collapse;
    background:white;
    margin-bottom:18px;
    font-size:12px
}

th,td{
    padding:7px 8px;
    border-bottom:1px solid #ddd;
    text-align:right;
    white-space:nowrap
}

th{
    background:#222;
    color:white;
    font-size:11px
}

th:first-child,td:first-child{text-align:center}

.precio{font-weight:bold}

/* BOTONES */

button{
    padding:6px 9px;
    border:0;
    border-radius:4px;
    cursor:pointer;
    font-size:11px;
    font-weight:bold
}

.btn-vender{
    display:inline-block;
    padding:6px 9px;
    background:#222;
    color:#fff;
    text-decoration:none;
    border-radius:4px;
    font-size:11px;
    font-weight:bold;
    cursor:pointer
}

.btn-vender:hover{opacity:.8}

/* COMPRA */

.form-compra{
    display:flex;
    gap:6px;
    align-items:center;
    margin-bottom:12px
}

.form-compra input{
    padding:7px 8px;
    border:1px solid #ccc;
    border-radius:4px;
    font-size:12px;
    width:140px
}

.btn-comprar{
    padding:7px 11px;
    border:0;
    border-radius:4px;
    background:green;
    color:#fff;
    font-size:11px;
    font-weight:bold;
    cursor:pointer
}

.btn-comprar:hover{opacity:.8}

.card.posicion-compra{background:#f8d7da;border:1px solid #f1aeb5}
.card.posicion-neutral{background:#ffe5b4;border:1px solid #ffc66d}
.card.posicion-venta{background:#d1e7dd;border:1px solid #a3cfbb}
.card.posicion .titulo{color:#555}
.card.posicion-compra .valor{color:#842029}
.card.posicion-neutral .valor{color:#995c00}
.card.posicion-venta .valor{color:#0f5132}

tr.operacion-abierta td{background:#e8f2ff}
tr.operacion-cerrada td{background:#e0e0e0;color:#666}
tr.operacion-abierta:hover td{background:#d9eaff}
tr.operacion-cerrada:hover td{background:#d4d4d4}
tr.operacion-cerrada td.positivo{color:green}
tr.operacion-cerrada td.negativo{color:red}

td.posicion-tabla{font-weight:bold;text-align:center}
td.posicion-compra{background:#f8d7da!important;color:#842029!important}
td.posicion-neutral{background:#ffe5b4!important;color:#995c00!important}
td.posicion-venta{background:#d1e7dd!important;color:#0f5132!important}

.indicadores-mercado{
    display:grid;
    grid-template-columns:repeat(4,minmax(180px,1fr));
    gap:15px;
    margin-bottom:15px;
}

.indicador-caja{
    background:#fff;
    border:1px solid #ddd;
    border-radius:10px;
    padding:18px;
    text-align:center;
}

.indicador-titulo{
    font-size:13px;
    text-transform:uppercase;
    color:#777;
    margin-bottom:10px;
}

.indicador-icono{
    font-size:30px;
    font-weight:bold;
    line-height:1.2;
    margin:5px 0;
}

.indicador-estado{
    font-size:18px;
    font-weight:bold;
    margin:7px 0;
}

.indicador-detalle{
    font-size:13px;
    color:#777;
    margin-top:8px;
}

.alcista{
    color:#16803a;
}

.bajista{
    color:#c73535;
}

.neutral{
    color:#777;
}

.pendientes-mini{
    display:grid;
    grid-template-columns:repeat(5,1fr);
    gap:10px;
    margin-bottom:30px;
}

.pendientes-mini div{
    background:#f5f5f5;
    border-radius:7px;
    padding:10px;
    text-align:center;
    font-size:13px;
}

.pendientes-mini span{
    display:block;
    color:#777;
    margin-bottom:4px;
}

.pendientes-mini strong{
    font-size:14px;
}

@media(max-width:900px){

    .indicadores-mercado{
        grid-template-columns:repeat(2,1fr);
    }

    .pendientes-mini{
        grid-template-columns:repeat(2,1fr);
    }
}

.indicadores-mercado{
    display:grid;
    grid-template-columns:repeat(5,minmax(170px,1fr));
    gap:14px;
    margin-bottom:15px;
}

.indicador-caja{
    background:#fff;
    border:1px solid #ddd;
    border-radius:10px;
    padding:18px;
    text-align:center;
}

.indicador-titulo{
    font-size:13px;
    text-transform:uppercase;
    color:#777;
    margin-bottom:8px;
}

.indicador-icono{
    font-size:30px;
    font-weight:bold;
    line-height:1.2;
    margin:5px 0;
}

.indicador-estado{
    font-size:18px;
    font-weight:bold;
    margin:7px 0;
}

.indicador-detalle{
    font-size:13px;
    color:#777;
    margin-top:7px;
}

.indicador-explicacion{
    font-size:12px;
    line-height:1.4;
    color:#666;
    margin-top:12px;
    padding-top:10px;
    border-top:1px solid #eee;
}

.indicador-operativa{
    border-width:2px;
}

.alcista{
    color:#16803a;
}

.bajista{
    color:#c73535;
}

.neutral{
    color:#777;
}

@media(max-width:1100px){
    .indicadores-mercado{
        grid-template-columns:repeat(2,1fr);
    }
}

@media(max-width:600px){
    .indicadores-mercado{
        grid-template-columns:1fr;
    }
}

.operativa-badge{
    display:inline-block;
    padding:4px 9px;
    border-radius:12px;
    font-size:12px;
    font-weight:600;
    white-space:nowrap;
}

.operativa-normal{
    background:#e7f5ec;
    color:#16803a;
}

.operativa-precaucion{
    background:#fff4d6;
    color:#a66a00;
}

.operativa-frenar-compras{
    background:#fde8e8;
    color:#c73535;
}

.operativa-frenar-ventas{
    background:#e7f5ec;
    color:#16803a;
}

.operativa-sin-datos{
    background:#eee;
    color:#777;
}

/* RESPONSIVE */

@media(max-width:800px){
    body{padding:10px}
    .stats{grid-template-columns:repeat(2,1fr)}
    table{display:block;overflow-x:auto}
    .form-compra{flex-wrap:wrap}
}