/* ============================================================
   TABLERO PRINCIPAL — replica del prototipo del requerimiento
   (issemym_tesoreria_prototipo.html), con acento azul Fluent del
   proyecto en vez del marrón institucional. Todo bajo .tbl-dash.
   ============================================================ */

.tbl-dash {
    padding: 18px 22px 36px 22px;
    color: #1A1A1A;
    font-size: 13.5px;
}

/* ===== Section header ===== */
.tbl-dash .sh { margin-bottom: 14px; }
.tbl-dash .sh-code {
    display: inline-block;
    font-size: 9.5px;
    font-weight: 700;
    font-family: 'Cascadia Code', Consolas, monospace;
    background: #f8eef0;
    color: #7a1f33;
    border: 1px solid #e3c4cb;
    border-radius: 4px;
    padding: 2px 7px;
    margin-bottom: 6px;
    letter-spacing: .06em;
}
.tbl-dash .sh-title { font-size: 20px; font-weight: 700; color: #1A1A1A; letter-spacing: -.02em; margin-bottom: 3px; }
.tbl-dash .sh-desc { font-size: 12px; color: #666; line-height: 1.55; max-width: 760px; }

/* ===== Alerts ===== */
.tbl-dash .al { display: flex; gap: 9px; align-items: flex-start; padding: 11px 14px; border-radius: 8px; font-size: 12px; margin-bottom: 13px; line-height: 1.5; }
.tbl-dash .al > span:first-child { font-weight: 700; flex-shrink: 0; }
.tbl-dash .al-ok { background: #EAF5F0; border: 1px solid #A8D9C4; color: #1A5C3A; }
.tbl-dash .al-warn { background: #FEF6E7; border: 1px solid #F0C97A; color: #7A4D07; }
.tbl-dash .al-info { background: #EAF1FA; border: 1px solid #A8C8EC; color: #1A3A5C; }
.tbl-dash .al-danger { background: #FEE2E2; border: 1px solid #FCA5A5; color: #991B1B; }

/* ===== KPI grid ===== */
.tbl-dash .kg { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 9px; margin-bottom: 12px; }
.tbl-dash .kp {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-top: 3px solid #7A1F33;
    border-radius: 12px;
    padding: 13px 15px;
    box-shadow: 0 2px 8px rgba(10, 26, 43, 0.04);
    transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.tbl-dash .kp:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(122, 31, 51, 0.12); }
.tbl-dash .kp-ico {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #7A1F33;
    background: linear-gradient(135deg, rgba(122, 31, 51, 0.10), rgba(200, 80, 90, 0.16));
}
.tbl-dash .kp-body { min-width: 0; }
.tbl-dash .kp-l { font-size: 10px; color: #8a93a0; margin-bottom: 3px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.tbl-dash .kp-v { font-size: 21px; font-weight: 700; color: #1A1A1A; letter-spacing: -.02em; white-space: nowrap; }
.tbl-dash .kp-s { font-size: 9.5px; color: #AAA; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl-dash .kp-var { font-size: 10px; font-weight: 700; margin-top: 3px; white-space: nowrap; }
.tbl-dash .kp-var.up { color: #107c10; }
.tbl-dash .kp-var.down { color: #c0392b; }
.tbl-dash .kp-spark { height: 30px; margin-top: 6px; }
.tbl-dash .kp-spark canvas { max-width: 100%; }
.tbl-dash .kp-v.ok { color: #166534; }
.tbl-dash .kp-v.warn { color: #B45309; }
.tbl-dash .kp-v.danger { color: #B91C1C; }

/* ===== Cards ===== */
.tbl-dash .cd { background: #fff; border: 1px solid rgba(0,0,0,0.06); border-radius: 12px; margin-bottom: 12px; overflow: hidden; box-shadow: 0 2px 10px rgba(10,26,43,0.04); transition: box-shadow 0.15s ease; }
.tbl-dash .cd:hover { box-shadow: 0 10px 26px rgba(10,26,43,0.10); }
.tbl-dash .cd-hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 15px; border-bottom: 1px solid rgba(0,0,0,0.06); flex-wrap: wrap; }
.tbl-dash .cd-title { font-size: 12.5px; font-weight: 700; color: #1A1A1A; position: relative; padding-left: 11px; }
.tbl-dash .cd-title::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 14px; border-radius: 2px; background: #7A1F33; }
.tbl-dash .ab { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ===== Grids ===== */
.tbl-dash .g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-bottom: 12px; }
@media (max-width: 900px) { .tbl-dash .g2 { grid-template-columns: 1fr; } }

/* ===== Gráficas ===== */
.tbl-dash .tbl-charts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 11px;
    margin-bottom: 12px;
}
@media (max-width: 1100px) { .tbl-dash .tbl-charts { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px)  { .tbl-dash .tbl-charts { grid-template-columns: 1fr; } }
.tbl-dash .tbl-chart { height: 260px; padding: 12px 14px 16px; position: relative; }

/* ===== Tables ===== */
.tbl-dash table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.tbl-dash th { text-align: left; padding: 7px 11px; font-size: 10px; font-weight: 600; color: #777; background: #F4F7FB; border-bottom: 1px solid rgba(0,0,0,0.07); white-space: nowrap; text-transform: uppercase; letter-spacing: .03em; }
.tbl-dash td { padding: 7px 11px; border-bottom: 1px solid rgba(0,0,0,0.05); color: #1A1A1A; vertical-align: middle; }
.tbl-dash tr:last-child td { border-bottom: none; }
.tbl-dash tbody tr:hover td { background: #F5F9FF; }
.tbl-dash mono, .tbl-dash .mono { font-family: 'Cascadia Code', Consolas, monospace; font-size: 10.5px; }

/* ===== Badges ===== */
.tbl-dash .bd { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 600; white-space: nowrap; }
.tbl-dash .bd-ok { background: #DCFCE7; color: #166534; }
.tbl-dash .bd-warn { background: #FEF3C7; color: #92400E; }
.tbl-dash .bd-danger { background: #FEE2E2; color: #991B1B; }
.tbl-dash .bd-blue { background: #DBEAFE; color: #1E40AF; }
.tbl-dash .bd-gray { background: #F3F4F6; color: #4B5563; }

/* ===== Fill bar ===== */
.tbl-dash .fb { height: 5px; border-radius: 3px; background: #E5E7EB; margin-top: 4px; overflow: hidden; }
.tbl-dash .fb-f { height: 100%; border-radius: 3px; background: #7a1f33; }

/* ===== Steps ===== */
.tbl-dash .steps { display: flex; background: #fff; border: 1px solid rgba(0,0,0,0.08); border-radius: 9px; overflow: hidden; margin-bottom: 8px; }
.tbl-dash .step { flex: 1; padding: 8px 9px; font-size: 10px; border-right: 1px solid rgba(0,0,0,0.06); color: #AAA; line-height: 1.35; border-top: 2px solid transparent; }
.tbl-dash .step:last-child { border-right: none; }
.tbl-dash .step.done { color: #166534; border-top-color: #22C55E; background: #F0FDF4; }
.tbl-dash .step.act { color: #7a1f33; border-top-color: #7a1f33; background: #f8eef0; font-weight: 600; }
.tbl-dash .step .sn { display: block; font-size: 8.5px; font-weight: 700; opacity: .6; margin-bottom: 1px; }

/* ===== Validation panel (INNOVION vs NG6068) ===== */
.tbl-dash .vp { display: grid; grid-template-columns: 1fr auto 1fr; background: #fff; border: 1px solid rgba(0,0,0,0.08); border-radius: 12px; margin-bottom: 12px; overflow: hidden; border-left: 3px solid #7a1f33; box-shadow: 0 2px 10px rgba(0,0,0,0.04); }
@media (max-width: 1000px) { .tbl-dash .vp { grid-template-columns: 1fr; } }
.tbl-dash .vp-col { padding: 14px 16px; }
.tbl-dash .vp-mid { padding: 14px 12px; background: #F7F9FC; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-width: 122px; border-left: 1px solid rgba(0,0,0,0.06); border-right: 1px solid rgba(0,0,0,0.06); }
.tbl-dash .vp-tag { font-size: 8.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #AAA; text-align: center; }
.tbl-dash .vp-var { border-radius: 6px; padding: 4px 9px; font-size: 12px; font-weight: 700; text-align: center; }
.tbl-dash .vp-sep { width: 1px; height: 14px; background: #DDD; }
.tbl-dash .vp-lbl { font-size: 9.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; margin-bottom: 10px; }
.tbl-dash .mini-kp { border-radius: 7px; padding: 9px 11px; margin-bottom: 8px; }
.tbl-dash .mini-kp-l { font-size: 9.5px; margin-bottom: 2px; }
.tbl-dash .mini-kp-v { font-size: 16px; font-weight: 700; }
.tbl-dash .mini-kp-s { font-size: 9px; margin-top: 1px; }
.tbl-dash .vp-total { border-radius: 7px; padding: 10px 12px; border: 1px solid; }
.tbl-dash .vp-total-l { font-size: 9.5px; font-weight: 600; margin-bottom: 2px; }
.tbl-dash .vp-total-v { font-size: 21px; font-weight: 700; }
.tbl-dash .vp-total-s { font-size: 9.5px; margin-top: 1px; }

/* ===== Variation footer banner ===== */
.tbl-dash .var-foot { background: #FFFBF0; border: 1px solid #F0C97A; border-radius: 8px; padding: 9px 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.tbl-dash .var-foot .vf-lbl { font-size: 11.5px; font-weight: 700; color: #92400E; }
.tbl-dash .var-foot .vf-amt { background: #FEE2E2; color: #991B1B; border-radius: 4px; padding: 2px 9px; font-size: 11.5px; font-weight: 700; }
.tbl-dash .var-foot .vf-desc { font-size: 11px; color: #777; }

/* Botón discreto del tablero */
.tbl-dash .btn-dash {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 11px; font-size: 11px; border-radius: 6px; cursor: pointer;
    border: 1px solid #FCD34D; background: #FEF3C7; color: #92400E; font-weight: 600;
    font-family: inherit;
}
.tbl-dash .btn-dash:hover { background: #FDE9A8; }
.tbl-dash .ml-auto { margin-left: auto; }

/* Botón primario (guinda) del tablero */
.tbl-dash .btn-dash-primary { background: #7A1F33; color: #fff; border-color: #7A1F33; }
.tbl-dash .btn-dash-primary:hover { background: #5C1726; border-color: #5C1726; }
.tbl-dash .btn-dash-primary:disabled { opacity: 0.6; cursor: default; }

/* Separador entre secciones del tablero */
.tbl-dash .tbl-sec { margin-top: 24px; padding-top: 16px; border-top: 1px solid rgba(0, 0, 0, 0.10); }

/* Encabezado con acción a la derecha */
.tbl-dash .tbl-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

/* Indicador de carga del tablero */
.tbl-dash .tbl-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 44px;
    color: #605e5c;
    font-size: 13px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
}

.tbl-dash .tbl-loading .spinner-border { color: #7A1F33; }

/* Acciones del encabezado (combo período + actualizar) */
.tbl-dash .tbl-head-actions { display: flex; align-items: center; gap: 8px; }
.tbl-dash .tbl-periodo-lbl { font-size: 11px; font-weight: 600; color: #777; }
.tbl-dash .tbl-periodo {
    padding: 7px 10px;
    border: 1px solid #cbd2da;
    border-radius: 7px;
    font-size: 12.5px;
    font-family: inherit;
    color: #1A1A1A;
    background: #fff;
    cursor: pointer;
    max-width: 240px;
}
.tbl-dash .tbl-periodo:focus { outline: none; border-color: #7A1F33; }
.tbl-dash .tbl-updated { font-size: 11px; color: #8a93a0; white-space: nowrap; align-self: center; }

/* ===== Skeletons (placeholders animados) ===== */
.tbl-dash .sk {
    background: linear-gradient(90deg, #eef1f5 25%, #e1e7ef 37%, #eef1f5 63%);
    background-size: 400% 100%;
    animation: skShimmer 1.3s ease-in-out infinite;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
}
@keyframes skShimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.tbl-dash .sk-kpi { height: 72px; }
.tbl-dash .sk-chart { height: 260px; }

/* ===== Modo filtro (interruptor) ===== */
.tbl-dash .tbl-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 10px; border: 1px solid #cbd2da; border-radius: 7px;
    background: #fff; font-size: 12px; color: #5b6472; cursor: pointer;
    user-select: none; white-space: nowrap; align-self: center;
}
.tbl-dash .tbl-toggle input { accent-color: #7A1F33; cursor: pointer; margin: 0; }
.tbl-dash .tbl-toggle:hover { border-color: #7A1F33; color: #5c1726; }
.tbl-dash .tbl-toggle.off { opacity: .5; cursor: progress; }
.tbl-dash .tbl-toggle.off input { cursor: progress; }

/* ===== Chips de filtros activos (cross-filter) ===== */
.tbl-dash .tbl-filtros {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin: 2px 0 14px; padding: 10px 12px;
    background: #f8eef0; border: 1px solid #e3c4cb; border-radius: 10px;
}
.tbl-dash .tbl-filtros-lbl { font-size: 12px; font-weight: 700; color: #5c1726; }
.tbl-dash .tbl-filtros-hint { color: #7a1f33; font-size: 12px; font-weight: 600; }
.tbl-dash .tbl-filtros-hint i { margin-right: 4px; }
.tbl-dash .tbl-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; border: 1px solid #e3c4cb; border-radius: 999px;
    padding: 3px 6px 3px 12px; font-size: 12px; color: #3a3a3a;
}
.tbl-dash .tbl-chip strong { color: #5c1726; }
.tbl-dash .tbl-chip button {
    border: none; background: #7A1F33; color: #fff; cursor: pointer;
    width: 18px; height: 18px; border-radius: 50%; line-height: 1;
    font-size: 13px; display: inline-flex; align-items: center; justify-content: center;
}
.tbl-dash .tbl-chip button:hover { background: #5c1726; }
.tbl-dash .tbl-chip-clear {
    border: 1px solid #7A1F33; background: transparent; color: #7A1F33;
    border-radius: 7px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.tbl-dash .tbl-chip-clear:hover { background: #7A1F33; color: #fff; }

/* ===== Impresión (Exportar a PDF) ===== */
@media print {
    @page { size: A4 landscape; margin: 8mm; }

    /* Ocultar todo lo que no es el tablero */
    .tes-sidebar, .tes-topbar, .toast-host, .alert-overlay, .canvas-overlay { display: none !important; }
    .tbl-dash .tbl-head-actions { display: none !important; }
    .tbl-dash .tbl-filtros-hint, .tbl-dash .tbl-chip button, .tbl-dash .tbl-chip-clear { display: none !important; }

    .tes-shell { display: block !important; background: #fff !important; }
    .tes-content { margin: 0 !important; width: 100% !important; }
    .app-main { display: block !important; }
    .tbl-dash { padding: 4px !important; }

    /* Menos columnas para que quepa y no se corte horizontalmente */
    .tbl-dash .kg { grid-template-columns: repeat(3, 1fr) !important; }
    .tbl-dash .tbl-charts { grid-template-columns: repeat(2, 1fr) !important; }
    .tbl-dash .g2 { grid-template-columns: 1fr !important; }

    /* Que ninguna tarjeta se parta entre páginas */
    .tbl-dash .cd, .tbl-dash .kp {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none !important;
    }
    .tbl-dash .cd:hover, .tbl-dash .kp:hover { transform: none !important; }
    .tbl-dash canvas { max-width: 100% !important; }
}
