/* Panel estado de viaje — Atenea steel */
#panel-estado {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 320px;
  background: linear-gradient(180deg, #1a2230 0%, #141a24 55%, #10151d 100%);
  border-left: 1px solid var(--steel-border, #3d4a5c);
  display: flex;
  flex-direction: column;
  z-index: 110;
  transform: translateX(100%);
  transition: transform 0.28s ease;
  font-family: "Segoe UI", sans-serif;
  color: var(--steel-title, #c8d0dc);
}
#panel-estado.visible { transform: translateX(0); }

.panel-estado-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--steel-border, #3d4a5c);
  flex-shrink: 0;
}
.panel-estado-header h3 {
  margin: 0;
  font-size: 14px;
  color: var(--steel-title, #c8d0dc);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.panel-estado-header h3 i { color: var(--steel-icon, #9aa8b8); }
.panel-estado-cerrar {
  background: transparent;
  border: none;
  color: #7a8799;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 4px;
}
.panel-estado-cerrar:hover {
  color: #c5cdd8;
  background: rgba(255, 255, 255, 0.04);
}

.panel-estado-conductor {
  padding: 8px 14px;
  border-bottom: 1px solid #1e2130;
  font-size: 13px;
  color: #ccc;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.panel-estado-conductor #panel-estado-conductor-nombre {
  color: #4fc3f7;
  font-weight: 600;
}

.panel-estado-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 12px 10px;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
}

.panel-estado-top-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.panel-estado-top-grid--2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: start;
}
.panel-estado-col-progreso {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

#panel-estado .panel-estado-sit-btn--xt-tenue {
  opacity: 0.55 !important;
  filter: saturate(0.72) !important;
  transition: opacity 0.2s ease, filter 0.2s ease !important;
}
#panel-estado .panel-estado-sit-btn--xt-tenue.panel-estado-sit-btn--xt-tenue--sel {
  opacity: 0.68 !important;
}
#panel-estado .panel-estado-sit-btn--xt-tenue:hover {
  opacity: 0.86 !important;
  filter: saturate(0.9) !important;
}

.panel-estado-historial {
  border-top: 1px solid #2a2d3a;
  padding: 8px 14px;
  flex-shrink: 0;
  max-height: 160px;
  overflow-y: auto;
}
.historial-titulo {
  font-size: 10px;
  color: #6a7588;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.historial-item {
  padding: 8px 0;
  border-bottom: 1px solid #1e2130;
  font-size: 12px;
  color: #a8b8c8;
}
.historial-item strong { color: #c8d0e0; font-weight: 600; }
.hist-meta { font-size: 10px; color: #555; margin-top: 2px; }

.panel-estado-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 10px 12px 14px;
  border-top: 1px solid #ffffff10;
}
.btn-panel-reconstruir {
  flex: 1;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #3d8bfd55;
  background: #3d8bfd18;
  color: #8ec7ff;
  font-size: 12px;
  cursor: pointer;
}
.btn-panel-reconstruir:hover:not(:disabled) {
  background: #3d8bfd28;
  color: #cfe6ff;
}
.btn-panel-reconstruir:disabled {
  opacity: 0.45;
  cursor: wait;
}
.btn-panel-reconstruir i { margin-right: 4px; }
.btn-reconstruir-viaje {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.55;
  color: #8ec7ff;
}
.btn-reconstruir-viaje:hover {
  opacity: 1;
}
.btn-reconstruir-viaje--busy {
  opacity: 0.4;
  cursor: wait;
}
  padding: 8px 14px;
  border-top: 1px solid #2a2d3a;
  flex-shrink: 0;
}

.panel-estado-card {
  padding: 10px 12px;
  margin: 6px 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
}
.panel-estado-card--pernocta {
  border-color: rgba(156, 39, 176, 0.58);
  box-shadow: inset 0 0 0 1px rgba(156, 39, 176, 0.12);
  background: #0f1117;
}
.panel-estado-card__title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6a7588;
  margin-bottom: 8px;
  font-weight: 600;
}
.panel-estado-card__hint {
  font-size: 10px;
  line-height: 1.45;
  color: #5a6375;
  margin-top: 6px;
}
.panel-estado-divider {
  height: 1px;
  background: #252a38;
  margin: 10px 0 8px;
}
.panel-estado-row-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}
.panel-estado-btn-minor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.25;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid;
  transition: background 0.15s, border-color 0.15s;
}
.panel-estado-btn-minor--pernocta {
  color: #b39ddb;
  border-color: #5e4578;
  background: rgba(156, 39, 176, 0.07);
}
.panel-estado-btn-minor--pernocta:hover {
  background: rgba(156, 39, 176, 0.13);
  border-color: #7e57c2;
}
.panel-estado-btn-minor--novedad {
  color: #ff9e7a;
  border-color: #a85a3d;
  background: rgba(255, 107, 53, 0.07);
}
.panel-estado-btn-minor--novedad:hover {
  background: rgba(255, 107, 53, 0.12);
  border-color: #ff6b35;
}

.panel-estado-apply-bar {
  position: sticky;
  bottom: 0;
  z-index: 4;
  margin: auto 0 0;
  padding: 10px 8px 12px;
  overflow: hidden;
  background: rgba(19, 21, 31, 0.98);
  border: 1px solid rgba(var(--estado-accent-rgb, 79, 195, 247), 0.24);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.01);
  border-radius: 8px;
}
.panel-estado-apply-bar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.panel-estado-apply-bar__refs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.panel-estado-apply-bar__title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6a8aa0;
  margin-bottom: 0;
  font-weight: 600;
}
.panel-estado-apply-bar__ref {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(var(--progreso-accent-rgb, 79, 195, 247), 0.62);
  background: rgba(var(--progreso-accent-rgb, 79, 195, 247), 0.14);
  color: rgb(var(--progreso-accent-rgb, 79, 195, 247));
  font-size: 10px;
  line-height: 1.1;
  font-weight: 600;
  opacity: 0.95;
  pointer-events: none;
  user-select: none;
}
.panel-estado-apply-bar__ref--situacion {
  border-color: rgba(var(--situacion-accent-rgb, 79, 195, 247), 0.62);
  background: rgba(var(--situacion-accent-rgb, 79, 195, 247), 0.14);
  color: rgb(var(--situacion-accent-rgb, 79, 195, 247));
}

.btn-panel-aplicar-cambios {
  margin-top: 8px;
  width: 100%;
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1.25;
  font-weight: 600;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #4fc3f788;
  background: rgba(79, 195, 247, 0.12);
  color: #4fc3f7;
  transition: filter 0.15s;
}
.btn-panel-aplicar-cambios:hover:not(:disabled) { filter: brightness(1.12); }
.btn-panel-aplicar-cambios:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-panel-deshacer {
  width: 100%;
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1.25;
  font-weight: 500;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #555a6a;
  background: transparent;
  color: #8a93a8;
}
.btn-panel-deshacer:hover:not(:disabled) { background: #ffffff08; color: #b0b8c8; }
.btn-panel-deshacer:disabled { opacity: 0.35; cursor: not-allowed; }

.badge-estado {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  white-space: nowrap;
}
.badge-estado:hover { filter: brightness(1.15); }
.badge-estado i { font-size: 10px; }

/* Columna Estado: fase arriba + demora/On time abajo (paridad desktop) */
.td-estado-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}
.td-estado-principal {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.td-estado-demoras {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  max-width: 100%;
}
.td-estado-demoras:has(.badge-demora-tiempo) {
  margin-top: 2px;
  padding-top: 4px;
  border-top: 1px solid #2a3140;
}
.badge-demora-tiempo {
  font-size: 9px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--badge-accent, #8ea1b5) 38%, transparent);
  background: color-mix(in srgb, var(--badge-accent, #8ea1b5) 10%, transparent);
  color: var(--badge-accent, #8ea1b5);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.25;
  opacity: 0.95;
}
.badge-demora-tiempo > i.fa-solid { font-size: 8px; }
.badge-demora-tiempo.badge-on-time { --badge-accent: #4caf50; }

.matriz-table td.td-estado,
#tabla-wrap table td:has(> .td-estado-inner) {
  vertical-align: middle;
  white-space: nowrap;
}

.pe-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #1a1d2a;
  border: 1px solid #2a2d3a;
  color: #c8d0e0;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  max-width: min(420px, 90vw);
  text-align: center;
}
.pe-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Modal justificación exceso jornada (paridad desktop) */
.overlay-justificacion-jornada {
  position: fixed;
  inset: 0;
  z-index: 100050 !important;
  display: none;
  align-items: center;
  justify-content: center;
}
.overlay-justificacion-jornada.visible { display: flex; }

.just-jornada-modal {
  position: relative;
  width: min(440px, 92vw);
  padding: 18px 20px 0;
  box-sizing: border-box;
  text-align: center;
}
.just-jornada-cerrar {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #7a8799;
  font-size: 14px;
  cursor: pointer;
}
.just-jornada-cerrar:hover { color: #c5cdd8; }
.just-jornada-ico {
  font-size: 28px;
  color: #ffb300;
  margin-bottom: 8px;
}
.just-jornada-modal > h2 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  color: #c8d0dc;
}
.just-jornada-sub {
  margin: 0 0 12px;
  font-size: 12px;
  color: #8898a8;
}
.just-jornada-box {
  background: #0a0c12;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.just-jornada-total {
  font-size: 22px;
  font-weight: 600;
  color: #a8b8c8;
}
.just-jornada-exceso {
  margin-top: 4px;
  font-size: 13px;
  color: #f44336;
  text-align: left;
}
.just-jornada-detalle {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.just-jornada-detalle .ok { color: #4caf50; }
.just-jornada-detalle .bad { color: #f44336; }
.just-jornada-pregunta {
  margin: 0 0 12px;
  font-size: 13px;
  color: #aaa;
}
.just-jornada-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.just-jornada-btns.hidden,
.just-jornada-campos.hidden { display: none !important; }
.just-jornada-campos {
  text-align: left;
  margin-bottom: 12px;
}
.just-jornada-label {
  display: block;
  font-size: 10px;
  color: #5a6578;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 5px;
}
.just-jornada-campos textarea,
.just-jornada-campos input {
  width: 100%;
  box-sizing: border-box;
  background: #0f1117;
  border: 1px solid #2a2d3a;
  color: #a8b8c8;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  margin-bottom: 10px;
  resize: vertical;
}
.just-jornada-campos textarea:focus,
.just-jornada-campos input:focus {
  border-color: #ffb300;
}
.just-jornada-horas-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.just-jornada-horas-row input {
  width: 140px;
  margin-bottom: 0;
  font-family: ui-monospace, monospace;
  letter-spacing: 1px;
}
.just-jornada-hint {
  font-size: 11px;
  color: #3d4155;
}
.just-jornada-confirmar { width: 100%; }
.just-jornada-firma {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 14px;
  font-size: 10px;
  color: #4a5568;
}
.just-jornada-firma .mf-atenea { font-weight: 700; letter-spacing: 1px; }
.btn-modal-green {
  color: #81c784 !important;
  border-color: rgba(76, 175, 80, 0.45) !important;
  background: rgba(76, 175, 80, 0.08) !important;
}
.btn-modal-red {
  color: #ef9a9a !important;
  border-color: rgba(244, 67, 54, 0.45) !important;
  background: rgba(244, 67, 54, 0.08) !important;
}

