/* Score Conductores — estilos del dashboard */

/* Sin scrollbar de página en esta vista */
html.sc-page,
html.sc-page body {
  overflow: hidden;
  height: 100%;
}

.sc-wrap {
  padding: 20px 24px;
  max-width: 1400px;
  margin: 0 auto;
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  /* Scroll interno — la página no muestra barra */
  height: calc(100vh - 105px);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Scrollbar delgada del contenido principal */
.sc-wrap::-webkit-scrollbar { width: 3px; }
.sc-wrap::-webkit-scrollbar-track { background: transparent; }
.sc-wrap::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 3px; }
[data-theme="dark"] .sc-wrap::-webkit-scrollbar-thumb { background: #334155; }

/* ── Cabecera ── */
.sc-header {
  margin-bottom: 24px;
}

.sc-title-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 14px;
}

.sc-title {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.sc-subtitle {
  font-size: 13px;
  color: #64748b;
}

.sc-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.sc-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sc-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sc-select,
.sc-input {
  height: 36px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  color: #0f172a;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.sc-select:focus,
.sc-input:focus {
  border-color: #2563eb;
}

.sc-btn-refresh {
  height: 36px;
  width: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
  transition: background 0.15s;
}

.sc-btn-refresh:hover { background: #f1f5f9; }

/* ── Tarjetas ── */
.sc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.sc-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 1px 4px rgba(15,23,42,.05);
}

.sc-card-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}

.sc-card-value {
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
}

.sc-card-green .sc-card-value { color: #16a34a; }
.sc-card-red .sc-card-value   { color: #dc2626; }
.sc-card-yellow .sc-card-value { color: #d97706; }

/* ── Loader / error ── */
.sc-loader {
  text-align: center;
  padding: 32px;
  color: #64748b;
  font-size: 14px;
}

.sc-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* Scrollbar delgada tabla principal (sin barra vertical blanca) */
.sc-table-wrap::-webkit-scrollbar { height: 3px; width: 0; }
.sc-table-wrap::-webkit-scrollbar-track { background: transparent; }
.sc-table-wrap::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
[data-theme="dark"] .sc-table-wrap::-webkit-scrollbar-thumb { background: #334155; }

/* ── Tabla ── */
.sc-table-wrap {
  overflow-x: auto;
  border-radius: 16px;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 8px 32px rgba(15,23,42,.10),
    0 2px 8px rgba(15,23,42,.06),
    inset 0 0 0 1px rgba(255,255,255,0.7);
  border: 1px solid rgba(226,232,240,0.9);
}

.sc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sc-table th {
  padding: 13px 16px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #c7d2e0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, #1e2d42 0%, #0f172a 100%);
  border-bottom: 2px solid #3b82f6;
  border-right: 1px solid rgba(59,130,246,0.15);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sc-table th:last-child { border-right: none; }
.sc-table thead tr th:first-child { border-top-left-radius: 14px; }
.sc-table thead tr th:last-child  { border-top-right-radius: 14px; }

.sc-table th:hover {
  background: linear-gradient(180deg, #2d3f57 0%, #1e2d42 100%);
  color: #f1f5f9;
}

.sc-table td {
  padding: 11px 16px;
  border-bottom: 1px solid rgba(226,232,240,0.6);
  vertical-align: middle;
  text-align: center;
  color: #0f172a;
}

.sc-row:last-child td { border-bottom: none; }
.sc-row:hover td { background: rgba(59,130,246,0.04); }

/* Colores de fila por nivel */
.sc-row.sc-nivel-critico td:first-child   { border-left: 3px solid #dc2626; }
.sc-row.sc-nivel-regular td:first-child   { border-left: 3px solid #ea580c; }
.sc-row.sc-nivel-bueno td:first-child     { border-left: 3px solid #ca8a04; }
.sc-row.sc-nivel-excelente td:first-child { border-left: 3px solid #16a34a; }

.sc-td-rank  { color: #94a3b8; font-size: 12px; font-weight: 700; width: 38px; text-align: center; }
.sc-td-placa { font-size: 14px; text-align: left; }
.sc-td-name  { text-align: left; color: #334155; }
.sc-td-flota { color: #475569; text-align: left; }
.sc-td-num   { text-align: center; color: #475569; }

/* Barra de score */
.sc-td-score { min-width: 140px; }
.sc-score-bar-wrap {
  height: 5px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 3px;
}
.sc-score-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}
.sc-bar-excelente { background: #16a34a; }
.sc-bar-bueno     { background: #ca8a04; }
.sc-bar-regular   { background: #ea580c; }
.sc-bar-critico   { background: #dc2626; }

.sc-score-num {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

/* Badges de nivel */
.sc-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.sc-badge-excelente { background: #dcfce7; color: #15803d; }
.sc-badge-bueno     { background: #fef9c3; color: #a16207; }
.sc-badge-regular   { background: #ffedd5; color: #c2410c; }
.sc-badge-critico   { background: #fee2e2; color: #b91c1c; }

/* Botón ver detalle */
.sc-btn-det {
  padding: 4px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  color: #2563eb;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s;
}
.sc-btn-det:hover { background: #eff6ff; }

.sc-empty {
  text-align: center;
  padding: 40px;
  color: #94a3b8;
  font-size: 14px;
}

/* ── Panel de detalle ── */
/* NOTE: el panel se mueve a document.body vía JS para evitar
   que transitions/transforms del sidebar rompan position:fixed */
.sc-detail-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  height: 100vh;
  width: min(640px, 95vw);
  min-width: 360px;
  max-width: 900px;
  background: #fff;
  border-left: 1px solid #e2e8f0;
  box-shadow: -4px 0 32px rgba(15,23,42,.12);
  display: flex;
  flex-direction: column;
  z-index: 99999;
  overflow: hidden;
}

/* Handle de resize — borde izquierdo del panel */
.sc-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  z-index: 2;
  background: transparent;
  transition: background 0.15s;
}
.sc-resize-handle:hover,
.sc-resize-handle.sc-dragging {
  background: rgba(59,130,246,0.30);
}
[data-theme="dark"] .sc-resize-handle:hover,
[data-theme="dark"] .sc-resize-handle.sc-dragging {
  background: rgba(59,130,246,0.22);
}

/* Distintivo visual de resize — píldora centrada verticalmente */
.sc-resize-handle::after {
  content: '⇔';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #e2e8f0;
  color: #64748b;
  font-size: 9px;
  line-height: 1;
  padding: 4px 3px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(15,23,42,.12);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 0.15s, background 0.15s;
}
.sc-resize-handle:hover::after,
.sc-resize-handle.sc-dragging::after {
  background: #3b82f6;
  border-color: #2563eb;
  color: #fff;
  opacity: 1;
}
[data-theme="dark"] .sc-resize-handle::after {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}
[data-theme="dark"] .sc-resize-handle:hover::after,
[data-theme="dark"] .sc-resize-handle.sc-dragging::after {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
}

.sc-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  flex-shrink: 0;
}

.sc-detail-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.sc-detail-close {
  background: none;
  border: none;
  font-size: 18px;
  color: #64748b;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.sc-detail-close:hover { background: #e2e8f0; }

.sc-detail-body {
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Scrollbar delgada y temática del panel de detalle */
.sc-detail-body::-webkit-scrollbar { width: 4px; }
.sc-detail-body::-webkit-scrollbar-track { background: transparent; }
.sc-detail-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.sc-detail-body::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
[data-theme="dark"] .sc-detail-body::-webkit-scrollbar-thumb { background: #334155; }
[data-theme="dark"] .sc-detail-body::-webkit-scrollbar-thumb:hover { background: #475569; }

.sc-loading-det,
.sc-det-empty,
.sc-det-error {
  font-size: 13px;
  color: #64748b;
  padding: 20px 0;
  text-align: center;
}

.sc-det-error { color: #dc2626; }

/* Tabla de detalle de eventos */
.sc-det-table-wrap {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(226,232,240,0.9);
  box-shadow: 0 4px 16px rgba(15,23,42,.08), 0 1px 4px rgba(15,23,42,.05);
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.sc-det-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.sc-det-table th {
  padding: 10px 12px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: #c7d2e0;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
  background: linear-gradient(180deg, #1e2d42 0%, #0f172a 100%);
  border-bottom: 2px solid #3b82f6;
  border-right: 1px solid rgba(59,130,246,0.15);
}
.sc-det-table th:last-child { border-right: none; }
.sc-det-table th:first-child { border-top-left-radius: 10px; }
.sc-det-table th:last-child  { border-top-right-radius: 10px; }

.sc-det-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(226,232,240,0.55);
  vertical-align: middle;
  text-align: center;
  color: #0f172a;
}
.sc-det-table tr:last-child td { border-bottom: none; }
.sc-det-table tr:hover td { background: rgba(59,130,246,0.04); }

.sc-det-fecha { color: #64748b; font-size: 11px; white-space: nowrap; }
.sc-det-descuento { color: #dc2626; font-weight: 700; }

.sc-tol-ok  { color: #16a34a; font-weight: 600; font-size: 11px; }
.sc-tol-no  { color: #dc2626; font-weight: 600; font-size: 11px; }

.sc-det-tipo-cell { white-space: nowrap; }
.sc-det-tipo { font-size: 12px; font-weight: 600; color: #0f172a; }
.sc-det-valor { font-variant-numeric: tabular-nums; white-space: nowrap; color: #0f172a; }

/* Botón ⓘ con tooltip */
.sc-info-wrap {
  position: relative;
  display: inline-block;
  vertical-align: middle;
}

.sc-info-btn {
  background: none;
  border: none;
  padding: 0 2px;
  font-size: 13px;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  vertical-align: middle;
  position: relative;
  top: -2px;
  transition: color 0.15s;
}
.sc-info-btn:hover { color: #3b82f6; }

.sc-info-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  padding: 6px 10px;
  border-radius: 7px;
  white-space: normal;
  width: 220px;
  box-shadow: 0 4px 16px rgba(0,0,0,.22);
  z-index: 100000;
  pointer-events: none;
}
.sc-info-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e293b;
}

.sc-info-wrap:hover .sc-info-tip { display: block; }

[data-theme="dark"] .sc-det-tipo  { color: #f1f5f9; }
[data-theme="dark"] .sc-det-valor { color: #cbd5e1; }
[data-theme="dark"] .sc-info-btn  { color: #475569; }
[data-theme="dark"] .sc-info-btn:hover { color: #60a5fa; }
[data-theme="dark"] .sc-info-tip  { background: #0f172a; color: #cbd5e1; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
[data-theme="dark"] .sc-info-tip::after { border-top-color: #0f172a; }

/* ── Filtros adicionales ── */
.sc-select-empresa {
  min-width: 180px;
}

.sc-select-placa {
  min-width: 130px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sc-wrap { padding: 12px; }
  .sc-cards { grid-template-columns: repeat(2, 1fr); }
  .sc-detail-panel { width: 100vw; }
}

/* ── Dark Mode ── */
[data-theme="dark"] .sc-title { color: #f1f5f9; }
[data-theme="dark"] .sc-subtitle { color: #94a3b8; }
[data-theme="dark"] .sc-label { color: #94a3b8; }

[data-theme="dark"] .sc-select,
[data-theme="dark"] .sc-input {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}
[data-theme="dark"] .sc-select:focus,
[data-theme="dark"] .sc-input:focus { border-color: #3b82f6; }

[data-theme="dark"] .sc-btn-refresh {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}
[data-theme="dark"] .sc-btn-refresh:hover { background: #334155; }

[data-theme="dark"] .sc-card {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .sc-card-label { color: #94a3b8; }
[data-theme="dark"] .sc-card-value { color: #f1f5f9; }
[data-theme="dark"] .sc-card-green .sc-card-value { color: #4ade80; }
[data-theme="dark"] .sc-card-red .sc-card-value   { color: #f87171; }
[data-theme="dark"] .sc-card-yellow .sc-card-value { color: #fbbf24; }

[data-theme="dark"] .sc-table-wrap {
  background: rgba(15,23,42,0.82);
  border-color: rgba(51,65,85,0.8);
  box-shadow:
    0 8px 32px rgba(0,0,0,.28),
    0 2px 8px rgba(0,0,0,.18);
}
[data-theme="dark"] .sc-table th {
  background: linear-gradient(180deg, #0a1628 0%, #020c1a 100%);
  color: #7a9cc0;
  border-bottom-color: #2563eb;
  border-right-color: rgba(37,99,235,0.2);
}
[data-theme="dark"] .sc-table th:hover {
  background: linear-gradient(180deg, #0f1f35 0%, #0a1628 100%);
  color: #94b4d8;
}
[data-theme="dark"] .sc-table td { border-color: rgba(51,65,85,0.4); color: #cbd5e1; }
[data-theme="dark"] .sc-row:hover td { background: rgba(59,130,246,0.06); }

[data-theme="dark"] .sc-td-rank { color: #475569; }
[data-theme="dark"] .sc-td-name { color: #94a3b8; }
[data-theme="dark"] .sc-td-placa strong { color: #f1f5f9; }
[data-theme="dark"] .sc-td-flota { color: #64748b; }
[data-theme="dark"] .sc-td-num { color: #64748b; }
[data-theme="dark"] .sc-score-num { color: #f1f5f9; }
[data-theme="dark"] .sc-score-bar-wrap { background: #1e293b; }

[data-theme="dark"] .sc-btn-det {
  background: #1e293b;
  border-color: #334155;
  color: #60a5fa;
}
[data-theme="dark"] .sc-btn-det:hover { background: #0f172a; }

[data-theme="dark"] .sc-empty { color: #475569; }

[data-theme="dark"] .sc-error {
  background: #2c1810;
  border-color: #7f1d1d;
  color: #fca5a5;
}

[data-theme="dark"] .sc-loader { color: #94a3b8; }

[data-theme="dark"] .sc-detail-panel {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .sc-detail-header {
  background: #0f172a;
  border-color: #334155;
}
[data-theme="dark"] .sc-detail-title { color: #f1f5f9; }
[data-theme="dark"] .sc-detail-close { color: #94a3b8; }
[data-theme="dark"] .sc-detail-close:hover { background: #334155; }

[data-theme="dark"] .sc-det-table-wrap {
  background: rgba(15,23,42,0.82);
  border-color: rgba(51,65,85,0.7);
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
}
[data-theme="dark"] .sc-det-table th {
  background: linear-gradient(180deg, #0a1628 0%, #020c1a 100%);
  border-bottom-color: #2563eb;
  border-right-color: rgba(37,99,235,0.2);
  color: #7a9cc0;
}
[data-theme="dark"] .sc-det-table td { border-color: rgba(51,65,85,0.35); color: #cbd5e1; }
[data-theme="dark"] .sc-det-table tr:hover td { background: rgba(59,130,246,0.06); }
[data-theme="dark"] .sc-det-fecha { color: #64748b; }

[data-theme="dark"] .sc-loading-det,
[data-theme="dark"] .sc-det-empty { color: #475569; }

