/* ──────────────────────────────────────────────────────────────────────────────
   Panel de inicio (index.html) — js/crud/inicio_dashboard.js
   Prefijo `dsh-`. Inputs, selects y botones: css/componentes.css (no se tocan aquí).
   Colores de las series (paleta categórica validada, orden fijo): 1 azul, 2 naranja, 3 aqua.
   ────────────────────────────────────────────────────────────────────────────── */

:root {
    --dsh-s1: #2a78d6;      /* serie 1: fotos / personas */
    --dsh-s2: #eb6834;      /* serie 2: carnets generados */
    --dsh-s3: #1baf7a;      /* serie 3: impresos */
    --dsh-neutro: #e2e8f0;  /* resto de una barra (sin foto, pendiente) */
    --dsh-tinta: #1e293b;
    --dsh-tinta-2: #52606d;
    --dsh-tinta-3: #8795a1;
    --dsh-borde: #eef1f5;
    --dsh-grid: #eef1f5;
}

/* ── Banner y panel (el panel solapa el banner, como en Control de Acceso) ── */
.main-header:has(.dsh-saludo) { padding-bottom: 64px; }
.dsh-saludo { animation: dsh-entra .6s ease both; }

.dsh-panel {
    margin-top: -36px;
    min-height: 0;
    padding: 24px 28px 28px;
    animation: dsh-entra .5s ease both;
}

@keyframes dsh-entra {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

/* ── Barra de filtros (una sola fila sobre los gráficos) ──────────────────── */
.dsh-barra {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 14px;
    margin-bottom: 22px;
}
.dsh-barra-titulo { flex: 1 1 320px; }
/* Los filtros se mueven juntos: si no caben al lado del título, bajan todos a la fila siguiente */
.dsh-filtros { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.dsh-barra-titulo h2 { font-size: 1.15rem; font-weight: 700; color: var(--dsh-tinta); margin: 0; }
.dsh-barra-titulo small { color: var(--dsh-tinta-2); }
.dsh-campo label { display: block; font-size: .78rem; color: var(--dsh-tinta-2); margin-bottom: 4px; }
.dsh-campo .form-control { min-width: 150px; }
.dsh-atajos { display: flex; gap: 6px; flex-wrap: wrap; }
.dsh-atajos .btn.activo { background: #eaf2fd; border-color: #b7d3f6 !important; color: #184f95; }

/* ── Tarjetas ─────────────────────────────────────────────────────────────── */
.dsh-tarjeta {
    position: relative;
    height: 100%;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid var(--dsh-borde);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
    animation: dsh-entra .5s ease both;
}
.dsh-titulo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: .88rem;
    font-weight: 700;
    color: var(--dsh-tinta);
}
.dsh-titulo i { color: #0253ac; }
.dsh-titulo .dsh-titulo-extra { margin-left: auto; font-weight: 500; font-size: .78rem; color: var(--dsh-tinta-3); }

/* KPI: número grande + barra */
a.dsh-kpi { display: block; color: inherit; text-decoration: none; transition: transform .2s ease, box-shadow .2s ease; }
a.dsh-kpi:hover { transform: translateY(-4px); box-shadow: 0 12px 26px rgba(2, 83, 172, .13); }
a.dsh-kpi:focus-visible { outline: 3px solid rgba(2, 83, 172, .35); outline-offset: 2px; }
.dsh-kpi-cabeza { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.dsh-kpi-icono {
    width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 1.15rem;
    background: #eaf2fd; color: #0253ac;
}
.dsh-kpi-etiqueta { font-size: .82rem; font-weight: 600; color: var(--dsh-tinta-2); line-height: 1.2; }
.dsh-kpi-numero { font-size: 2rem; font-weight: 800; color: var(--dsh-tinta); line-height: 1; letter-spacing: -.5px; }
.dsh-kpi-pie { margin-top: 8px; font-size: .78rem; color: var(--dsh-tinta-2); }
.dsh-kpi-pie strong { color: var(--dsh-tinta); }

/* Barra de proporción (medidor) */
.dsh-medidor { display: flex; gap: 2px; height: 8px; margin-top: 12px; border-radius: 4px; overflow: hidden; background: var(--dsh-neutro); }
.dsh-medidor span { display: block; height: 100%; border-radius: 4px; transition: width 1s cubic-bezier(.2, .8, .2, 1); }

/* ── Embudo: del registro a la entrega ────────────────────────────────────── */
.dsh-embudo { display: flex; flex-direction: column; gap: 10px; }
.dsh-paso { display: grid; grid-template-columns: 150px 1fr 110px; align-items: center; gap: 12px; font-size: .84rem; }
.dsh-paso-nombre { color: var(--dsh-tinta-2); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.dsh-paso-pista { height: 22px; border-radius: 4px; background: #f6f8fb; overflow: hidden; }
.dsh-paso-barra { height: 100%; border-radius: 0 4px 4px 0; background: var(--dsh-s1); width: 0; transition: width 1.1s cubic-bezier(.2, .8, .2, 1); }
.dsh-paso-valor { text-align: right; color: var(--dsh-tinta); font-weight: 700; font-variant-numeric: tabular-nums; }
.dsh-paso-valor small { font-weight: 500; color: var(--dsh-tinta-3); margin-left: 4px; }
.dsh-pendientes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.dsh-pendiente {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
    background: #f6f8fb; border: 1px solid var(--dsh-borde); font-size: .78rem; color: var(--dsh-tinta-2); text-decoration: none;
}
.dsh-pendiente:hover { background: #eaf2fd; color: #184f95; }
.dsh-pendiente strong { color: var(--dsh-tinta); }

/* ── Diseños ──────────────────────────────────────────────────────────────── */
.dsh-disenos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.dsh-diseno {
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px;
    border-radius: 10px; background: #f8fafc; border: 1px solid var(--dsh-borde); text-decoration: none; color: inherit;
    transition: background .15s ease, transform .15s ease;
}
.dsh-diseno:hover { background: #eaf2fd; transform: translateY(-2px); }
.dsh-diseno i { font-size: 1.3rem; color: #0253ac; }
.dsh-diseno strong { font-size: 1.6rem; font-weight: 800; color: var(--dsh-tinta); line-height: 1; }
.dsh-diseno span { font-size: .78rem; color: var(--dsh-tinta-2); line-height: 1.25; }

/* ── Actividad diaria (líneas) ────────────────────────────────────────────── */
.dsh-leyenda { display: flex; gap: 16px; flex-wrap: wrap; font-size: .78rem; color: var(--dsh-tinta-2); }
.dsh-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.dsh-leyenda i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.dsh-grafico { position: relative; margin-top: 10px; }
.dsh-grafico svg { display: block; width: 100%; height: 240px; overflow: visible; }
.dsh-grafico .dsh-eje { font-size: 11px; fill: var(--dsh-tinta-3); }
.dsh-grafico .dsh-grid { stroke: var(--dsh-grid); stroke-width: 1; }
.dsh-grafico .dsh-linea { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.dsh-grafico .dsh-cruz { stroke: #b7c4d4; stroke-width: 1; stroke-dasharray: 3 3; }
.dsh-grafico .dsh-punto { stroke: #fff; stroke-width: 2; }
/* Cruz y puntos solo con el cursor encima */
.dsh-grafico .dsh-cruz, .dsh-grafico .dsh-punto { visibility: hidden; }
.dsh-grafico.activo .dsh-cruz, .dsh-grafico.activo .dsh-punto { visibility: visible; }
.dsh-tooltip {
    position: absolute; pointer-events: none; z-index: 5; min-width: 150px;
    padding: 8px 10px; border-radius: 8px; background: #fff; border: 1px solid var(--dsh-borde);
    box-shadow: 0 8px 22px rgba(15, 23, 42, .14); font-size: .78rem; color: var(--dsh-tinta);
    opacity: 0; transition: opacity .12s ease;
}
.dsh-tooltip.visible { opacity: 1; }
.dsh-tooltip b { display: block; margin-bottom: 4px; }
.dsh-tooltip div { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.dsh-tooltip div span { display: inline-flex; align-items: center; gap: 6px; color: var(--dsh-tinta-2); }
.dsh-tooltip div i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.dsh-vacio { padding: 36px 12px; text-align: center; color: var(--dsh-tinta-3); font-size: .85rem; }

/* ── Tabla por listado ────────────────────────────────────────────────────── */
.dsh-tabla-envoltura { overflow-x: auto; }
.dsh-tabla { width: 100%; font-size: .84rem; border-collapse: separate; border-spacing: 0; }
.dsh-tabla th { font-size: .72rem; text-transform: uppercase; letter-spacing: .4px; color: var(--dsh-tinta-3); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--dsh-borde); white-space: nowrap; }
.dsh-tabla td { padding: 10px; border-bottom: 1px solid var(--dsh-borde); color: var(--dsh-tinta); font-variant-numeric: tabular-nums; }
.dsh-tabla tr:last-child td { border-bottom: 0; }
.dsh-tabla td.num, .dsh-tabla th.num { text-align: right; }
.dsh-celda-medidor { min-width: 140px; }
.dsh-celda-medidor .dsh-medidor { margin-top: 4px; height: 6px; }
.dsh-celda-medidor small { color: var(--dsh-tinta-3); }

@media (max-width: 767.98px) {
    /* El saludo ocupa dos líneas: el panel ya no solapa el banner */
    .main-header:has(.dsh-saludo) { height: auto; padding-bottom: 20px; margin-bottom: 12px; }
    .dsh-panel { margin-top: 0; padding: 18px 16px 22px; }
    .dsh-paso { grid-template-columns: 110px 1fr 84px; }
    .dsh-disenos { grid-template-columns: 1fr 1fr 1fr; }
    .dsh-diseno { padding: 10px; }
    .dsh-grafico svg { height: 200px; }
}

@media (prefers-reduced-motion: reduce) {
    .dsh-panel, .dsh-tarjeta, .dsh-saludo { animation: none; }
    .dsh-medidor span, .dsh-paso-barra { transition: none; }
}
