/* ============================================================================
   CEO · TradeInStyle — Extensiones sobre el sistema de diseño de Planning.
   app.css y components.css se conservan intactos; aquí vive únicamente lo
   que el Command Center añade (marca, sparklines SVG propias, dona, copilot).
   ============================================================================ */

/* ── 1 · Marca del sidebar ──────────────────────────────────────────────── */
.sidebar-marca .marca-corona { color: var(--accent); display: inline-flex; flex: 0 0 auto; }
.sidebar-marca .marca-bloque { min-width: 0; }
.sidebar-marca .marca-titulo { letter-spacing: .22em; }
.sidebar-marca .marca-nota {
    display: block; margin-top: 2px;
    color: var(--sidebar-ink-dim);
    font-size: 9px; letter-spacing: .18em;
}

/* Subtítulo de cada item del menú (mockup UI-CEO) */
.nav-item .nav-bloque { flex: 1 1 auto; min-width: 0; }
.nav-item .nav-texto { display: block; }
.nav-item .nav-nota {
    display: block; margin-top: 1px;
    font-size: 10px; color: var(--sidebar-ink-dim);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-item.activo .nav-nota { color: rgba(255, 255, 255, .75); }
.nav-item:hover .nav-nota { color: var(--sidebar-ink); }

/* Pie del sidebar: usuario + salir */
.sidebar-pie { display: flex; align-items: center; gap: var(--sp-3); }
.sidebar-pie .usuario-avatar { background: var(--accent-strong); flex: 0 0 30px; }
.sidebar-pie .pie-bloque { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.sidebar-pie .pie-nombre {
    display: block; color: var(--sidebar-ink-on);
    font-size: var(--fs-sm); font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-pie .pie-puesto { display: block; font-size: var(--fs-xs); }
.sidebar-pie .pie-salir {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: var(--r-sm);
    color: var(--sidebar-ink-dim);
}
.sidebar-pie .pie-salir:hover { background: var(--sidebar-hover); color: var(--sidebar-ink-on); }

/* Marca en el login */
.auth-marca .marca-corona { color: var(--accent); }

/* ── 2 · Sparklines y gráficas SVG propias ──────────────────────────────── */
.kpi-sparkline .linea { stroke: var(--accent); stroke-width: 1.6; }
.kpi-sparkline .area  { fill: var(--accent-wash); }
.spark-verde .linea { stroke: var(--sem-green); }   .spark-verde .area { fill: var(--sem-green-wash); }
.spark-navy  .linea { stroke: var(--navy); }        .spark-navy  .area { fill: var(--sem-neutral-wash); }
.spark-ambar .linea { stroke: var(--sem-yellow); }  .spark-ambar .area { fill: var(--sem-yellow-wash); }
.spark-rojo  .linea { stroke: var(--sem-red); }     .spark-rojo  .area { fill: var(--sem-red-wash); }

.grafica-linea { display: block; width: 100%; height: auto; }
.grafica-linea .guia  { stroke: var(--line); stroke-width: 1; }
.grafica-linea .linea { stroke: var(--accent); stroke-width: 2; }
.grafica-linea .area  { fill: var(--accent-wash); }
.grafica-linea .punto { fill: var(--accent); }
.grafica-linea .eje   { fill: var(--muted); font-size: 10px; }
.linea-navy .linea { stroke: var(--navy); }  .linea-navy .punto { fill: var(--navy); }  .linea-navy .area { fill: var(--sem-neutral-wash); }

/* Dona de composición */
.donut-caja { position: relative; display: flex; align-items: center; justify-content: center; }
.donut { display: block; width: 168px; height: 168px; }
.donut-fondo { stroke: var(--surface-sunken); }
.donut-seg.seg-verde { stroke: var(--sem-green); }
.donut-seg.seg-navy  { stroke: var(--navy); }
.donut-seg.seg-ambar { stroke: var(--sem-yellow); }
.donut-seg.seg-rojo  { stroke: var(--sem-red); }
.donut-centro {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; pointer-events: none;
}
.donut-centro .cifra { font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.donut-centro .nota  { font-size: var(--fs-xs); color: var(--muted); }

/* Leyenda de la dona */
.leyenda-comp { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; flex: 1 1 auto; }
.leyenda-comp .fila-comp { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }
.leyenda-comp .punto-comp { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 9px; }
.punto-comp.seg-verde { background: var(--sem-green); }
.punto-comp.seg-navy  { background: var(--navy); }
.punto-comp.seg-ambar { background: var(--sem-yellow); }
.punto-comp.seg-rojo  { background: var(--sem-red); }
.leyenda-comp .nombre-comp { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leyenda-comp .monto-comp { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Barra mini de proporción en tablas */
.barra-mini { display: block; width: 72px; height: 6px; }
.barra-mini .fondo { fill: var(--surface-sunken); }
.barra-mini .valor { fill: var(--accent); }
.barra-verde .valor { fill: var(--sem-green); }
.barra-rojo  .valor { fill: var(--sem-red); }

/* ── 3 · Rejilla de KPIs héroe (6 columnas del mockup) ──────────────────── */
.kpis-hero { display: grid; gap: var(--sp-4); grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1500px) { .kpis-hero { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .kpis-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px)  { .kpis-hero { grid-template-columns: 1fr; } }
.kpi .kpi-cab { display: flex; align-items: center; gap: var(--sp-2); }
.kpi .kpi-icono { color: var(--accent-strong); display: inline-flex; flex: 0 0 auto; }

/* Fila inferior de indicadores clave */
.indicadores { display: grid; gap: 1px; background: var(--line); grid-template-columns: repeat(8, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
@media (max-width: 1400px) { .indicadores { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 760px)  { .indicadores { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.indicador { background: var(--surface); padding: var(--sp-3) var(--sp-4); }
.indicador .ind-titulo { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.indicador .ind-valor { font-size: var(--fs-xl); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin-top: 2px; }

/* ── 4 · Bandeja de decisiones (§28) ────────────────────────────────────── */
.lista-decisiones { display: flex; flex-direction: column; }
.decision {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--line);
}
.decision:last-child { border-bottom: 0; }
.decision .decision-icono {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: var(--r-sm);
    background: var(--accent-wash); color: var(--accent-ink); flex: 0 0 34px;
}
.decision .decision-bloque { flex: 1 1 auto; min-width: 0; }
.decision .decision-titulo { font-weight: 600; font-size: var(--fs-base); }
.decision .decision-detalle { font-size: var(--fs-sm); color: var(--muted); }

/* ── 5 · Copilot «Alicia» ───────────────────────────────────────────────── */
.copilot-burbuja {
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: var(--sp-4);
    font-size: var(--fs-base);
    white-space: pre-line;
}
.copilot-cab { display: flex; align-items: center; gap: var(--sp-3); }
.copilot-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--navy); color: #fff; flex: 0 0 34px;
}
.copilot-sugerencias { display: flex; flex-direction: column; gap: var(--sp-2); }
.copilot-sugerencias .btn { justify-content: flex-start; text-align: left; }
.copilot-entrada { display: flex; gap: var(--sp-2); }
.copilot-entrada input { flex: 1 1 auto; }
.copilot-hilo { display: flex; flex-direction: column; gap: var(--sp-3); }
.copilot-msj { display: flex; gap: var(--sp-3); }
.copilot-msj.es-ceo { flex-direction: row-reverse; }
.copilot-msj .msj-cuerpo {
    max-width: 72%;
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r);
    background: var(--surface-alt);
    border: 1px solid var(--line);
    white-space: pre-line;
}
.copilot-msj.es-ceo .msj-cuerpo { background: var(--accent-wash); border-color: var(--accent-soft); }

/* ── 6 · Pie con la cita de Adam Smith ──────────────────────────────────── */
.pie-smith {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4);
    margin-top: var(--sp-6); padding: var(--sp-4) var(--sp-5);
    border-top: 1px solid var(--line);
    color: var(--muted); font-size: var(--fs-sm);
}
.pie-smith .cita { flex: 1 1 380px; font-style: italic; }
.pie-smith .sello { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--accent-ink); }
.pie-smith .dominio { margin-left: auto; letter-spacing: .08em; font-size: var(--fs-xs); }

/* ── 7 · Detalles del home ──────────────────────────────────────────────── */
.saludo-bloque .saludo { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.01em; }
.saludo-bloque .saludo-sub { color: var(--muted); margin-top: 2px; }
.formula-nota { font-size: var(--fs-xs); color: var(--muted); }
.tarjeta-metrica-pie { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
@media (max-width: 700px) { .tarjeta-metrica-pie { grid-template-columns: 1fr; } }
.metrica-pie .mp-titulo { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.metrica-pie .mp-valor { font-size: var(--fs-lg); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Score con anillo (Wealth Score) */
.score-grande { font-size: 44px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* Alias explícitos del color por defecto (los listan las firmas de svg_*) */
.spark-acento .linea { stroke: var(--accent); }
.spark-acento .area  { fill: var(--accent-wash); }
.barra-acento .valor { fill: var(--accent); }

/* ── 8 · Tablero Colaboradores (2025 vs 2026, export estático del ERP) ──── */

/* Encabezados ordenables: la flecha la escribe tablero.js */
table.tabla th[data-orden] { cursor: pointer; user-select: none; }
table.tabla th[data-orden]:hover { color: var(--ink); }
table.tabla th .orden-flecha { display: inline-block; min-width: 10px; margin-left: 3px; }

/* La tabla por colaborador es ancha a propósito: se desplaza dentro de
   .tabla-envoltura, nunca la página. */
#tabla-colaboradores { min-width: 1080px; }

/* Nombre + puesto en la misma celda, como en la tabla original de Factor */
.tablero-nombre .puesto { font-size: var(--fs-xs); font-weight: 400; color: var(--muted); margin-top: 1px; }

/* Mezcla contado/crédito: pista marino (contado) con relleno dorado (crédito)
   anclado a la derecha; el ancho lo fija tablero.js vía CSSOM (CSP-safe). */
.tablero-mezcla-celda { display: inline-flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); }
.tablero-mezcla {
    position: relative; width: 64px; height: 6px; flex: 0 0 64px;
    border-radius: var(--r-pill); background: var(--navy); overflow: hidden;
}
.tablero-mezcla > span { position: absolute; top: 0; right: 0; bottom: 0; background: var(--accent); }

/* Punto de semáforo pegado a su cifra (ticket promedio, UPT) */
.tablero-semcelda { display: inline-flex; align-items: center; gap: 6px; }

/* Barras server-side alineadas con su cifra en columnas numéricas */
table.tabla td.num .barra-mini { margin-left: auto; margin-top: 3px; }

/* Leyenda del semáforo en el pie de la tarjeta */
.tablero-leyenda { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; }

/* Notas del corte */
.tablero-notas { margin: 0; padding-left: var(--sp-5); }
.tablero-notas li { color: var(--ink-2); font-size: var(--fs-sm); margin-bottom: var(--sp-2); }
.tablero-notas li:last-child { margin-bottom: 0; }

/* ── 8 · Colapso del sidebar en escritorio (como Factor) ────────────────── */
@media (min-width: 1025px) {
    .sidebar { transition: transform .2s ease; }
    .contenedor-principal { transition: margin-left .2s ease; }
    body.sidebar-oculta .sidebar { transform: translateX(-100%); }
    body.sidebar-oculta .contenedor-principal { margin-left: 0; }
    .btn-menu { display: inline-flex; }
}

/* Pastillas de mes del tablero Tesorería · Store Economics */
.pildoras-mes { padding: var(--sp-3) var(--sp-4) 0; }
.pildoras-mes a.chip:hover { text-decoration: none; box-shadow: inset 0 0 0 1px var(--accent-soft); }
.pildora-futuro { opacity: .55; }

/* Barra de reparto SVG (nómina: sucursales / crédito / corporativo) */
.reparto-svg { display: block; width: 100%; height: 10px; border-radius: 2px; }
.reparto-svg .fondo { fill: var(--surface-sunken); }
.reparto-svg .seg-verde { fill: var(--sem-green); }
.reparto-svg .seg-navy  { fill: var(--navy); }
.reparto-svg .seg-ambar { fill: var(--sem-yellow); }
.reparto-svg .seg-rojo  { fill: var(--sem-red); }

/* Metodología plegable del tablero Tesorería (cerrada por defecto) */
.plegable-metodo { margin: var(--sp-3) var(--sp-4) 0; }
.plegable-metodo .plegable-cuerpo { padding: 0 var(--sp-3) var(--sp-3); color: var(--ink-2); font-size: var(--fs-sm); }
