/* =============================================================================
   Estilo "HX" (2026-10-16): tarjetas de modulo con ilustracion, tiles tintados
   y paneles con grafico, tomado de la propuesta SST de HSEQ (pedido de Luis).
   Reemplaza al estilo denso `.bi-*` en los dashboards. Archivo COMPARTIDO:
   identico en todas las apps de la suite; si se toca, replicar el cambio.
   Todo el tinte sale de color-mix() contra --surface, asi funciona igual en
   tema claro y oscuro sin duplicar reglas.
   ============================================================================= */

:root {
    --hx-blue: #1570EF;
    --hx-green: #12A150;
    --hx-purple: #7C4DFF;
    --hx-orange: #F57C00;
    --hx-red: #E5383B;
    --hx-amber: #E8A500;
    --hx-teal: #0E9AA7;
}

/* ---- cabecera de pagina ---- */
.hx-crumb { font-size: 13px; color: var(--text-3); margin-bottom: 6px; }
.hx-crumb a { color: var(--text-2); text-decoration: none; }
.hx-crumb a:hover { color: var(--brand-ink); }
.hx-crumb .sep { margin: 0 6px; opacity: .6; }

.hx-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.hx-hero h2 { font-family: var(--f-display); font-size: 30px; line-height: 1.1; letter-spacing: -.02em; margin: 0; color: var(--text-1); }
.hx-hero h2 em { font-style: normal; color: var(--hx-blue); }
.hx-hero p { color: var(--text-2); margin: 6px 0 0; font-size: 14.5px; max-width: 720px; }
.hx-datechip {
    display: flex; flex-direction: column; gap: 4px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px;
    box-shadow: var(--shadow-1); font-size: 13px; color: var(--text-1); white-space: nowrap;
}
.hx-datechip i { width: 18px; color: var(--hx-blue); }
.hx-datechip span { color: var(--text-2); }

/* ---- filtros de periodo ---- */
.hx-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.hx-chips a {
    padding: 7px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none;
    background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
    transition: border-color .15s, color .15s;
}
.hx-chips a:hover { border-color: var(--hx-blue); color: var(--hx-blue); }
.hx-chips a.is-active { background: var(--hx-blue); border-color: var(--hx-blue); color: #fff; }

/* ---- tarjetas de modulo (Inicio) ---- */
.hx-modules { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 18px; }
.hx-mod {
    --c: var(--hx-blue);
    --card-bg: color-mix(in srgb, var(--c) 8%, var(--surface));
    position: relative; display: flex; flex-direction: column; text-decoration: none; color: var(--text-1);
    background: var(--card-bg); border: 1px solid color-mix(in srgb, var(--c) 20%, var(--surface));
    border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-1);
    transition: transform .18s ease, box-shadow .18s ease;
}
.hx-mod:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); color: var(--text-1); }
.hx-mod-art { height: 124px; position: relative; overflow: hidden; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 78%, #fff), color-mix(in srgb, var(--c) 40%, #fff)); }
.hx-mod-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hx-mod-badge {
    position: absolute; left: 16px; top: 92px; width: 56px; height: 56px; border-radius: 50%;
    background: var(--c); color: #fff; display: grid; place-items: center; font-size: 22px;
    border: 4px solid var(--card-bg); box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--c) 70%, #000);
}
.hx-mod-body { padding: 38px 18px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.hx-mod-body h3 { margin: 0; font-family: var(--f-display); font-size: 21px; letter-spacing: -.01em; color: color-mix(in srgb, var(--c) 82%, var(--text-1)); }
.hx-mod-body p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-2); flex: 1; }
.hx-mod-kpi { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.hx-mod-kpi b { font-family: var(--f-display); font-size: 34px; line-height: 1; color: var(--c); font-variant-numeric: tabular-nums; }
.hx-mod-kpi span.lbl { font-size: 12.5px; line-height: 1.25; color: var(--text-2); }
.hx-go { margin-left: auto; width: 40px; height: 40px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-size: 14px; flex-shrink: 0; transition: transform .18s ease; }
.hx-mod:hover .hx-go { transform: translateX(3px); }

/* ---- tarjetas de accion (pantalla de modulo) ---- */
.hx-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 18px; }
.hx-act {
    --c: var(--hx-blue);
    position: relative; display: flex; gap: 16px; align-items: flex-start; text-decoration: none; color: var(--text-1);
    padding: 18px; border-radius: 16px; min-height: 124px;
    background: color-mix(in srgb, var(--c) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 22%, var(--surface));
    transition: transform .18s ease, box-shadow .18s ease;
}
.hx-act:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); color: var(--text-1); }
.hx-act .ic { width: 56px; height: 56px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-size: 22px; flex-shrink: 0; }
.hx-act h4 { margin: 2px 0 4px; font-family: var(--f-display); font-size: 18px; color: color-mix(in srgb, var(--c) 82%, var(--text-1)); }
.hx-act p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.4; padding-right: 34px; }
.hx-act .go { position: absolute; right: 14px; bottom: 14px; width: 34px; height: 34px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-size: 12px; }

/* ---- tiles tintados ---- */
.hx-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 18px; }
.hx-tile {
    --c: var(--hx-blue);
    display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: 14px;
    background: color-mix(in srgb, var(--c) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 18%, var(--surface));
}
.hx-tile .ic { width: 52px; height: 52px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.hx-tile .num { font-family: var(--f-display); font-size: 30px; line-height: 1; color: var(--c); font-variant-numeric: tabular-nums; }
.hx-tile .num.is-money { font-size: 24px; }
.hx-tile .ttl { font-weight: 700; font-size: 14px; color: color-mix(in srgb, var(--c) 82%, var(--text-1)); margin-top: 2px; }
.hx-tile ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 3px; font-size: 12.5px; color: var(--text-2); }
.hx-tile li b { display: inline-block; min-width: 22px; font-variant-numeric: tabular-nums; color: var(--text-1); }
.hx-tile .pct { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--text-2); }

/* ---- paneles ---- */
.hx-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 16px; margin-bottom: 18px; }
.hx-panels.is-2 { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.hx-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-1); padding: 16px 18px 18px; min-width: 0; }
.hx-panel.span-2 { grid-column: span 2; }
@media (max-width: 900px) { .hx-panel.span-2 { grid-column: span 1; } }
.hx-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.hx-panel-head h5 { margin: 0; font-family: var(--f-display); font-size: 16px; color: var(--text-1); }
.hx-panel-head a { font-size: 12.5px; font-weight: 600; color: var(--hx-blue); text-decoration: none; white-space: nowrap; }
.hx-panel-head a:hover { text-decoration: underline; }
.hx-panel-head .n { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.hx-empty { color: var(--text-3); font-size: 13px; padding: 26px 6px; text-align: center; }
.hx-chart { position: relative; height: 210px; }
.hx-chart.is-tall { height: 280px; }

/* dona + leyenda */
.hx-donut { display: grid; grid-template-columns: minmax(120px, 170px) minmax(0, 1fr); gap: 16px; align-items: center; }
.hx-donut .hx-chart { height: 190px; }
.hx-legend { display: grid; gap: 9px; font-size: 13px; min-width: 0; }
.hx-legend .lg { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hx-legend .lg .nm { color: var(--text-2); flex: 1; min-width: 0; line-height: 1.25; overflow-wrap: anywhere; }
.hx-legend .lg b { font-variant-numeric: tabular-nums; color: var(--text-1); flex-shrink: 0; }
.hx-legend .lg .pc { flex-shrink: 0; min-width: 38px; text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; }
.hx-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--c, var(--hx-blue)); }
@media (max-width: 520px) { .hx-donut { grid-template-columns: 1fr; } }
/* panel angosto (3 por fila en pantallas medianas): dona arriba, leyenda abajo */
.hx-panel { container-type: inline-size; }
@container (max-width: 430px) {
    .hx-donut { grid-template-columns: minmax(0, 1fr); }
    .hx-donut .hx-chart { height: 170px; }
}

/* ranking con barra */
.hx-rank { display: grid; gap: 12px; }
.hx-rank .item .top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 4px; }
.hx-rank .item .top span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hx-rank .item .top b { font-variant-numeric: tabular-nums; color: var(--text-1); white-space: nowrap; }
.hx-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.hx-bar i { display: block; height: 100%; border-radius: 99px; background: var(--c, var(--hx-blue)); }

/* ---- tablas con pildoras ---- */
.hx-table-wrap { overflow-x: auto; }
.hx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hx-table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--text-2); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.hx-table td { padding: 10px; border-bottom: 1px solid var(--border); color: var(--text-1); vertical-align: middle; }
.hx-table tr:last-child td { border-bottom: 0; }
.hx-table td.num, .hx-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.hx-table a { color: var(--hx-blue); text-decoration: none; font-weight: 600; }

.hx-pill {
    --c: var(--hx-blue);
    display: inline-block; padding: 3px 10px; border-radius: 8px; font-size: 12px; font-weight: 700; white-space: nowrap;
    background: color-mix(in srgb, var(--c) 16%, var(--surface)); color: color-mix(in srgb, var(--c) 74%, var(--text-1));
}
.hx-pill.is-red { --c: var(--hx-red); }
.hx-pill.is-green { --c: var(--hx-green); }
.hx-pill.is-amber { --c: var(--hx-amber); }
.hx-pill.is-orange { --c: var(--hx-orange); }
.hx-pill.is-purple { --c: var(--hx-purple); }
.hx-pill.is-blue { --c: var(--hx-blue); }
.hx-pill.is-gray { --c: #6b7190; }

/* colores por clase para tiles/modulos/acciones/puntos */
.is-blue { --c: var(--hx-blue); }
.is-green { --c: var(--hx-green); }
.is-purple { --c: var(--hx-purple); }
.is-orange { --c: var(--hx-orange); }
.is-red { --c: var(--hx-red); }
.is-amber { --c: var(--hx-amber); }
.is-teal { --c: var(--hx-teal); }
.is-gray { --c: #6b7190; }

/* =============================================================================
   Capa "vidrio" (2026-10-17): efecto glassmorphism visto en la referencia de
   Luis (dashboard CRM con tarjetas de vidrio esmerilado). Solo agrega
   translucidez, desenfoque, borde de luz y animacion: NO cambia colores ni
   el fondo. Cae a las tarjetas opacas de arriba sin backdrop-filter.
   ============================================================================= */
:root {
    --hx-glass-edge: rgba(255, 255, 255, .75);
    --hx-glass-hi: rgba(255, 255, 255, .55);
    --hx-glass-sh: 0 10px 30px -14px rgba(43, 51, 126, .30);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --hx-glass-edge: rgba(255, 255, 255, .13);
        --hx-glass-hi: rgba(255, 255, 255, .16);
        --hx-glass-sh: 0 14px 38px -16px rgba(0, 0, 0, .70);
    }
}
:root[data-theme="dark"] {
    --hx-glass-edge: rgba(255, 255, 255, .13);
    --hx-glass-hi: rgba(255, 255, 255, .16);
    --hx-glass-sh: 0 14px 38px -16px rgba(0, 0, 0, .70);
}

@supports (backdrop-filter: blur(1px)) {
    .hx-panel, .hx-tile, .hx-mod, .hx-act, .hx-datechip, .hx-chips a:not(.is-active) {
        backdrop-filter: blur(16px) saturate(1.5);
        -webkit-backdrop-filter: blur(16px) saturate(1.5);
        border-color: var(--hx-glass-edge);
        box-shadow: inset 0 1px 0 var(--hx-glass-hi), var(--hx-glass-sh);
    }
    .hx-panel, .hx-datechip, .hx-chips a:not(.is-active) {
        background: color-mix(in srgb, var(--surface) 74%, transparent);
    }
    .hx-tile, .hx-act {
        background: color-mix(in srgb, color-mix(in srgb, var(--c) 10%, var(--surface)) 78%, transparent);
    }
    .hx-mod {
        --card-bg: color-mix(in srgb, color-mix(in srgb, var(--c) 8%, var(--surface)) 78%, transparent);
    }
    .hx-mod-badge { border-color: color-mix(in srgb, var(--surface) 70%, transparent); }
}

/* interaccion suave: elevacion + borde de luz al pasar el mouse */
.hx-panel, .hx-tile { transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.hx-panel:hover, .hx-tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--hx-blue) 38%, var(--hx-glass-edge)); }

/* entrada escalonada */
@keyframes hx-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.hx-modules > *, .hx-actions > *, .hx-tiles > *, .hx-panels > *, .hx-panel {
    animation: hx-rise .55s cubic-bezier(.2, .7, .2, 1) both;
}
.hx-modules > :nth-child(2), .hx-actions > :nth-child(2), .hx-tiles > :nth-child(2), .hx-panels > :nth-child(2) { animation-delay: .06s; }
.hx-modules > :nth-child(3), .hx-actions > :nth-child(3), .hx-tiles > :nth-child(3), .hx-panels > :nth-child(3) { animation-delay: .12s; }
.hx-modules > :nth-child(4), .hx-tiles > :nth-child(4), .hx-panels > :nth-child(4) { animation-delay: .18s; }
@media (prefers-reduced-motion: reduce) {
    .hx-modules > *, .hx-actions > *, .hx-tiles > *, .hx-panels > *, .hx-panel { animation: none; }
    .hx-panel:hover, .hx-tile:hover { transform: none; }
}

/* ---- Mis pendientes (panel "Necesitan tu atencion" del Inicio) ---- */
.hx-todo-panel { margin-bottom: 18px; }
.hx-todo-panel .hx-panel-head h5 i { color: var(--hx-amber); margin-right: 6px; }
.hx-todo { display: grid; gap: 10px; }
.hx-todo-row {
    --c: var(--hx-blue);
    display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; flex-wrap: wrap;
    background: color-mix(in srgb, var(--c) 9%, transparent); border: 1px solid color-mix(in srgb, var(--c) 22%, var(--border));
    transition: transform .18s ease, border-color .18s ease;
}
.hx-todo-row:hover { transform: translateX(3px); border-color: color-mix(in srgb, var(--c) 50%, var(--border)); }
.hx-todo-row .ic { width: 42px; height: 42px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-size: 17px; flex-shrink: 0; }
.hx-todo-row .tx { flex: 1; min-width: 220px; display: grid; gap: 2px; }
.hx-todo-row .tx a { text-decoration: none; color: var(--text-1); }
.hx-todo-row .tx a:hover b { text-decoration: underline; }
.hx-todo-row .tx b { font-size: 14px; }
.hx-todo-row .tx span { font-size: 12.5px; color: var(--text-2); }
.hx-todo-row .ac { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hx-todo-row .ac form { margin: 0; }
.hx-todo-more { margin-top: 10px; font-size: 12.5px; color: var(--text-3); text-align: center; }
.hx-todo-ok { display: flex; align-items: center; gap: 14px; padding: 14px 6px; }
.hx-todo-ok i { font-size: 34px; color: var(--hx-green); }
.hx-todo-ok b { display: block; font-size: 15px; color: var(--text-1); }
.hx-todo-ok span { font-size: 13px; color: var(--text-2); }

/* ---- Barra de filtros de los listados (macro hx.filtros / hx.buscar_tabla) ---- */
.hx-filtros {
    display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; padding: 14px 16px; border-radius: 16px;
    background: color-mix(in srgb, var(--surface) 72%, transparent); border: 1px solid var(--hx-glass-edge, var(--border));
    box-shadow: inset 0 1px 0 var(--hx-glass-hi, transparent), var(--shadow-1);
}
@supports (backdrop-filter: blur(1px)) { .hx-filtros { backdrop-filter: blur(16px) saturate(1.5); -webkit-backdrop-filter: blur(16px) saturate(1.5); } }
.hx-filtros-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.hx-filtros .f { display: grid; gap: 4px; margin: 0; min-width: 0; }
.hx-filtros .f > span { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.hx-filtros .f-texto { grid-column: span 2; }
@media (max-width: 560px) { .hx-filtros .f-texto { grid-column: span 1; } }
.hx-filtros input, .hx-filtros select { width: 100%; }
.hx-filtros-acc { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hx-filtros-n { margin-left: auto; font-size: 12.5px; color: var(--text-2); }
.hx-filtros-n b { color: var(--text-1); font-variant-numeric: tabular-nums; }
.hx-filtros-rapido { flex-direction: row; align-items: end; justify-content: space-between; padding: 10px 14px; }
.hx-filtros-rapido .f-texto { grid-column: auto; flex: 1; max-width: 460px; }
.hx-filtros-rapido .hx-filtros-n { margin-left: 0; padding-bottom: 8px; }
