/* ═══════════════════════════════════════════════════════
   Reportes de asistencia de RH sobre el Checador (/rh/reportes-asistencia).
   Global a propósito (los .razor.css no se cargan); todo va bajo .soc-ra.
   Colores de estatus: paleta categórica validada para daltonismo (siempre con texto al lado).
   ═══════════════════════════════════════════════════════ */

.soc-ra {
    --ra-ok: #1baf7a;
    --ra-late: #2a78d6;
    --ra-early: #eb6834;
    --ra-severe: #6250d6;
    --ra-incomplete: #eda100;
    --ra-justified: #b9b8b1;
    --ra-absence: #3f3e3a;
    --ra-ink: #17231f;
    --ra-ink-2: #4b5853;
    --ra-ink-3: #5e6a66;
    --ra-line: #e1e7e4;
    --ra-soft: #f6faf8;
    --ra-accent: #006d4e;
}

/* ─── Barra de filtros ─── */

.soc-ra-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    margin-bottom: 0.75rem;
    background: #fff;
    border: 1px solid var(--ra-line);
    border-radius: 14px;
}

.soc-ra-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--ra-ink-2);
    flex: 1 1 200px;
    min-width: 0;
}

.soc-ra-field.is-wide { flex: 2 1 260px; }
.soc-ra-field.is-narrow { flex: 0 1 160px; }

.soc-ra-field .form-control,
.soc-ra-field .form-select {
    height: 40px;
    border-radius: 10px;
}

.soc-ra-source {
    margin: 0 0 0.75rem;
    font-size: 0.8125rem;
    color: var(--ra-ink-3);
}

/* ─── Pestañas ─── */

.soc-ra-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    border-bottom: 1px solid #dde4e1;
    margin-bottom: 1rem;
}

.soc-ra-tab {
    height: 44px;
    padding: 0 1rem;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    font-weight: 600;
    color: var(--ra-ink-2);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: -1px;
    cursor: pointer;
}

.soc-ra-tab:hover { color: var(--ra-ink); }

.soc-ra-tab.is-active {
    border-bottom-color: var(--ra-accent);
    color: #00513a;
    font-weight: 800;
}

.soc-ra-count {
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    background: #e8eeeb;
    color: #33413c;
}

.soc-ra-tab.is-active .soc-ra-count { background: var(--ra-accent); color: #fff; }

/* ─── Indicadores ─── */

.soc-ra-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.soc-ra-kpi {
    background: #fff;
    border: 1px solid var(--ra-line);
    border-radius: 12px;
    padding: 0.875rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.soc-ra-kpi.is-hero { border-top: 4px solid var(--ra-accent); }
.soc-ra-kpi-label { font-size: 0.8125rem; font-weight: 700; color: var(--ra-ink-2); }
.soc-ra-kpi-value { font-size: 1.75rem; font-weight: 800; color: #10201b; line-height: 1.1; }
.soc-ra-kpi-note { font-size: 0.75rem; color: var(--ra-ink-3); line-height: 1.35; }
.soc-ra-delta { font-size: 0.75rem; font-weight: 800; }
.soc-ra-delta.is-good { color: #0a5c0a; }
.soc-ra-delta.is-bad { color: #8f1d1d; }

/* ─── Tarjetas y gráficas ─── */

.soc-ra-card {
    background: #fff;
    border: 1px solid var(--ra-line);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    min-width: 0;
}

.soc-ra-card-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.soc-ra-card-title { margin: 0; font-size: 1rem; font-weight: 800; color: var(--ra-ink); }
.soc-ra-card-note { font-size: 0.75rem; color: var(--ra-ink-3); }

.soc-ra-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
    gap: 1rem;
}

.soc-ra-grid-2 > .soc-ra-card { margin-bottom: 0; }
.soc-ra-grid-2 + * { margin-top: 1rem; }

/* Distribución: barra 100 % con 2px entre segmentos */
.soc-ra-stack { display: flex; gap: 2px; height: 26px; margin-bottom: 0.75rem; }
.soc-ra-stack > span { min-width: 3px; }
.soc-ra-stack > span:first-child { border-radius: 6px 0 0 6px; }
.soc-ra-stack > span:last-child { border-radius: 0 6px 6px 0; }
.soc-ra-legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-size: 0.8125rem; color: #33413c; }
.soc-ra-legend-item { display: inline-flex; align-items: center; gap: 0.5rem; }
.soc-ra-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }

/* Barras por área */
.soc-ra-bars { display: flex; flex-direction: column; gap: 0.25rem; }

.soc-ra-bar-row {
    display: grid;
    grid-template-columns: minmax(120px, 1.3fr) 2fr 58px 92px;
    gap: 0.625rem;
    align-items: center;
    padding: 0.375rem 0.5rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    width: 100%;
    cursor: pointer;
    font: inherit;
}

.soc-ra-bar-row:hover, .soc-ra-bar-row:focus-visible { background: #f1f6f4; }
.soc-ra-bar-name { font-size: 0.8125rem; font-weight: 700; color: var(--ra-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.soc-ra-bar-track { height: 14px; background: #eef2f0; border-radius: 4px; position: relative; overflow: hidden; }
.soc-ra-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ra-late); border-radius: 0 4px 4px 0; }
.soc-ra-bar-row:hover .soc-ra-bar-fill { background: #1c5cab; }
.soc-ra-bar-value { font-size: 0.8125rem; font-weight: 800; text-align: right; }

/* Tendencia semanal */
.soc-ra-trend { display: grid; grid-template-columns: 40px 1fr; gap: 6px; }
.soc-ra-trend-axis, .soc-ra-trend-plot { position: relative; height: 220px; }
.soc-ra-trend-tick { position: absolute; right: 0; transform: translateY(-50%); font-size: 0.6875rem; color: var(--ra-ink-3); }
.soc-ra-trend-grid { position: absolute; left: 0; right: 0; border-top: 1px dashed #e3e9e6; }
.soc-ra-trend-grid.is-base { border-top-style: solid; border-top-color: #c9d3cf; }
.soc-ra-trend-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.soc-ra-trend-dot { position: absolute; width: 8px; height: 8px; transform: translate(-50%, -50%); border-radius: 999px; background: var(--ra-late); box-shadow: 0 0 0 2px #fff; pointer-events: none; }
.soc-ra-trend-dot.is-active { width: 12px; height: 12px; }
.soc-ra-trend-hits { position: absolute; inset: 0; display: flex; }
.soc-ra-trend-hits > span { flex: 1 1 0; height: 100%; }
.soc-ra-trend-cross { position: absolute; top: 0; bottom: 0; border-left: 1px solid #93a39d; pointer-events: none; }

.soc-ra-trend-tip {
    position: absolute;
    top: 4px;
    background: #fff;
    border: 1px solid #d5ddd9;
    border-radius: 8px;
    padding: 6px 10px;
    box-shadow: 0 6px 16px rgba(16, 32, 27, 0.12);
    pointer-events: none;
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--ra-ink-2);
}

.soc-ra-trend-tip strong { display: block; font-size: 0.8125rem; color: var(--ra-ink); }
.soc-ra-trend-x { position: relative; height: 18px; grid-column: 2; }
.soc-ra-trend-x > span { position: absolute; top: 2px; transform: translateX(-50%); font-size: 0.6875rem; color: var(--ra-ink-3); white-space: nowrap; }

/* Focos rojos (tarjetas del resumen) */
.soc-ra-people { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.625rem; }

.soc-ra-person {
    text-align: left;
    border: 1px solid var(--ra-line);
    background: #fff;
    border-radius: 12px;
    padding: 0.75rem 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    cursor: pointer;
    font: inherit;
}

.soc-ra-person:hover, .soc-ra-person:focus-visible { background: var(--ra-soft); }
.soc-ra-person-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }

/* ─── Chips de nivel y estatus (color + texto) ─── */

.soc-ra-level, .soc-ra-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.soc-ra-level::before, .soc-ra-status::before, .soc-ra-filter-dot {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex: none;
    background: currentColor;
}

.soc-ra-level.is-low { background: #e3f5e3; color: #0a5c0a; }
.soc-ra-level.is-low::before { background: #0ca30c; }
.soc-ra-level.is-medium { background: #fff3d4; color: #6b4800; }
.soc-ra-level.is-medium::before { background: #fab219; }
.soc-ra-level.is-high { background: #fde8df; color: #7f3315; }
.soc-ra-level.is-high::before { background: #ec835a; }
.soc-ra-level.is-critical { background: #fbe3e3; color: #8f1d1d; }
.soc-ra-level.is-critical::before { background: #d03b3b; }

.soc-ra-status { font-size: 0.75rem; font-weight: 700; letter-spacing: 0; }
.soc-ra-status.is-ok { background: #e3f5ee; color: #0b5e40; }
.soc-ra-status.is-ok::before { background: var(--ra-ok); }
.soc-ra-status.is-late { background: #e4effb; color: #174a87; }
.soc-ra-status.is-late::before { background: var(--ra-late); }
.soc-ra-status.is-early { background: #fde9e0; color: #8a3512; }
.soc-ra-status.is-early::before { background: var(--ra-early); }
.soc-ra-status.is-severe { background: #ebe8fa; color: #3a2c98; }
.soc-ra-status.is-severe::before { background: var(--ra-severe); }
.soc-ra-status.is-incomplete { background: #fdf1d6; color: #6b4800; }
.soc-ra-status.is-incomplete::before { background: var(--ra-incomplete); }
.soc-ra-status.is-justified { background: #efeeea; color: #46453f; }
.soc-ra-status.is-justified::before { background: var(--ra-justified); }
.soc-ra-status.is-absence { background: #e4e3df; color: #2b2a26; }
.soc-ra-status.is-absence::before { background: var(--ra-absence); }

.soc-ra-bg-ok { background: var(--ra-ok); }
.soc-ra-bg-late { background: var(--ra-late); }
.soc-ra-bg-early { background: var(--ra-early); }
.soc-ra-bg-severe { background: var(--ra-severe); }
.soc-ra-bg-incomplete { background: var(--ra-incomplete); }
.soc-ra-bg-justified { background: var(--ra-justified); }
.soc-ra-bg-absence { background: var(--ra-absence); }

/* Filtros de chips (nivel / estatus) */
.soc-ra-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.soc-ra-chips-label { font-size: 0.8125rem; font-weight: 700; color: var(--ra-ink-2); }

.soc-ra-chip {
    height: 34px;
    padding: 0 0.875rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.8125rem;
    border: 1px solid #cfd8d4;
    background: #fff;
    color: #33413c;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.soc-ra-chip.is-active { border-color: var(--ra-accent); background: #e6f2ee; color: #00513a; }
.soc-ra-chips-note { margin-left: auto; font-size: 0.75rem; color: var(--ra-ink-3); }

/* ─── Tablas ─── */

.soc-ra-table-wrap { background: #fff; border: 1px solid var(--ra-line); border-radius: 14px; overflow-x: auto; }
.soc-ra-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }

.soc-ra-table th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--ra-ink-2);
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid #e6ebe9;
    white-space: nowrap;
    background: #fff;
    position: sticky;
    top: 0;
}

.soc-ra-table td { padding: 0.5625rem 0.75rem; border-bottom: 1px solid #f0f3f2; vertical-align: middle; }
.soc-ra-table tbody tr:hover { background: var(--ra-soft); }
.soc-ra-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.soc-ra-table .is-mono { font-variant-numeric: tabular-nums; white-space: nowrap; }
.soc-ra-table .is-muted { color: var(--ra-ink-2); }

.soc-ra-link {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-weight: 700;
    color: var(--ra-accent);
    cursor: pointer;
    text-align: left;
}

.soc-ra-link:hover { text-decoration: underline; }
.soc-ra-mini-stack { display: flex; gap: 2px; height: 12px; min-width: 120px; }
.soc-ra-table-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.75rem; font-size: 0.75rem; color: var(--ra-ink-3); }
.soc-ra-empty { padding: 1.5rem; color: var(--ra-ink-3); margin: 0; }

/* ─── Estado vacío ─── */

.soc-ra-blank {
    background: #fff;
    border: 1px dashed #b9c6c1;
    border-radius: 14px;
    padding: 3.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
}

.soc-ra-blank i { font-size: 2.5rem; color: #6b7a75; }
.soc-ra-blank p { max-width: 460px; color: var(--ra-ink-2); margin: 0; }

/* ─── Menú de PDF ─── */

.soc-ra-menu-anchor { position: relative; }

.soc-ra-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 30;
    width: 340px;
    max-width: calc(100vw - 48px);
    background: #fff;
    border: 1px solid #dbe2df;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(16, 32, 27, 0.16);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
}

.soc-ra-menu button {
    text-align: left;
    background: #fff;
    border: 0;
    border-radius: 8px;
    padding: 0.625rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
}

.soc-ra-menu button:hover, .soc-ra-menu button:focus-visible { background: #eef3f1; }
.soc-ra-menu strong { font-size: 0.875rem; color: #10201b; }
.soc-ra-menu span { font-size: 0.75rem; color: var(--ra-ink-3); }

/* ─── Panel lateral y diálogos ─── */

.soc-ra-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(12, 26, 21, 0.4);
    display: flex;
}

.soc-ra-overlay.is-side { justify-content: flex-end; }
.soc-ra-overlay.is-center { align-items: flex-start; justify-content: center; padding: 3rem 1rem; overflow-y: auto; }

.soc-ra-drawer {
    width: 560px;
    max-width: 100%;
    height: 100%;
    background: #fff;
    overflow-y: auto;
    padding: 1.375rem 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: -12px 0 32px rgba(12, 26, 21, 0.18);
}

.soc-ra-dialog {
    width: 760px;
    max-width: 100%;
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
    box-shadow: 0 24px 48px rgba(12, 26, 21, 0.24);
}

.soc-ra-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.soc-ra-dialog-head h2 { margin: 0; font-size: 1.25rem; font-weight: 800; }
.soc-ra-dialog-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.5rem; border-top: 1px solid #edf1ef; padding-top: 1rem; }

.soc-ra-close {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 0;
    background: transparent;
    color: #33413c;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    cursor: pointer;
    flex: none;
}

.soc-ra-close:hover { background: #eef3f1; }
.soc-ra-eyebrow { font-size: 0.75rem; font-weight: 700; color: var(--ra-ink-2); text-transform: uppercase; letter-spacing: 0.6px; }
.soc-ra-section-title { margin: 0 0 0.5rem; font-size: 0.9375rem; font-weight: 800; }

.soc-ra-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
.soc-ra-stat { border: 1px solid #e6ebe9; border-radius: 10px; padding: 0.5rem 0.625rem; display: flex; flex-direction: column; gap: 2px; }
.soc-ra-stat span { font-size: 0.6875rem; font-weight: 700; color: var(--ra-ink-2); display: flex; align-items: center; gap: 6px; }
.soc-ra-stat strong { font-size: 1.125rem; color: #10201b; }

/* Calendario de la ficha */
.soc-ra-month { display: flex; flex-direction: column; gap: 0.375rem; }
.soc-ra-month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.soc-ra-month-grid > .is-head { font-size: 0.6875rem; font-weight: 700; color: var(--ra-ink-3); text-align: center; }

.soc-ra-day {
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    background: #f4f6f5;
    color: #8a948f;
}

.soc-ra-day.is-ok { background: var(--ra-ok); color: #0b3d2a; }
.soc-ra-day.is-late { background: var(--ra-late); color: #fff; }
.soc-ra-day.is-early { background: var(--ra-early); color: #fff; }
.soc-ra-day.is-severe { background: var(--ra-severe); color: #fff; }
.soc-ra-day.is-incomplete { background: var(--ra-incomplete); color: #3d2900; }
.soc-ra-day.is-justified { background: var(--ra-justified); color: #2b2a26; }
.soc-ra-day.is-absence { background: var(--ra-absence); color: #fff; }
.soc-ra-swatch.is-none { background: #f4f6f5; border: 1px solid #dfe5e2; }
.soc-ra-day.is-blank { background: transparent; }
.soc-ra-help { background: #f3f7f5; border-radius: 12px; padding: 0.875rem 1rem; font-size: 0.8125rem; color: #33413c; display: flex; flex-direction: column; gap: 0.5rem; }

.soc-ra-feedback { border-radius: 10px; padding: 0.625rem 0.875rem; font-size: 0.8125rem; margin: 0; }
.soc-ra-feedback.is-error { background: #fdf1f1; color: #8f1d1d; border: 1px solid #f0b8b8; }
.soc-ra-feedback.is-ok { background: #e6f2ee; color: #00513a; border: 1px solid #b9dccd; }
.soc-ra-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }

@media (max-width: 640px) {
    .soc-ra-bar-row { grid-template-columns: 1fr 52px; }
    .soc-ra-bar-track { grid-column: 1 / -1; grid-row: 2; }
    .soc-ra-bar-row .soc-ra-level { display: none; }
    .soc-ra-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
