* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #0f172a; background: #f1f5f9; }
a { color: inherit; text-decoration: none; }

/* ── Login ─────────────────────────────────────────────── */
.op-login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#0D1B3D,#103A5F); }
.op-login-card { background: #fff; border-radius: 16px; padding: 40px; width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,.35); text-align: center; }
/* Marca del login unificada con el portal admin (base): logo + RH+ + raya verde. */
.op-login-logo { display: flex; justify-content: center; margin-bottom: 8px; }
.op-login-logo .op-brand-svg { border-radius: 21px; filter: drop-shadow(0 6px 18px rgba(13,27,61,.18)); }
.op-login-mark { display: block; height: 24px; width: auto; margin: 6px auto 0; }
.op-login-accent { width: 48px; height: 3px; background: #00BB94; border-radius: 2px; margin: 8px auto 0; }
.op-login-title { font-size: 20px; margin: 14px 0 4px; }
.op-login-sub { color: #64748b; font-size: 13px; margin: 0 0 22px; line-height: 1.4; }
.op-field { text-align: left; margin-bottom: 14px; }
.op-field label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 5px; }
.op-input { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 14px; }
.op-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.op-btn-primary { width: 100%; padding: 11px; background: #2563eb; color: #fff; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 6px; }
.op-btn-primary:hover { background: #1d4ed8; }
.op-btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.op-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
/* Pie del login: enlaces secundarios (recuperar contraseña, volver a ingresar, reenviar código). */
.op-login-foot { margin: 16px 0 0; font-size: 13px; color: #64748b; }
.op-login-foot a { color: #2563eb; font-weight: 600; }
.op-login-foot a:hover { text-decoration: underline; }

/* ── Shell con sidebar ─────────────────────────────────── */
.op-shell { display: flex; min-height: 100vh; }
.op-sidebar { width: 240px; background: #0D1B3D; color: #cbd5e1; display: flex; flex-direction: column; padding: 20px 16px; }
.op-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.op-brand-mark { height: 26px; width: auto; display: block; }
.op-brand-name { display: block; height: 18px; width: auto; }
.op-brand-sub { font-size: 11px; color: #94a3b8; }
.op-who { background: rgba(255,255,255,.05); border-radius: 8px; padding: 10px; margin-bottom: 18px; }
.op-who-email { font-size: 13px; color: #e2e8f0; word-break: break-all; }
.op-who-role { font-size: 11px; color: #3FE5D7; font-weight: 600; margin-top: 2px; }
.op-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.op-link { padding: 9px 12px; border-radius: 8px; font-size: 14px; }
.op-link:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.op-link.active { background: #2563eb; color: #fff; }
.op-foot { border-top: 1px solid rgba(255,255,255,.1); padding-top: 12px; }
.op-btn-link { background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 13px; padding: 0; }
.op-btn-link:hover { color: #fff; }

/* ── Contenido ─────────────────────────────────────────── */
.op-content { flex: 1; padding: 32px 40px; }
.op-h1 { font-size: 24px; margin: 0 0 4px; }
.op-h2 { font-size: 17px; margin: 0 0 6px; }
.op-muted { color: #64748b; font-size: 13px; }
.op-sm { font-size: 11px; }

.op-table { width: 100%; border-collapse: collapse; margin-top: 16px; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.op-table th { text-align: left; font-size: 12px; text-transform: uppercase; color: #64748b; padding: 11px 14px; border-bottom: 1px solid #e2e8f0; }
.op-table td { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.op-table tr:last-child td { border-bottom: none; }

.op-pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.op-pill.on { background: #dcfce7; color: #15803d; }
.op-pill.off { background: #fee2e2; color: #b91c1c; }
.op-pill.warn { background: #fef3c7; color: #b45309; }

/* Empresa inactiva: tinte rojo suave (modo tabla) para distinguirla de un vistazo. */
.op-table tr.op-row-off td { background: #fff7f7; }

.op-btn-sm { padding: 5px 11px; font-size: 12px; font-weight: 600; border: 1px solid #cbd5e1; background: #f8fafc; border-radius: 6px; cursor: pointer; }
.op-btn-sm:hover { background: #eff6ff; border-color: #93c5fd; }

.op-toast { margin-top: 14px; background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; padding: 10px 14px; border-radius: 8px; font-size: 13px; }

.op-panel { margin-top: 28px; background: #fff; border-radius: 12px; padding: 22px; box-shadow: 0 1px 3px rgba(0,0,0,.06); max-width: 560px; }
.op-token-box { margin-top: 14px; }
.op-token { width: 100%; height: 90px; font-family: ui-monospace, monospace; font-size: 11px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 10px; resize: vertical; }

/* ── Sesión de soporte (impersonación) ─────────────────── */
.op-support-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; padding: 12px 16px; border-radius: 10px;
  font-size: 13px; margin-bottom: 20px; }
.op-support-banner code { background: rgba(146,64,14,.1); padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.op-kv { border-collapse: collapse; }
.op-kv td { padding: 6px 10px; font-size: 14px; border-bottom: 1px solid #f1f5f9; }
.op-kv td:first-child { color: #64748b; font-size: 12px; text-transform: uppercase; width: 160px; }

/* ── Buscador de trabajador ─────────────────────────────── */
.op-search-row { display: flex; gap: 8px; align-items: center; }
.op-search-row .op-input { flex: 1; }
.op-results { margin-top: 8px; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; max-height: 220px; overflow-y: auto; }
.op-result { display: block; width: 100%; text-align: left; padding: 9px 12px; background: #fff; border: none; border-bottom: 1px solid #f1f5f9; cursor: pointer; font-size: 14px; }
.op-result:last-child { border-bottom: none; }
.op-result:hover { background: #eff6ff; }
.op-result.sel { background: #dbeafe; }
.op-selected { margin-top: 8px; font-size: 13px; color: #15803d; }

/* ── Vista de sesión de soporte (/soporte) — rediseño ──────── */
.sp-muted { color:#64748b; font-size:13px; }
.sp-sm { font-size:12px; }
.sp-mt { margin-top:10px; }

.sp-banner { display:flex; align-items:center; justify-content:space-between; gap:16px;
  background:#fffbeb; border:1px solid #fcd34d; border-radius:12px; padding:14px 18px; margin-bottom:20px; max-width:960px; }
.sp-banner-text { display:flex; align-items:center; gap:12px; color:#92400e; font-size:14px; }
.sp-banner-icon { font-size:22px; }
.sp-banner-meta { font-size:12px; color:#b45309; margin-top:2px; }
.sp-exit { background:#fff; border:1px solid #fcd34d; color:#92400e; padding:8px 14px; border-radius:8px;
  font-size:13px; font-weight:600; cursor:pointer; white-space:nowrap; }
.sp-exit:hover { background:#fef3c7; }

.sp-card { background:#fff; border:1px solid #e2e8f0; border-radius:14px; padding:20px 22px; margin-bottom:18px;
  max-width:960px; box-shadow:0 1px 2px rgba(0,0,0,.04); }
.sp-card-head { display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.sp-card-head h2 { font-size:16px; margin:0; }
.sp-badge { background:#eff6ff; color:#1e40af; font-size:12px; font-weight:700; padding:1px 9px; border-radius:999px; }

.sp-profile { display:flex; align-items:center; gap:14px; }
.sp-avatar { width:52px; height:52px; border-radius:50%; background:linear-gradient(135deg,#2563eb,#1d4ed8);
  color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:18px; flex-shrink:0; }
.sp-name { font-size:18px; font-weight:700; }
.sp-sub { color:#64748b; font-size:13px; }

.sp-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px 28px; margin-top:18px; }
.sp-kv { display:flex; flex-direction:column; gap:2px; border-bottom:1px solid #f1f5f9; padding-bottom:8px; }
.sp-kv span { color:#94a3b8; font-size:11px; text-transform:uppercase; letter-spacing:.03em; }
.sp-kv b { font-size:14px; font-weight:600; color:#0f172a; }

.sp-stats { display:flex; gap:14px; margin-bottom:18px; max-width:960px; }
.sp-stat { flex:1; background:#fff; border:1px solid #e2e8f0; border-radius:12px; padding:14px 18px; }
.sp-stat-n { display:block; font-size:24px; font-weight:800; color:#0f172a; line-height:1.1; }
.sp-stat-l { color:#64748b; font-size:13px; }

.sp-table-wrap { overflow-x:auto; }
.sp-table { width:100%; border-collapse:collapse; }
.sp-table th { text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:.03em; color:#94a3b8;
  padding:8px 12px; border-bottom:1px solid #e2e8f0; white-space:nowrap; }
.sp-table td { padding:10px 12px; border-bottom:1px solid #f1f5f9; font-size:14px; }
.sp-table tr:last-child td { border-bottom:none; }
.sp-table tbody tr:hover { background:#f8fafc; }
.sp-nowrap { white-space:nowrap; }
.sp-file { font-size:12px; color:#475569; max-width:280px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

@media (max-width:640px) {
  .sp-grid { grid-template-columns:1fr; }
  .sp-stats { flex-direction:column; }
}

/* ── Barra de filtros de auditoría ─────────────────────────── */
.sp-filter { padding:16px 18px; }
.sp-filter-row { display:flex; flex-wrap:wrap; gap:12px; align-items:flex-end; }
.sp-filter-f { display:flex; flex-direction:column; gap:4px; min-width:150px; flex:1; }
.sp-filter-f.sp-filter-sm { min-width:120px; flex:0 0 140px; }
.sp-filter-f label { font-size:11px; text-transform:uppercase; letter-spacing:.03em; color:#94a3b8; font-weight:600; }
.sp-filter-actions { display:flex; gap:8px; align-items:flex-end; }
.sp-filter-actions .op-btn-primary { width:auto; padding:9px 18px; margin-top:0; }

/* ── Dashboard de salud por empresa ────────────────────────── */
/* Totales con ícono + tinte de color */
.hl-totals { display:flex; gap:14px; margin-bottom:20px; max-width:960px; flex-wrap:wrap; }
.hl-total { flex:1; min-width:170px; display:flex; align-items:center; gap:12px; border-radius:14px;
  padding:16px 18px; border:1px solid transparent; }
.hl-total-ico { font-size:26px; line-height:1; }
.hl-total-n { display:block; font-size:26px; font-weight:800; line-height:1.05; }
.hl-total-l { font-size:12px; opacity:.85; }
.hl-t-blue  { background:#eff6ff; border-color:#bfdbfe; color:#1e3a8a; }
.hl-t-teal  { background:#f0fdfa; border-color:#99f6e4; color:#115e59; }
.hl-t-green { background:#f0fdf4; border-color:#bbf7d0; color:#166534; }
.hl-t-amber { background:#fffbeb; border-color:#fde68a; color:#92400e; }

.hl-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(340px, 1fr)); gap:16px; max-width:960px; }
/* Acento de color en el borde superior de cada tarjeta */
.hl-card { margin-bottom:0; position:relative; overflow:hidden; padding-top:22px; }
.hl-card::before { content:""; position:absolute; top:0; left:0; right:0; height:4px;
  background:linear-gradient(90deg,#2563eb,#06b6d4,#10b981); }
.hl-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.hl-badges { display:flex; flex-direction:column; gap:4px; align-items:flex-end; }

.hl-metrics { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin:18px 0 14px; }
.hl-m { text-align:center; border-radius:12px; padding:12px 4px; border:1px solid transparent; }
.hl-n { display:block; font-size:21px; font-weight:800; line-height:1.1; }
.hl-l { font-size:10px; text-transform:uppercase; letter-spacing:.02em; opacity:.8; }
.hl-blue   { background:#eff6ff; border-color:#dbeafe; } .hl-blue   .hl-n { color:#2563eb; }
.hl-green  { background:#f0fdf4; border-color:#dcfce7; } .hl-green  .hl-n { color:#16a34a; }
.hl-amber  { background:#fffbeb; border-color:#fef3c7; } .hl-amber  .hl-n { color:#d97706; }
.hl-purple { background:#faf5ff; border-color:#f3e8ff; } .hl-purple .hl-n { color:#9333ea; }
.hl-blue .hl-l, .hl-green .hl-l, .hl-amber .hl-l, .hl-purple .hl-l { color:#475569; }

.hl-foot { font-size:12px; color:#64748b; border-top:1px solid #f1f5f9; padding-top:10px; }
@media (max-width:480px) { .hl-metrics, .hl-totals { grid-template-columns:repeat(2,1fr); } }

/* ── Visor de errores ──────────────────────────────────── */
/* Tarjetas a ancho completo: el visor tiene muchas columnas y el tope de 960px
   de .sp-card lo dejaba apretado. */
.sp-card-wide { max-width:none; }
.sp-muted-cell { color:#94a3b8; font-size:12px; }
.op-row-click { cursor:pointer; }
.op-row-click:hover { background:#f8fafc; }
.op-detail-row > td { background:#0f172a; padding:14px 16px; }
.op-detail-meta { display:flex; gap:18px; flex-wrap:wrap; color:#cbd5e1; font-size:12px; margin-bottom:10px; }
.op-detail-meta strong { color:#94a3b8; font-weight:600; }
.op-stack { margin:0; max-height:340px; overflow:auto; white-space:pre-wrap; word-break:break-word;
            font-family:ui-monospace,"Cascadia Code",Consolas,monospace; font-size:12px; line-height:1.5; color:#e2e8f0; }

/* ─── Reconexión del circuito Blazor (oculto salvo cuando Blazor activa las clases) ─── */
.reconnect-modal { display: none; }
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex; align-items: center; justify-content: center;
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(13, 27, 61, 0.55);
}
.reconnect-box {
    background: #fff; color: #103A5F; border-radius: 12px;
    padding: 16px 22px; font-size: 14px; font-weight: 600;
    box-shadow: 0 16px 40px rgba(0,0,0,.35);
}

/* ── Responsivo ─────────────────────────────────────────────────────────── */
.op-mobile-topbar { display: none; }
.op-backdrop { display: none; }
.op-hamburger { background: transparent; border: none; color: #fff; font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px; }
.op-mobile-brand { display: inline-flex; align-items: center; gap: 8px; }
.op-mobile-brand img { display: block; }
.op-mobile-wordmark { height: 16px; width: auto; }

/* Tablas anchas de solo lectura (sp-table): scroll horizontal en el contenedor. */
.op-table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 900px) {
    .op-shell { display: block; }
    .op-mobile-topbar {
        display: flex; align-items: center; gap: 12px;
        background: #0D1B3D; color: #fff; padding: 10px 14px;
        position: sticky; top: 0; z-index: 30;
    }
    .op-sidebar {
        position: fixed; top: 0; left: 0; height: 100vh; width: 250px;
        transform: translateX(-100%); transition: transform .22s ease;
        z-index: 50; overflow-y: auto;
    }
    .op-shell.op-sidebar-open .op-sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.5); }
    .op-shell.op-sidebar-open .op-backdrop {
        display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40;
    }
    .op-content { padding: 16px; }
    .op-search-row { flex-wrap: wrap; }
    .op-panel { max-width: 100%; }
    .op-support-banner { flex-wrap: wrap; }
    .sp-banner { flex-wrap: wrap; }
}

/* Modo tarjeta para la tabla de empresas (op-table). Se activa a <=1100px porque el
   sidebar de 240px le quita ancho a la tabla. Cada fila se vuelve una tarjeta apilada. */
@media (max-width: 1100px) {
    .op-table.op-cards,
    .op-table.op-cards tbody,
    .op-table.op-cards tr { display: block; width: auto; }
    .op-table.op-cards { background: transparent; box-shadow: none; border-radius: 0; overflow: visible; margin-top: 12px; }
    .op-table.op-cards thead { display: none; }
    .op-table.op-cards tr {
        background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
        padding: 10px 12px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05);
    }
    .op-table.op-cards td { display: block; border: none; padding: 4px 0; }
    .op-table.op-cards td::before {
        content: attr(data-label); display: block;
        font-size: 11px; text-transform: uppercase; letter-spacing: .03em;
        color: #94a3b8; font-weight: 600; margin-bottom: 2px;
    }
    .op-table.op-cards td:empty { display: none; }
    /* Empresa inactiva en modo tarjeta: tinte y borde rojo suave. */
    .op-table.op-cards tr.op-row-off { background: #fff7f7; border-color: #fecaca; }

    /* Tablas de lectura (sp-table) marcadas .sp-cards: cada fila → tarjeta apilada
       (auditoría, errores, soporte). El label de cada dato viene de data-label. */
    .sp-table.sp-cards,
    .sp-table.sp-cards tbody,
    .sp-table.sp-cards tr { display: block; width: auto; }
    .sp-table.sp-cards thead { display: none; }
    .sp-table.sp-cards tr {
        background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
        padding: 10px 12px; margin-bottom: 10px;
    }
    .sp-table.sp-cards tbody tr:hover { background: #fff; }
    .sp-table.sp-cards td {
        display: block; border: none; padding: 4px 0;
        white-space: normal; max-width: none; overflow: visible; text-overflow: clip;
    }
    .sp-table.sp-cards td::before {
        content: attr(data-label); display: block;
        font-size: 11px; text-transform: uppercase; letter-spacing: .03em;
        color: #94a3b8; font-weight: 600; margin-bottom: 2px;
    }
    .sp-table.sp-cards td:empty { display: none; }
    /* Celda de detalle (colspan, ej. fila expandida de /errores): sin etiqueta. */
    .sp-table.sp-cards td[colspan]::before { display: none; }
    .sp-table.sp-cards tr.op-detail-row { background: #f8fafc; }
}
