@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600&display=swap');

:root {
  --atenea-cyan: #4fc3f7;
  --atenea-cyan-glow: #66d7ff;
  --atenea-orange: #F3722C;
  /* Atenea steel — superficie Hub */
  --bg-app: #10151d;
  --bg-card: #141a24;
  --border-sub: #3d4a5c;
  --text-main: #c8d0dc;
  --text-muted: #7a8799;
  --ease-atenea: cubic-bezier(0.22, 0.61, 0.36, 1);
  --auth-morph-ms: 0.72s;
  --auth-anchor-shift: 0vh;

  /* Divisorias con jerarquía: marco > secciones > filas */
  --div-strong: rgba(61, 74, 92, 0.9);
  --div-soft: rgba(90, 106, 125, 0.34);
  --div-fade: linear-gradient(90deg, transparent 0%, rgba(90, 106, 125, 0.45) 8%, rgba(90, 106, 125, 0.45) 92%, transparent 100%);
  --div-fade-soft: linear-gradient(90deg, transparent 0%, rgba(90, 106, 125, 0.26) 10%, rgba(90, 106, 125, 0.26) 90%, transparent 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-card);
  color: var(--text-main);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* —— Entrada unificada: splash + login, sin caja —— */
#auth-section {
  position: fixed;
  inset: 0;
  z-index: 20;
  min-height: 100vh;
  background: #0a0c10;
  transition: opacity 0.45s ease, background 0.45s ease;
}

.auth-stage {
  position: relative;
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-x: hidden;
  overflow-y: auto;
}

.auth-stage.auth-morphed,
.auth-stage.auth-skip-splash {
  --auth-anchor-shift: -14vh;
}

.rose-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}

.rose-container--auth {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-50% + var(--auth-anchor-shift)));
  width: 400px;
  height: 400px;
  opacity: 1;
  transition:
    transform var(--auth-morph-ms) var(--ease-atenea),
    opacity var(--auth-morph-ms) var(--ease-atenea);
}

.auth-stage.auth-morphed .rose-container--auth {
  opacity: 0.52;
}

.auth-stage.auth-skip-splash .rose-container--auth {
  transition: none;
}

.rose-container--auth .rose-svg {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  animation: roseIn 1.2s var(--ease-atenea) forwards;
}

.rose-container--auth .rose-svg.idle {
  opacity: 1;
  transform: scale(1);
  animation: roseIdleLogin 3.2s ease-in-out infinite alternate;
}

.auth-content {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 100%;
  max-width: 318px;
  text-align: center;
  transform: translate(-50%, calc(-50% + var(--auth-anchor-shift)));
  transition: transform var(--auth-morph-ms) var(--ease-atenea);
}

.auth-stage.auth-skip-splash .auth-content {
  transition: none;
}

.rose-spin {
  transform-origin: 190px 190px;
  animation: spinSlow 90s linear infinite;
  will-change: transform;
}

.cardinal-glint { animation: glintPulse 4.8s ease-in-out infinite; }
.cardinal-glint--n { animation-delay: 0s; }
.cardinal-glint--s { animation-delay: 0.6s; }
.cardinal-glint--w { animation-delay: 1.2s; }
.cardinal-glint--e { animation-delay: 1.8s; }

.auth-brand {
  margin-bottom: 0;
  opacity: 0;
  animation: brandFadeIn 1s var(--ease-atenea) 0.25s forwards;
}

.auth-stage.auth-morphed .auth-brand {
  animation: none;
  opacity: 1;
}

.auth-stage.auth-skip-splash .auth-brand {
  animation: none;
  opacity: 1;
}

.auth-brand-name {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  color: var(--atenea-cyan);
  font-size: 44px;
  letter-spacing: 10px;
  padding-left: 10px;
  transition:
    font-size var(--auth-morph-ms) var(--ease-atenea),
    letter-spacing var(--auth-morph-ms) var(--ease-atenea),
    padding var(--auth-morph-ms) var(--ease-atenea);
}

.auth-stage.auth-morphed .auth-brand-name {
  font-size: 22px;
  letter-spacing: 8px;
  padding-left: 8px;
}

.auth-stage.auth-skip-splash .auth-brand-name {
  font-size: 22px;
  letter-spacing: 8px;
  padding-left: 8px;
}

.auth-brand-line {
  height: 1px;
  width: 180px;
  margin: 10px auto;
  background: linear-gradient(to right, transparent, #a8b8c8, transparent);
  opacity: 0.75;
  transition:
    width var(--auth-morph-ms) var(--ease-atenea),
    margin var(--auth-morph-ms) var(--ease-atenea),
    opacity var(--auth-morph-ms) var(--ease-atenea);
}

.auth-stage.auth-morphed .auth-brand-line {
  width: 140px;
  margin: 10px auto;
  opacity: 1;
}

.auth-brand-by {
  display: inline-block;
  margin-top: 0;
  background: #9eaebb;
  padding: 4px 14px;
  border-radius: 3px;
  font-size: 11px;
  color: #182231;
  font-style: italic;
  letter-spacing: 1.5px;
  transition: padding var(--auth-morph-ms) var(--ease-atenea), font-size var(--auth-morph-ms) var(--ease-atenea);
}

.auth-stage.auth-morphed .auth-brand-by {
  padding: 2px 10px;
  font-size: 9px;
}

.auth-stage.auth-skip-splash .auth-brand-by {
  padding: 2px 10px;
  font-size: 9px;
}

.auth-form-block {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 18px);
  width: 100%;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  text-align: left;
  transition:
    opacity 0.42s var(--ease-atenea),
    visibility 0s linear 0.42s;
}

.auth-form-block > .auth-title,
.auth-form-block > .sub,
.auth-form-block > .ver,
.auth-form-block .auth-form > label,
.auth-form-block .auth-form > input,
.auth-form-block .auth-form > .auth-pass-wrap,
.auth-form-block .auth-form > button[type="submit"] {
  opacity: 0;
  transform: translate3d(0, 10px, 0);
  transition:
    opacity 0.38s var(--ease-atenea),
    transform 0.38s var(--ease-atenea);
}

.auth-stage.auth-morphed .auth-form-block {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
  transition:
    opacity 0.42s var(--ease-atenea) 0.08s,
    visibility 0s;
}

.auth-stage.auth-morphed .auth-title {
  opacity: 1;
  transform: none;
  transition-delay: 0.1s;
}

.auth-stage.auth-morphed .sub {
  opacity: 1;
  transform: none;
  transition-delay: 0.16s;
}

.auth-stage.auth-morphed .auth-form label:nth-of-type(1) {
  opacity: 1;
  transform: none;
  transition-delay: 0.22s;
}

.auth-stage.auth-morphed .auth-form input#login-alias {
  opacity: 1;
  transform: none;
  transition-delay: 0.28s;
}

.auth-stage.auth-morphed .auth-form label:nth-of-type(2) {
  opacity: 1;
  transform: none;
  transition-delay: 0.34s;
}

.auth-stage.auth-morphed .auth-pass-wrap {
  opacity: 1;
  transform: none;
  transition-delay: 0.4s;
}

.auth-stage.auth-morphed .auth-form button[type="submit"] {
  opacity: 1;
  transform: scale(1);
  transition-delay: 0.46s;
}

.auth-stage.auth-morphed .ver {
  opacity: 1;
  transform: none;
  transition-delay: 0.52s;
}

.auth-firma {
  position: fixed;
  right: 20px;
  bottom: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.5s ease 0.75s;
  pointer-events: none;
}

.auth-stage.auth-morphed .auth-firma {
  opacity: 1;
}

.auth-firma .mf-atenea {
  font-family: 'Cinzel', serif;
  letter-spacing: 4px;
  font-size: 9px;
  color: var(--atenea-cyan);
  opacity: 0.5;
}

.auth-firma .mf-by {
  font-size: 9px;
  color: #a8b8c8;
  font-style: italic;
  opacity: 0.3;
}

@keyframes roseIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes brandFadeIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes roseIdleLogin {
  from { opacity: 0.94; }
  to { opacity: 1; }
}
@keyframes glintPulse {
  0%, 100% { opacity: 0.18; }
  50% { opacity: 0.42; }
}

.auth-title {
  font-size: 16px;
  color: var(--atenea-cyan);
  margin-bottom: 6px;
  text-align: center;
  font-weight: 600;
}

.sub {
  font-size: 12px;
  color: #555;
  text-align: center;
  margin-bottom: 14px;
  line-height: 1.4;
}

.auth-form label {
  display: block;
  font-size: 12px;
  color: #888;
  margin-bottom: 5px;
  text-align: left;
}

.auth-form {
  text-align: left;
}

.auth-form input[type="text"],
.auth-form input[type="password"] {
  width: 100%;
  padding: 7px 10px;
  margin-bottom: 10px;
  background: #0f1117;
  border: 1px solid #2a2d3a;
  border-radius: 8px;
  color: #a8b8c8;
  font-size: 12px;
  font-family: inherit;
  text-align: left;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-form input:focus {
  border-color: var(--atenea-cyan);
  box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.12);
}

.auth-form button[type="submit"] {
  width: 100%;
  margin-top: 6px;
  padding: 5px 10px;
  background: transparent;
  color: var(--atenea-cyan);
  border: 1px solid #4fc3f755;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition:
    background 0.2s,
    border-color 0.2s,
    opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
  transform: scale(0.98);
}

.auth-form button[type="submit"]:hover {
  background: #4fc3f711;
  border-color: var(--atenea-cyan);
}

.auth-pass-wrap {
  position: relative;
  width: 100%;
  margin-bottom: 10px;
}

.auth-pass-wrap input {
  margin-bottom: 0 !important;
  padding-right: 36px !important;
}

/* Sin type=password: evita el segundo ojo nativo de Edge/Chrome */
.auth-pass-wrap input.auth-pass-masked {
  -webkit-text-security: disc;
  text-security: disc;
}

.auth-pass-wrap input.auth-pass-masked.is-visible {
  -webkit-text-security: none;
  text-security: none;
}

.auth-pass-wrap input::-ms-reveal,
.auth-pass-wrap input::-ms-clear {
  display: none;
  width: 0;
  height: 0;
}

.auth-pass-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #3d4155;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-pass-toggle.is-revealing {
  color: var(--atenea-cyan);
  background: #4fc3f714;
}

/* Salida al dashboard (paridad desktop login-exit) */
.auth-stage.auth-exit {
  pointer-events: none;
}

.auth-stage.auth-exit .auth-content {
  opacity: 0;
  transform: translate(-50%, calc(-50% + var(--auth-anchor-shift) + 10px)) scale(0.98);
  transition: opacity 0.42s ease, transform 0.42s var(--ease-atenea);
}

.auth-stage.auth-exit .rose-container--auth {
  opacity: 0.06;
  transform: translate(-50%, calc(-50% + var(--auth-anchor-shift))) scale(0.96);
  transition: opacity 0.5s ease 0.04s, transform 0.5s var(--ease-atenea) 0.04s;
}

.auth-stage.auth-exit .auth-firma {
  opacity: 0;
  transition: opacity 0.22s ease;
}

#auth-section.auth-section-exiting {
  pointer-events: none;
  background: transparent;
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .auth-brand,
  .auth-form-block,
  .auth-form-block > *,
  .rose-container--auth,
  .rose-container--auth .rose-svg,
  .auth-content,
  .auth-firma,
  #dashboard-section.dashboard-entering {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
  /* Sin animación roseIn, opacity quedaba en 0 y la rosa no se veía. */
  .rose-container--auth .rose-svg {
    opacity: 1 !important;
  }
}

.auth-error {
  font-size: 12px;
  color: #f44336;
  margin-top: 8px;
  text-align: center;
}

.ver {
  text-align: center;
  font-size: 11px;
  color: #3d4155;
  margin-top: 14px;
  letter-spacing: 0.5px;
}

.error { color: #f44336; font-size: 12px; }

/* —— Dashboard —— */
#dashboard-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
}

#dashboard-section.dashboard-entering {
  opacity: 0;
  transform: translateY(12px);
}

#dashboard-section.dashboard-entering.dashboard-visible {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.58s cubic-bezier(0.22, 0.61, 0.36, 1) 0.12s,
    transform 0.58s cubic-bezier(0.22, 0.61, 0.36, 1) 0.12s;
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: linear-gradient(180deg, #1a2230 0%, #141a24 100%);
  border-bottom: 1px solid var(--div-strong);
}
.titlebar img { width: 28px; height: 28px; }
.titlebar .tb-title {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--atenea-cyan);
  font-weight: 600;
}
.titlebar .tb-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
}
.titlebar-spacer { flex: 1; }
.titlebar .user-meta {
  font-size: 11px;
  color: #888;
  margin-right: 8px;
}
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 2px 8px;
  min-height: 0;
  height: auto;
  line-height: 1.2;
  background: transparent;
  border: 1px solid var(--border-sub);
  border-radius: 6px;
  color: #8b97a8;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn-ghost:hover {
  border-color: #8898a8;
  color: #c5cdd8;
  background: rgba(96, 125, 139, 0.12);
}
.btn-reconstruir-sede i { margin-right: 0; font-size: 10px; }
.btn-reconstruir-sede--busy {
  opacity: 0.6;
  pointer-events: none;
}

/* Pestañas por sede (estilo tracker) */
.sede-bar {
  padding: 6px 16px 0;
  background: var(--bg-card);
  border-bottom: 1px solid transparent;
  border-image: var(--div-fade) 1;
}
#sede-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: flex-end;
}
.sede-pill-group {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  flex-shrink: 0;
}
.sede-pill-group-lbl {
  font-size: 9px;
  letter-spacing: 0.3px;
  color: #8a96a8;
  white-space: nowrap;
  line-height: 1.15;
  padding-left: 2px;
}
.sede-pill-group-pills {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;
}
.sede-pill-sep {
  flex-shrink: 0;
  align-self: flex-end;
  color: #3d4a5e;
  font-size: 12px;
  line-height: 22px;
  padding: 0 2px;
  user-select: none;
}
.tab {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  min-height: 0;
  height: auto;
  line-height: 1.2;
  border: 1px solid var(--border-sub);
  border-radius: 999px;
  background: #1a1d28;
  color: #888;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.tab:hover:not(.active) {
  border-color: #3d4a5e;
  color: var(--text-main);
}
.tab.active {
  border-color: var(--atenea-cyan);
  background: rgba(79, 195, 247, 0.12);
  color: var(--atenea-cyan);
  box-shadow: 0 0 12px rgba(79, 195, 247, 0.15);
}
.tab .tab-count {
  margin-left: 6px;
  opacity: 0.7;
  font-size: 10px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid transparent;
  border-image: var(--div-fade-soft) 1;
}
.toolbar select {
  padding: 6px 10px;
  background: #0f1117;
  border: 1px solid var(--border-sub);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 12px;
}

/* Barra filtros matriz (paridad tracker, sin panel «Filtros» expandible) */
.matriz-barra-filtros {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 16px;
  padding: 8px 16px;
  border-bottom: 1px solid transparent;
  border-image: var(--div-fade-soft) 1;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
}
.barra-filtros-busqueda {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  min-width: 0;
}
.barra-empresa {
  justify-self: end;
  white-space: nowrap;
  font-size: 11px;
}
.matriz-bq-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: min(255px, 100%);
}
.matriz-bq-field {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  height: 28px;
}
.matriz-bq-ico {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #8898a8;
}
.matriz-bq-inp {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0 8px 0 28px;
  border-radius: 6px;
  border: 1px solid var(--border-sub);
  background: #0f1117;
  color: var(--text-main);
  font-size: 11px;
  font-family: inherit;
  outline: none;
}
.matriz-bq-inp:focus {
  border-color: rgba(79, 195, 247, 0.45);
}
.matriz-bq-inp::placeholder {
  color: #5f7388;
}
.matriz-bq-clear {
  display: none;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  height: 28px;
  min-width: 28px;
  padding: 0 6px;
  font-size: 10px;
  border-radius: 6px;
  border: 1px solid var(--border-sub);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
}
.matriz-bq-clear.visible {
  display: inline-flex;
}
.matriz-bq-clear:hover {
  border-color: #f4433655;
  color: #f44336;
}
.filtro-sep-v {
  width: 1px;
  height: 16px;
  background: linear-gradient(180deg, transparent, rgba(90, 106, 125, 0.55), transparent);
  flex-shrink: 0;
}
.filtro-semana-lbl {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.semana-badge {
  border: 1px solid var(--border-sub);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}
.toggle-semana {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  /* Un tris más grande + hueco derecho para el “bombillo” */
  padding: 3px 14px 3px 9px;
  min-height: 0;
  height: auto;
  line-height: 1.25;
  border-radius: 6px;
  border: 1px solid var(--border-sub);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
  font-family: inherit;
}
/* Bombillo apagado: socket oscuro siempre (dentro del botón) */
.toggle-semana::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #1a222c;
  border: none;
  box-shadow: 0 0 0 0.5px #2a3340;
  pointer-events: none;
}
/* Bombillo prendido: filtros activos (Esta semana / Activos) */
.toggle-semana.activo:not(.btn-finalizar-sistema)::after {
  background: var(--atenea-cyan);
  border: none;
  box-shadow: 0 0 1.5px rgba(79, 195, 247, 0.55);
}
.toggle-semana:hover {
  border-color: #8898a8;
  color: #c5cdd8;
  background: rgba(96, 125, 139, 0.12);
}
.toggle-semana.activo {
  border-color: var(--steel-border-soft, rgba(136, 152, 168, 0.45));
  color: var(--steel-text-hover, #c5cdd8);
  background: var(--steel-fill-soft, rgba(96, 125, 139, 0.12));
}

.summary {
  padding: 8px 16px;
  font-size: 11px;
  line-height: 1.45;
  color: #7a8799;
}
.summary .sum-lbl {
  color: #5f6d80;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.summary .sum-val {
  color: #c5d0e0;
}
.summary .sum-sep {
  color: #4a5568;
  margin: 0 1px;
}

.table-wrap {
  flex: 1;
  overflow: auto;
  padding: 0 16px 16px;
}

.matriz-wrap {
  border-top: none;
}

/* Foco de fila (paridad desktop): atenuar/blur el resto al trabajar una fila */
#tabla-wrap table tbody tr[data-id] > td {
  transition: opacity 320ms ease, filter 360ms ease;
}
#tabla-wrap.tabla-wrap--panel-foco table tbody tr[data-id] > td {
  transition:
    opacity 320ms ease,
    filter 360ms ease,
    background-color 260ms ease,
    box-shadow 260ms ease;
}
#tabla-wrap.tabla-wrap--panel-foco table tbody tr[data-id]:not(.fila-panel-foco) > td {
  opacity: 0.52 !important;
  filter: saturate(0.76) brightness(0.88) blur(1.1px);
}
#tabla-wrap.tabla-wrap--panel-foco table tbody tr[data-id].fila-panel-tenue-1:not(.fila-panel-foco) > td {
  opacity: 0.12 !important;
}
#tabla-wrap.tabla-wrap--panel-foco table tbody tr[data-id].fila-panel-tenue-2:not(.fila-panel-foco) > td {
  opacity: 0.18 !important;
}
#tabla-wrap.tabla-wrap--panel-foco table tbody tr[data-id].fila-panel-tenue-3:not(.fila-panel-foco) > td {
  opacity: 0.28 !important;
}
#tabla-wrap.tabla-wrap--panel-foco table tbody tr[data-id].fila-panel-tenue-4:not(.fila-panel-foco) > td {
  opacity: 0.45 !important;
}
#tabla-wrap.tabla-wrap--panel-foco table tbody tr[data-id].fila-panel-tenue-5:not(.fila-panel-foco) > td {
  opacity: 0.60 !important;
}
#tabla-wrap.tabla-wrap--panel-foco table tbody tr.fila-panel-foco > td {
  opacity: 1 !important;
  filter: none !important;
  background-color: rgba(79, 195, 247, 0.07);
  box-shadow: none;
}
#tabla-wrap table tbody tr.fila-seleccionada > td {
  background-color: #1e2338;
}
#tabla-wrap table tbody tr[data-id] {
  cursor: pointer;
}
#tabla-wrap table tbody tr td.fila-editable-text {
  cursor: pointer;
  transition: color 0.12s ease;
}
#tabla-wrap table tbody tr td.fila-editable-text:hover,
#tabla-wrap table tbody tr td.fila-editable-text:focus-within {
  color: var(--atenea-cyan, #4fc3f7) !important;
}
#tabla-wrap table tbody tr td.fila-editable-text:hover .td-conductor-nombre,
#tabla-wrap table tbody tr td.fila-editable-text:hover .td-conductor-nombre .js-auto-marquee__text {
  color: inherit;
}

.matriz-table {
  min-width: 1100px;
}

.matriz-table .td-id-ext {
  font-family: ui-monospace, Consolas, monospace;
  color: #7f8ea3;
  white-space: nowrap;
  font-size: 11px;
  text-align: center;
}

.matriz-table .td-id {
  font-family: ui-monospace, Consolas, monospace;
  color: #7f8ea3;
  white-space: nowrap;
  font-size: 11px;
  text-align: center;
}

.matriz-table .td-placa {
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.matriz-table .td-fecha {
  color: #ffb300;
  white-space: nowrap;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.matriz-table .td-hora {
  color: #7dcec4;
  white-space: nowrap;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
}

.matriz-table .td-muted {
  color: #888;
}

.matriz-table .td-obs {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #888;
}

.matriz-table .td-conductor {
  white-space: nowrap;
  vertical-align: middle;
  max-width: 220px;
}

.td-conductor-inner,
.td-destino-inner {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1.2;
  vertical-align: middle;
}

.td-conductor-inner {
  max-width: 100%;
  width: 100%;
  min-width: 0;
}

.td-destino-inner {
  max-width: 100%;
  width: auto;
  min-width: 0;
}

/* Destino: -33% y luego -20% más (~240 → 128px) */
.matriz-table .td-destino {
  white-space: nowrap;
  vertical-align: middle;
  max-width: 128px;
}

.matriz-table .td-destino--multi {
  white-space: nowrap;
  vertical-align: middle;
}

.td-conductor-nombre,
.td-destino-nombre,
.td-origen-nombre {
  line-height: 1.2;
}

/* Solo el nombre hace marquee; 📋 e i / +N quedan fijos (paridad desktop) */
.matriz-table .td-conductor-nombre.js-auto-marquee {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 190px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matriz-table .td-origen {
  max-width: 140px;
  white-space: nowrap;
  vertical-align: middle;
}
.matriz-table .td-origen-nombre.js-auto-marquee {
  display: block;
  min-width: 0;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* flex 0 1: el nombre no empuja el +N al borde derecho */
.matriz-table .td-destino-nombre.js-auto-marquee {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* i de conductor / destino — ~85% del tamaño anterior (16→14) */
.info-conductor-hint,
.info-destino-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  border: 1px solid #3d4155;
  border-radius: 50%;
  background: transparent;
  color: #5c6578;
  font-size: 8.5px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.info-conductor-hint:hover,
.info-conductor-hint:focus-visible,
.info-destino-hint:hover,
.info-destino-hint:focus-visible {
  color: var(--atenea-cyan);
  border-color: var(--atenea-cyan);
  outline: none;
}

/* Reserva el hueco de la i para alinear nombres con/sin multi-destino */
.info-destino-hint--spacer {
  visibility: hidden;
  pointer-events: none;
  border-color: transparent;
}

.td-destino-n {
  font-size: 10px;
  color: #7f8ea3;
  line-height: 1;
  flex-shrink: 0;
  margin-left: 1px;
}

.tip-destino-row {
  margin-top: 4px;
}

.tip-destino-row .tip-n {
  color: #7f8ea3;
  margin-right: 2px;
}

.tip-destino-row .tip-cod {
  color: #7f8ea3;
  font-size: 10px;
}

.tip-destino-row .tip-meta {
  margin-left: 1.1em;
  color: #6a7a8a;
  font-size: 10px;
}

.tip-destino-head {
  font-size: 10px;
  color: #7f8ea3;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(127, 142, 163, 0.25);
}

.tip-pct {
  font-weight: 700;
  margin-left: 2px;
}

.destino-pct-avance {
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.02em;
  color: var(--steel-text, #a8b4c4);
}

.td-destino-nombre.destino-txt {
  font-weight: 600;
  color: var(--text-main, #c8d0dc);
}

.conductor-tip {
  position: fixed;
  z-index: 120;
  min-width: 220px;
  max-width: min(380px, 92vw);
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #a8b8c8;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: none;
  pointer-events: auto;
  box-sizing: border-box;
}
.conductor-tip.hidden { display: none; }

.conductor-tip-inner {
  background: #1a1d27;
  color: #a8b8c8;
  border: 1px solid color-mix(in srgb, var(--atenea-orange, #ff6b35) 42%, transparent);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.conductor-tip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 3px 4px 3px 8px;
  min-height: 0;
  background: #141720;
  border-bottom: 1px solid #2a303d;
}

.conductor-tip-close {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #7d8ea0;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.conductor-tip-close:hover {
  color: #f44336;
  background: rgba(244, 67, 54, 0.1);
}

.conductor-tip-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--atenea-orange, #ff6b35);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
}

.conductor-tip-body {
  padding: 10px 12px 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  color: #a8b8c8;
}

.conductor-tip-jornada-label {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #2a3344;
  font-size: 11px;
  color: #8ea1b5;
}

.conductor-tip-jornada-line {
  font-size: 12px;
  color: #c5d0e0;
}

.conductor-tip-jornada-line strong {
  font-weight: 700;
  color: #e8eef6;
}

.conductor-tip-alertas {
  font-size: 12px;
  color: #8ea1b5;
  margin-top: 6px;
}

.info-conductor-hint.info-conductor-hint--multi-viaje {
  color: var(--atenea-orange, #ff6b35);
  border-color: color-mix(in srgb, var(--atenea-orange, #ff6b35) 55%, #3d4155);
}
.info-conductor-hint--multi-viaje:hover,
.info-conductor-hint--multi-viaje:focus-visible {
  color: var(--atenea-orange, #ff6b35);
  border-color: var(--atenea-orange, #ff6b35);
}

.tip-editar-celda {
  position: fixed;
  z-index: 9998;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid #2a2d3a;
  border-radius: 6px;
  background: #1a1d27;
  color: #8a93a8;
  font-size: 10px;
  line-height: 1.25;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.tip-editar-celda.hidden { display: none; }
.tip-editar-celda.tip-editar-celda--visible {
  opacity: 1;
  transform: translateY(0);
}
.tip-editar-celda .tip-editar-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--atenea-cyan, #4fc3f7);
  box-shadow: 0 0 4px rgba(79, 195, 247, 0.45);
  flex-shrink: 0;
}

.badge-carga {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  border: 1px solid #3d4155;
  color: #888;
  white-space: nowrap;
}

.badge-carga--cargado { border-color: #26a69a55; color: #7dcec4; }
.badge-carga--vacio { border-color: #888; color: #aaa; }
.badge-carga--comprometida { border-color: #ffb30055; color: #ffb300; }

.td-notas {
  text-align: center;
}

.btn-nota {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #4a5262;
  cursor: pointer;
}
.btn-nota:hover {
  color: #4fc3f7;
  background: #4fc3f711;
}

.btn-nota--has {
  color: var(--atenea-cyan);
}

.btn-nota-ico {
  font-size: 13px;
  line-height: 1;
  filter: grayscale(0.2);
}

.btn-nota-ico--empty {
  opacity: 0.35;
}

.btn-nota-n {
  font-size: 10px;
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
th, td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--div-soft);
}
th {
  color: #c5d0de;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: center;
  vertical-align: middle;
  background: #151922;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
  border-bottom: 1px solid #2a3344;
}
.matriz-table th .th-main {
  display: block;
  line-height: 1.2;
  text-align: center;
}
.matriz-table th.th-sortable .th-main {
  display: inline-flex;
}
tr:hover td { background: rgba(79, 195, 247, 0.04); }
.estado-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  border: 1px solid var(--border-sub);
  text-transform: none;
}
.estado-EN_RUTA { border-color: var(--atenea-cyan); color: var(--atenea-cyan); }
.estado-FINALIZADO { border-color: #4caf50; color: #81c784; }
.estado-PENDIENTE { border-color: #888; color: #aaa; }
.estado-ANULADO { border-color: #ef5350; color: #ef9a9a; }
.estado-EN_ENTREGA { border-color: #ffb300; color: #ffb300; }

/* Viajes inactivos — paridad desktop (fila-finalizada / anulada) */
.matriz-table tbody tr.fila-finalizada > td {
  opacity: 0.45 !important;
  filter: grayscale(60%);
}
.matriz-table tbody tr.fila-anulada > td {
  opacity: 0.5 !important;
  filter: grayscale(0.78) brightness(0.82);
  color: #5a6270;
  background-color: rgba(16, 18, 26, 0.82);
}
.matriz-table tbody tr.fila-anulada:hover > td {
  background-color: rgba(20, 22, 30, 0.88);
}
