/* ═══════════════════════════════════════════════════════
   QualityHub — Owner Monitor CSS
   ═══════════════════════════════════════════════════════ */

/* ── Wrapper general ─────────────────────────────────── */
.om-wrap {
  padding: 0 0 60px;
  max-width: 1400px;
}

/* ══════════════════════════════════════════════════════
   CABECERA
══════════════════════════════════════════════════════ */
.om-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.om-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.om-header-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, #4f46e5, #6d28d9);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(79,70,229,.35);
}
.om-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 3px;
}
.om-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}
.om-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.om-last-refresh {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.om-stuck-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: #dc2626;
}
.om-ok-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: #16a34a;
}

/* ══════════════════════════════════════════════════════
   KPI GRID
══════════════════════════════════════════════════════ */
.om-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.om-kpi-card {
  background: #fff;
  border-radius: 14px;
  padding: 18px 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 1.5px solid #e2e8f0;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  text-align: center;
}
.om-kpi-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.om-kpi-icon {
  font-size: 22px;
  margin-bottom: 2px;
}
.om-kpi-value {
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}
.om-kpi-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Variantes KPI */
.om-kpi-danger  { border-color: #fca5a5; background: #fef2f2; }
.om-kpi-danger  .om-kpi-icon  { color: #ef4444; }
.om-kpi-danger  .om-kpi-value { color: #dc2626; }
.om-kpi-warning { border-color: #fde68a; background: #fffbeb; }
.om-kpi-warning .om-kpi-icon  { color: #f59e0b; }
.om-kpi-warning .om-kpi-value { color: #d97706; }
.om-kpi-info    { border-color: #a5f3fc; background: #ecfeff; }
.om-kpi-info    .om-kpi-icon  { color: #06b6d4; }
.om-kpi-info    .om-kpi-value { color: #0891b2; }
.om-kpi-ok      { border-color: #e2e8f0; }
.om-kpi-ok      .om-kpi-icon  { color: #94a3b8; }
.om-kpi-ok      .om-kpi-value { color: #334155; }

/* ══════════════════════════════════════════════════════
   TABS
══════════════════════════════════════════════════════ */
.om-tabs-wrap {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
}
.om-tabs {
  display: flex;
  border-bottom: 1.5px solid #e2e8f0;
  background: #f8fafc;
}
.om-tab {
  flex: 1;
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-bottom: 3px solid transparent;
  margin-bottom: -1.5px;
  transition: color .15s, border-color .15s;
}
.om-tab:hover { color: var(--primary); }
.om-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: #fff;
  font-weight: 700;
}
.om-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
}
.om-tab-count.danger { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }

.om-tab-content { display: none; padding: 24px; }
.om-tab-content.active { display: block; }

/* ══════════════════════════════════════════════════════
   SECCIONES / ACORDEÓN
══════════════════════════════════════════════════════ */
.om-section {
  margin-bottom: 20px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}
.om-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
  gap: 12px;
}
.om-section-header:hover { background: #f1f5f9; }
.om-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
.om-section-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: #e2e8f0;
  padding: 2px 8px;
  border-radius: 8px;
}
.om-section-chevron {
  color: var(--text-muted);
  font-size: 12px;
  transition: transform .2s;
  flex-shrink: 0;
}
.om-section-body { padding: 0; }
.om-section-body.collapsed { display: none; }

/* Legend */
.om-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding: 10px 18px;
  background: #fafbfc;
  border-bottom: 1px solid #f1f5f9;
  font-size: 11px;
  color: var(--text-muted);
  align-items: center;
}
.om-legend span { display: flex; align-items: center; gap: 5px; }

/* ══════════════════════════════════════════════════════
   TABLAS DE PROCESOS
══════════════════════════════════════════════════════ */
.om-table-wrap {
  overflow-x: auto;
}
.om-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.om-table thead tr {
  background: #f8fafc;
  border-bottom: 1.5px solid #e2e8f0;
}
.om-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #64748b;
  white-space: nowrap;
}
.om-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background .12s;
}
.om-table tbody tr:last-child { border-bottom: none; }
.om-table tbody tr:hover { background: #f8fafc; }
.om-table td {
  padding: 10px 12px;
  vertical-align: middle;
}

/* Columna de step — centrada */
.om-step-col { text-align: center !important; width: 80px; }

/* ID de proceso */
.om-process-id {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-weight: 700;
  font-size: 11px;
  color: #1e293b;
  white-space: nowrap;
}
.om-date { font-size: 11px; color: #64748b; white-space: nowrap; }
.om-ref-code { font-size: 10px; color: #94a3b8; font-family: monospace; }
.om-days { font-size: 11px; font-weight: 700; color: #475569; white-space: nowrap; }
.om-days-warn { color: #ef4444 !important; }

/* Filas especiales */
.om-row-stuck { background: rgba(245,158,11,.04) !important; }
.om-row-stuck:hover { background: rgba(245,158,11,.08) !important; }
.om-row-critical { background: rgba(239,68,68,.04) !important; }
.om-row-incomplete { background: rgba(139,92,246,.03) !important; }
.om-empty { text-align: center; padding: 28px; color: var(--text-muted); font-size: 12px; }
.om-stuck-icon { color: #f59e0b; font-size: 10px; margin-left: 4px; }

/* ══════════════════════════════════════════════════════
   PASOS / STEPS
══════════════════════════════════════════════════════ */
.om-step { display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.om-step-done    { color: #22c55e; }
.om-step-current { color: #f59e0b; }
.om-step-warn    { color: #f97316; }
.om-step-reject  { color: #ef4444; }
.om-step-pending { color: #e2e8f0; font-size: 10px; }

/* ══════════════════════════════════════════════════════
   STATUS BADGES
══════════════════════════════════════════════════════ */
.om-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.om-status-success   { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; }
.om-status-warning   { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.om-status-danger    { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.om-status-info      { background: #ecfeff; color: #0891b2; border: 1px solid #a5f3fc; }
.om-status-primary   { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.om-status-secondary { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }

/* ══════════════════════════════════════════════════════
   FICHAS — CAMPOS FALTANTES
══════════════════════════════════════════════════════ */
.om-ficha-ok {
  color: #16a34a;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}
.om-ficha-missing {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.om-ficha-missing-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: #dc2626;
  font-weight: 500;
  background: #fef2f2;
  padding: 2px 8px;
  border-radius: 6px;
  width: fit-content;
}
.om-ficha-missing-item i { font-size: 9px; }

/* ══════════════════════════════════════════════════════
   PROCESOS ATASCADOS
══════════════════════════════════════════════════════ */
.om-stuck-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.om-stuck-empty i {
  font-size: 48px;
  color: #22c55e;
  margin-bottom: 16px;
  display: block;
}
.om-stuck-empty h3 { font-size: 16px; color: #1e293b; margin-bottom: 6px; }
.om-stuck-empty p  { font-size: 13px; }

/* ══════════════════════════════════════════════════════
   PROVEEDOR — chip con tooltip nativo
══════════════════════════════════════════════════════ */
.om-sup-chip {
  display: inline-block;
  max-width: 110px;
  padding: 3px 8px;
  background: var(--surface-2, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
  /* tooltip custom via CSS */
  position: relative;
}
.om-sup-chip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #f1f5f9;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  z-index: 100;
  pointer-events: none;
}
.om-sup-chip:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e293b;
  z-index: 101;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════
   BOTÓN EMAIL — icono pequeño en columna Días
══════════════════════════════════════════════════════ */
.om-email-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid currentColor;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  margin-left: 5px;
  vertical-align: middle;
  transition: background .15s, transform .15s, filter .15s;
  flex-shrink: 0;
  opacity: .75;
}
.om-email-btn:hover {
  opacity: 1;
  filter: brightness(1.2);
  transform: scale(1.18);
}
.om-days {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 2px;
}

.om-stuck-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #92400e;
}
.om-stuck-header i { color: #f59e0b; }

.om-stuck-list { display: flex; flex-direction: column; gap: 12px; }
.om-stuck-card {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
}
.om-stuck-critical { border-color: #fca5a5; background: #fef2f2; }
.om-stuck-card-left { min-width: 180px; flex-shrink: 0; }
.om-stuck-modulo {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.om-stuck-id {
  font-family: monospace;
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 6px;
}
.om-stuck-card-right { flex: 1; }
.om-stuck-days-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.om-stuck-days-num { font-size: 28px; font-weight: 900; line-height: 1; }
.om-stuck-days-lbl { font-size: 11px; color: var(--text-muted); }

.om-stuck-bar-wrap { width: 100%; }
.om-stuck-bar-bg {
  position: relative;
  height: 8px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: visible;
  margin-bottom: 4px;
}
.om-stuck-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .4s ease;
}
.om-stuck-bar-limit {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 14px;
  background: #94a3b8;
  border-radius: 1px;
}
.om-stuck-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #94a3b8;
}

/* ══════════════════════════════════════════════════════
   EMPRESAS & USUARIOS
══════════════════════════════════════════════════════ */
.om-emp-summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 18px 20px;
  background: linear-gradient(135deg, #f8faff 0%, #f1f5f9 100%);
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
}
.om-emp-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 80px;
  text-align: center;
  padding: 8px 0;
  border-right: 1px solid #e2e8f0;
}
.om-emp-stat:last-child { border-right: none; }
.om-emp-stat-num { font-size: 26px; font-weight: 900; color: #1e293b; }
.om-emp-stat-lbl { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); }
.om-emp-stat-ok   .om-emp-stat-num { color: #16a34a; }
.om-emp-stat-warn .om-emp-stat-num { color: #d97706; }
.om-emp-stat-danger .om-emp-stat-num { color: #dc2626; }

.om-companies-list { display: flex; flex-direction: column; gap: 16px; }

.om-company-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.om-company-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  gap: 12px;
}
.om-company-header-left { display: flex; align-items: center; gap: 12px; }
.om-company-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.om-company-ok     { background: #f0fdf4; color: #16a34a; border: 1.5px solid #86efac; }
.om-company-warn   { background: #fffbeb; color: #d97706; border: 1.5px solid #fde68a; }
.om-company-danger { background: #fef2f2; color: #dc2626; border: 1.5px solid #fca5a5; }
.om-company-name { font-size: 14px; font-weight: 700; color: #1e293b; }
.om-company-meta { font-size: 11px; color: var(--text-muted); }
.om-company-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
}
.om-company-status-ok     { background: #f0fdf4; color: #16a34a; }
.om-company-status-warn   { background: #fffbeb; color: #d97706; }
.om-company-status-danger { background: #fef2f2; color: #dc2626; }

/* Tabla de usuarios */
.om-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.om-users-table thead tr { background: #f8fafc; }
.om-users-table thead th {
  padding: 8px 16px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #94a3b8;
  border-bottom: 1px solid #f1f5f9;
}
.om-users-table tbody tr { border-bottom: 1px solid #f8fafc; transition: background .12s; }
.om-users-table tbody tr:last-child { border-bottom: none; }
.om-users-table tbody tr:hover { background: #fafbfc; }
.om-users-table td { padding: 10px 16px; vertical-align: middle; }
.om-user-inactive { opacity: 0.55; }

.om-user-row { display: flex; align-items: center; gap: 10px; }
.om-user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
  flex-shrink: 0;
  color: #fff;
}
.om-avatar-ok      { background: #22c55e; }
.om-avatar-ok-soft { background: #64748b; }
.om-avatar-warn    { background: #f59e0b; }
.om-avatar-danger  { background: #ef4444; }

.om-user-name { font-size: 12px; font-weight: 600; color: #1e293b; }
.om-user-email { font-size: 10px; color: #94a3b8; }
.om-inactive-tag {
  display: inline-block;
  font-size: 9px;
  background: #e2e8f0;
  color: #64748b;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
  font-weight: 600;
}

.om-role-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: #f1f5f9;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}
.om-role-chip i { font-size: 9px; }

.om-last-login-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
}
.om-login-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.om-dot-ok      { background: #22c55e; }
.om-dot-ok-soft { background: #94a3b8; }
.om-dot-warn    { background: #f59e0b; }
.om-dot-danger  { background: #ef4444; }
.om-login-time { font-weight: 600; color: #334155; }
.om-login-abs  { font-size: 10px; color: #94a3b8; }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .om-kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  .om-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .om-tabs { flex-direction: column; }
  .om-header { flex-direction: column; align-items: flex-start; }
  .om-emp-summary { flex-direction: column; }
  .om-stuck-card { flex-direction: column; gap: 12px; }
  .om-stuck-card-left { min-width: unset; }
  .om-tab-content { padding: 14px; }
}
