/* ══════════════════════════════════════════════════════════════════════════
   _ayuda_inicio.css — Pantalla inicial del manual (dashboard de ejemplo).
   Tema navy del índice: --ay-navy1 / --ay-body / --ay-border / --ay-ink /
   --ay-muted / --ay-accent (definidos en index.php).
   ══════════════════════════════════════════════════════════════════════════ */

.ay-ini { width: 100%; max-width: 1180px; margin: 0 auto; text-align: left; }

/* ── Bienvenida ──────────────────────────────────────────────────────────── */
.ay-hero {
    display: flex; align-items: center; gap: 18px;
    background: linear-gradient(135deg, var(--ay-navy1), var(--ay-navy2));
    color: #fff; border-radius: 14px;
    padding: 22px 26px; margin-bottom: 26px;
    box-shadow: 0 6px 20px rgba(8,20,40,.16);
}
.ay-hero-ico {
    width: 56px; height: 56px; border-radius: 14px; flex-shrink: 0;
    background: rgba(255,255,255,.14);
    display: flex; align-items: center; justify-content: center;
}
.ay-hero-ico i { font-size: 1.6rem; }
.ay-hero-txt h2 { font-size: 1.22rem; font-weight: 700; margin: 0 0 4px; color: #fff; }
.ay-hero-txt p  { font-size: .87rem; line-height: 1.5; color: rgba(255,255,255,.82); margin: 0; }
.ay-hero-hint {
    margin-top: 8px; font-size: .74rem; color: rgba(255,255,255,.68);
    display: flex; align-items: center; gap: 6px;
}
.ay-hero-hint i { color: #fcd34d; }

/* ── Encabezado de sección ───────────────────────────────────────────────── */
.ay-seccion-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; margin-bottom: 4px;
}
.ay-seccion-tit {
    display: flex; align-items: center; gap: 9px;
    font-size: 1rem; font-weight: 700; color: var(--ay-navy1);
}
.ay-seccion-tit i { color: var(--ay-accent); font-size: 1.05rem; }
.ay-chip-demo {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .7rem; font-weight: 700; letter-spacing: .3px;
    color: #92400e; background: #fef3c7; border: 1px solid #fde68a;
    padding: 4px 10px; border-radius: 999px;
}
.ay-seccion-sub {
    font-size: .82rem; line-height: 1.5; color: var(--ay-muted);
    margin: 0 0 16px; max-width: 780px;
}
.ay-seccion-sub b { color: var(--ay-ink); }

/* ── Selector de sector (tipo de negocio) ───────────────────────────────── */
.ay-sectores {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin: 0 0 16px; padding: 4px;
    background: #e4ecf7; border-radius: 11px; width: fit-content;
}
.ay-sector {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 16px; border: none; border-radius: 8px;
    background: transparent; color: #41566d;
    font-family: inherit; font-size: .82rem; font-weight: 600;
    cursor: pointer; transition: background .15s, color .15s, box-shadow .15s;
}
.ay-sector i { font-size: .95rem; opacity: .8; }
.ay-sector:hover { color: var(--ay-navy1); background: rgba(255,255,255,.6); }
.ay-sector.activo {
    background: #fff; color: var(--ay-navy1);
    box-shadow: 0 1px 4px rgba(15,36,56,.14);
}
.ay-sector.activo i { opacity: 1; color: var(--ay-accent); }

/* Mientras el JS pinta, el hueco no salta */
#ay-kpis:empty { min-height: 74px; }
#ay-grid:empty { min-height: 260px; }

/* ── KPIs ────────────────────────────────────────────────────────────────── */
.ay-kpis {
    display: grid; grid-template-columns: repeat(5, 1fr);
    gap: 12px; margin-bottom: 16px;
}
.ay-kpi {
    background: #fff; border: 1px solid var(--ay-border); border-radius: 11px;
    padding: 13px 14px; position: relative; overflow: hidden;
}
.ay-kpi::before {
    content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--kc);
}
.ay-kpi-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin-bottom: 7px;
}
.ay-kpi-lbl {
    font-size: .7rem; font-weight: 600; color: var(--ay-muted);
    display: inline-flex; align-items: center; gap: 5px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ay-kpi-lbl i { color: var(--kc); font-size: .82rem; }
.ay-kpi-var {
    font-size: .66rem; font-weight: 700; border-radius: 999px; padding: 2px 6px;
    display: inline-flex; align-items: center; gap: 1px; flex-shrink: 0;
}
.ay-kpi-var.up   { color: #15803d; background: #dcfce7; }
.ay-kpi-var.down { color: #b91c1c; background: #fee2e2; }
.ay-kpi-val { font-size: 1.12rem; font-weight: 700; color: var(--ay-ink); letter-spacing: -.3px; }

/* ── Tarjetas de gráfica ─────────────────────────────────────────────────── */
.ay-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px;
}
.ay-card {
    background: #fff; border: 1px solid var(--ay-border); border-radius: 12px;
    padding: 15px 16px 14px; cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .15s;
    display: flex; flex-direction: column; min-width: 0;
}
.ay-card.ancho { grid-column: 1 / -1; }
.ay-card:hover, .ay-card:focus-visible {
    border-color: var(--cc); transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(15,36,56,.10); outline: none;
}
.ay-card:hover .ay-card-ver, .ay-card:focus-visible .ay-card-ver { opacity: 1; color: var(--cc); }

.ay-card-head { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.ay-card-ico {
    width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
    background: color-mix(in srgb, var(--cc) 12%, transparent); color: var(--cc);
    display: flex; align-items: center; justify-content: center; font-size: 1.05rem;
}
.ay-card-tit { min-width: 0; flex: 1; }
.ay-card-tit h3 { font-size: .92rem; font-weight: 700; color: var(--ay-ink); margin: 0; }
.ay-card-tit span { font-size: .73rem; color: var(--ay-muted); }
.ay-card-ver {
    font-size: .72rem; font-weight: 700; color: var(--ay-muted);
    display: inline-flex; align-items: center; white-space: nowrap;
    opacity: .55; transition: opacity .15s, color .15s;
}
.ay-card-ver i { font-size: 1.05rem; }

.ay-card-body { position: relative; height: 210px; }
.ay-card.ancho .ay-card-body { height: 250px; }
.ay-card-body canvas { width: 100% !important; height: 100% !important; }

/* ── Ranking con barra (productos) ───────────────────────────────────────── */
.ay-top { display: flex; flex-direction: column; justify-content: center; gap: 12px; height: 210px; }
.ay-top-item { display: flex; align-items: center; gap: 10px; }
.ay-top-rank {
    width: 21px; height: 21px; border-radius: 6px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem; font-weight: 700; color: #fff; background: #94a3b8;
}
.ay-top-rank.r1 { background: #eab308; }
.ay-top-rank.r2 { background: #94a3b8; }
.ay-top-rank.r3 { background: #b45309; }
.ay-top-info { flex: 1; min-width: 0; }
.ay-top-name {
    font-size: .78rem; color: var(--ay-ink); margin-bottom: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ay-top-bar { height: 7px; border-radius: 4px; background: #eef2f7; overflow: hidden; }
.ay-top-bar i {
    display: block; height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, #ec4899, #f9a8d4);
}
.ay-top-val {
    font-size: .74rem; font-weight: 700; color: var(--ay-ink);
    font-variant-numeric: tabular-nums; white-space: pre; flex-shrink: 0;
}

/* ── Pie de la sección ───────────────────────────────────────────────────── */
.ay-seccion-pie {
    margin-top: 14px; display: flex; align-items: flex-start; gap: 8px;
    font-size: .74rem; line-height: 1.5; color: var(--ay-muted);
    background: #fff; border: 1px dashed var(--ay-border);
    border-radius: 10px; padding: 11px 14px;
}
.ay-seccion-pie i { color: #10b981; font-size: .9rem; margin-top: 1px; flex-shrink: 0; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1080px) { .ay-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 860px) {
    .ay-grid { grid-template-columns: 1fr; }
    .ay-hero { flex-direction: column; align-items: flex-start; text-align: left; }
}
@media (max-width: 560px) {
    .ay-kpis { grid-template-columns: repeat(2, 1fr); }
    /* El rótulo del KPI se cortaba a media palabra: acá se deja envolver */
    .ay-kpi-head { align-items: flex-start; }
    .ay-kpi-lbl { white-space: normal; font-size: .66rem; line-height: 1.3; }
    .ay-kpi-lbl i { display: none; }
    .ay-kpi-val { font-size: 1.02rem; }
    .ay-card-ver span, .ay-card-ver { display: none; }
    .ay-card-body, .ay-card.ancho .ay-card-body, .ay-top { height: 190px; }
}
