/* ── Variables Interdoors ─────────────────────────────────────────────────── */
:root {
  --id-yellow:   #F5B700;
  --id-yellow-d: #D9A200;
  --id-white:    #FFFFFF;
  --id-gray-lt:  #F5F5F5;
  --id-gray:     #E0E0E0;
  --id-gray-md:  #9E9E9E;
  --id-dark:     #2C2C2C;
  --id-red:      #E53935;
  --id-green:    #43A047;
  --id-orange:   #FB8C00;
  --sidebar-w:   0px;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Montserrat', sans-serif;
  background: var(--id-gray-lt);
  color: var(--id-dark);
  font-size: 0.875rem;
}

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.text-sm { font-size: 0.8125rem; }

/* ── Navbar ──────────────────────────────────────────────────────────────── */
.navbar-interdoors {
  background: var(--id-yellow);
  padding: 0.5rem 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.navbar-interdoors .navbar-brand { color: var(--id-dark) !important; font-weight: 700; }
.navbar-interdoors .nav-link     { color: var(--id-dark) !important; font-weight: 500; padding: 0.5rem 0.9rem; border-radius: 6px; }
.navbar-interdoors .nav-link:hover,
.navbar-interdoors .nav-link.active { background: rgba(0,0,0,0.1); }
.navbar-interdoors .dropdown-menu { border: none; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }

/* Logo en navbar: contenedor blanco para que contraste sobre el fondo amarillo */
.navbar-logo-wrap {
  background: white;
  border-radius: 6px;
  padding: 3px 10px;
  display: flex;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.10);
}
.navbar-logo-wrap img { height: 28px; object-fit: contain; }

/* Logo en página de login */
.login-logo { max-height: 80px; max-width: 220px; object-fit: contain; }

/* ── Main layout ─────────────────────────────────────────────────────────── */
.main-content { min-height: calc(100vh - 60px); }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--id-yellow) 0%, #ffe57a 50%, var(--id-gray-lt) 100%);
}
.login-wrapper { width: 100%; max-width: 420px; padding: 1rem; }
.login-card { border: none; border-radius: 16px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--id-yellow);
  border-color: var(--id-yellow);
  color: var(--id-dark);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--id-yellow-d);
  border-color: var(--id-yellow-d);
  color: var(--id-dark);
}
.btn-xs { padding: 0.15rem 0.5rem; font-size: 0.75rem; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card { border: 1px solid var(--id-gray); border-radius: 10px; }
.card-header {
  background: var(--id-white);
  border-bottom: 1px solid var(--id-gray);
  border-radius: 10px 10px 0 0 !important;
}
.card-footer {
  background: var(--id-gray-lt);
  border-top: 1px solid var(--id-gray);
  border-radius: 0 0 10px 10px !important;
}

/* ── Alertas de color en tarjetas ────────────────────────────────────────── */
.border-alerta-roja    { border-left: 4px solid var(--id-red) !important; }
.border-alerta-amarilla { border-left: 4px solid var(--id-orange) !important; }

/* ── Filas de tabla con alerta ───────────────────────────────────────────── */
.alerta-row-roja    { background: rgba(229, 57, 53, 0.06); }
.alerta-row-amarilla { background: rgba(251, 140, 0, 0.06); }

/* ── Badge días ──────────────────────────────────────────────────────────── */
.badge-dias {
  display: inline-block;
  min-width: 28px;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}
.badge-dias.alerta-verde    { background: rgba(67,160,71,0.15); color: var(--id-green); }
.badge-dias.alerta-amarilla { background: rgba(251,140,0,0.15); color: var(--id-orange); }
.badge-dias.alerta-roja     { background: rgba(229,57,53,0.15);  color: var(--id-red); }

/* ── Badges de estado ────────────────────────────────────────────────────── */
.badge { font-weight: 500; }
.estado-pendiente   { background: var(--id-gray); color: var(--id-dark); }
.estado-en_curso    { background: #E3F2FD; color: #1565C0; }
.estado-completada  { background: #E8F5E9; color: #2E7D32; }
.estado-bloqueada   { background: #FCE4EC; color: #C62828; }
.estado-parcial     { background: #FFF3E0; color: #E65100; }

.badge-roja    { background: rgba(229,57,53,0.15);  color: var(--id-red);    border: 1px solid rgba(229,57,53,0.3);    padding: 2px 8px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.badge-amarilla { background: rgba(251,140,0,0.15); color: var(--id-orange); border: 1px solid rgba(251,140,0,0.3);   padding: 2px 8px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }

/* ── Orden badge ─────────────────────────────────────────────────────────── */
.orden-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--id-yellow);
  color: var(--id-dark);
  font-size: 0.7rem;
  font-weight: 700;
}

/* ── Badge área ──────────────────────────────────────────────────────────── */
.badge-area {
  display: inline-block;
  padding: 3px 10px;
  background: var(--id-yellow);
  color: var(--id-dark);
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.8rem;
}

/* ── Tarjetas de etapa ───────────────────────────────────────────────────── */
.etapa-card { transition: box-shadow 0.15s; }
.etapa-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1) !important; }
.estado-card-completada  { background: #F1F8E9 !important; }
.estado-card-en_curso    { background: #E3F2FD !important; }
.estado-card-bloqueada   { background: #FCE4EC !important; }
.estado-card-pendiente   { background: var(--id-white); }
.estado-card-parcial     { background: #FFF8F0 !important; }

/* ── Progreso ────────────────────────────────────────────────────────────── */
.progress { background: var(--id-gray); }
.progress-bar { background: var(--id-yellow) !important; }

/* ── Tablas ──────────────────────────────────────────────────────────────── */
.table thead th { font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--id-gray-md); }
.table-hover tbody tr:hover { background: rgba(245,183,0,0.07); }

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.breadcrumb { font-size: 0.8rem; }
.breadcrumb-item a { color: var(--id-yellow-d); text-decoration: none; font-weight: 500; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--id-gray-lt); }
::-webkit-scrollbar-thumb { background: var(--id-gray); border-radius: 3px; }

/* ── Racetrack (mapa de carrera) ─────────────────────────────────────────── */
.racetrack-wrapper {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--id-gray);
  background: var(--id-white);
}

.racetrack-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 1200px;
}

.racetrack-table th {
  background: var(--id-dark);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
  padding: 8px 4px;
  border-right: 1px solid rgba(255,255,255,0.08);
  white-space: nowrap;
}

.racetrack-table td {
  border-right: 1px solid var(--id-gray);
  border-bottom: 1px solid var(--id-gray);
  padding: 0;
  vertical-align: middle;
}

/* Columna proyecto fija */
.sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 180px;
  max-width: 220px;
}
th.sticky-col { background: var(--id-dark) !important; z-index: 3; text-align: left; padding-left: 12px; }
td.sticky-col { background: var(--id-white); border-right: 2px solid var(--id-gray) !important; }

.proyecto-cell { padding: 10px 12px !important; }

/* Columna estado */
.col-estado { min-width: 160px; padding: 8px 10px !important; }

/* Cabecera de paso */
.col-paso { width: 46px; min-width: 46px; }
.paso-header { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.paso-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  font-size: 0.65rem; font-weight: 700; color: #fff;
}
.paso-area-badge {
  font-size: 0.55rem; font-weight: 700; padding: 1px 4px;
  border-radius: 3px; color: #fff; opacity: 0.9;
}

/* Celdas del mapa */
.paso-cell { text-align: center; height: 46px; }

.celda-completada {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 60px; color: var(--id-green); font-size: 0.8rem;
  background: rgba(67,160,71,0.1); gap: 1px; padding: 3px 2px;
}
.celda-check-icon { font-size: 0.75rem; line-height: 1; }
.celda-dias-label {
  font-size: 0.6rem; font-weight: 700; color: var(--id-green);
  line-height: 1; margin-top: 1px;
}
.celda-pct-bar {
  width: 80%; height: 3px; background: var(--id-gray);
  border-radius: 2px; margin-top: 2px; overflow: hidden;
}
.celda-pct-fill {
  height: 100%; background: var(--id-green); border-radius: 2px;
  transition: width 0.3s;
}

.celda-activa {
  display: flex; align-items: center; justify-content: center;
  height: 60px; font-weight: 700; font-size: 0.72rem;
  border-radius: 0;
}
.alerta-celda-verde    { background: #FFF8E1; color: #F57F17; border-top: 3px solid var(--id-yellow); }
.alerta-celda-amarilla { background: #FFF3E0; color: var(--id-orange); border-top: 3px solid var(--id-orange); }
.alerta-celda-roja     { background: #FFEBEE; color: var(--id-red);    border-top: 3px solid var(--id-red); }

.celda-parcial {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 60px; gap: 1px; padding: 3px 2px;
}
.celda-parcial-nums {
  font-size: 0.58rem; font-weight: 700; line-height: 1; color: var(--id-orange);
}
.celda-parcial-bar-wrap {
  width: 82%; height: 3px; background: var(--id-gray);
  border-radius: 2px; overflow: hidden;
}
.celda-parcial-bar-fill {
  height: 100%; background: var(--id-orange); border-radius: 2px;
}
.celda-parcial-pct {
  font-size: 0.55rem; font-weight: 700; color: var(--id-orange); line-height: 1;
}

.celda-bloqueada {
  display: flex; align-items: center; justify-content: center;
  height: 60px; color: var(--id-red); font-size: 0.8rem;
  background: rgba(229,57,53,0.08);
}

.celda-pendiente { height: 60px; background: transparent; }

/* Hace que todas las celdas ocupen el 100% de la td para que el hover funcione */
.celda-full {
  width: 100%;
  height: 60px;
  cursor: default;
}

.paso-dias { font-size: 0.68rem; font-weight: 700; }

/* Etapa actual label */
.etapa-actual-label {
  font-size: 0.75rem; font-weight: 600; display: flex; align-items: center; gap: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.alerta-label-verde    { color: #F57F17; }
.alerta-label-amarilla { color: var(--id-orange); }
.alerta-label-roja     { color: var(--id-red); }
.paso-num-sm {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--id-yellow); color: var(--id-dark);
  font-size: 0.6rem; font-weight: 700; flex-shrink: 0;
}

/* Eje de áreas debajo de la tabla */
.areas-eje {
  display: flex;
  min-width: 1200px;
  overflow: hidden;
  border-radius: 0 0 8px 8px;
  margin-left: 0;
}
.area-bloque {
  text-align: center; font-size: 0.65rem; font-weight: 700;
  padding: 5px 2px; border: 1px solid; letter-spacing: 0.05em;
  text-transform: uppercase; cursor: default;
  transition: filter 0.15s;
}
.area-bloque:hover { filter: brightness(0.88); }

/* ── Columna resumen de tiempo ───────────────────────────────────────────── */
.col-resumen { min-width: 150px; max-width: 170px; }
.resumen-cell {
  padding: 8px 12px !important;
  cursor: default;
  border-left: 2px solid var(--id-gray) !important;
}
.resumen-numeros {
  display: flex; align-items: baseline; gap: 3px;
  font-size: 0.78rem; font-weight: 600; color: var(--id-dark);
  margin-bottom: 4px;
}
.resumen-transcurridos { color: var(--id-dark); font-size: 0.85rem; font-weight: 700; }
.resumen-sep { color: var(--id-gray-md); font-size: 0.7rem; }
.resumen-total { color: var(--id-gray-md); font-size: 0.72rem; }
.resumen-barra-wrap {
  width: 100%; height: 5px;
  background: var(--id-gray); border-radius: 3px;
  overflow: hidden; margin-bottom: 4px;
}
.resumen-barra-fill {
  height: 100%; border-radius: 3px; transition: width 0.4s;
}
.alerta-barra-verde    { background: var(--id-green); }
.alerta-barra-amarilla { background: var(--id-orange); }
.alerta-barra-roja     { background: var(--id-red); }
.resumen-restantes {
  font-size: 0.68rem; font-weight: 600;
  display: flex; align-items: center; gap: 3px;
}

/* ── Tabla de control por área ───────────────────────────────────────────── */
.control-table thead th {
  font-size: 0.78rem; font-weight: 700; padding: 10px 14px;
  vertical-align: middle;
}
.th-sub { font-size: 0.62rem; font-weight: 400; opacity: 0.7; margin-top: 1px; }

.control-table tbody td { padding: 10px 14px; vertical-align: middle; }

.control-num  { font-size: 1.1rem; line-height: 1.1; }
.control-total { font-size: 1.1rem; line-height: 1.1; color: var(--id-dark); }

.control-pct-wrap {
  width: 70%; margin: 4px auto 2px;
  height: 4px; background: var(--id-gray);
  border-radius: 2px; overflow: hidden;
}
.control-pct-bar { height: 100%; border-radius: 2px; transition: width 0.4s; }
.control-pct-label { font-size: 0.68rem; font-weight: 600; }

.area-dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; margin-right: 6px; vertical-align: middle;
}

/* Badge parcial en columna etapa actual */
.badge-parcial-sm {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 20px; font-size: 0.68rem; font-weight: 600;
  background: rgba(251,140,0,0.15); color: var(--id-orange);
  border: 1px solid rgba(251,140,0,0.35);
}

/* KPI badges dashboard */
.kpi-badge {
  display: inline-flex; align-items: center;
  padding: 5px 12px; border-radius: 20px; font-size: 0.78rem; font-weight: 600;
}
.kpi-roja    { background: rgba(229,57,53,0.12); color: var(--id-red);    border: 1px solid rgba(229,57,53,0.3); }
.kpi-amarilla { background: rgba(251,140,0,0.12); color: var(--id-orange); border: 1px solid rgba(251,140,0,0.3); }

/* Leyenda */
.leyenda-item { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--id-dark); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot-activo   { background: var(--id-yellow); border: 2px solid #F57F17; }
.dot-verde    { background: rgba(67,160,71,0.3); border: 2px solid var(--id-green); }
.dot-amarilla { background: rgba(251,140,0,0.3); border: 2px solid var(--id-orange); }
.dot-roja     { background: rgba(229,57,53,0.3); border: 2px solid var(--id-red); }
.dot-pendiente { background: var(--id-gray); border: 2px solid var(--id-gray-md); }
.dot-parcial   { background: rgba(251,140,0,0.4); border: 2px solid var(--id-orange); }

/* ── Barras de progreso de cantidades ────────────────────────────────────── */
.qty-progress-wrap {
  height: 5px;
  background: var(--id-gray);
  border-radius: 3px;
  overflow: hidden;
}
.qty-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: #42A5F5;
  transition: width 0.35s ease;
}
.qty-progress-fill.completo { background: var(--id-green); }
.qty-progress-fill.vacio    { background: var(--id-gray-md); }

/* ── Soportes de entrega (remisiones) ────────────────────────────────────── */
.remision-resumen-chip {
  padding: 8px 14px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--id-gray);
  min-width: 110px;
  text-align: center;
}
.remision-resumen-total {
  border-color: #AB47BC;
  background: rgba(171,71,188,0.05);
}

.remision-thumb {
  width: 44px; height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--id-gray);
  transition: transform 0.15s;
  display: block;
}
.remision-thumb-link:hover .remision-thumb {
  transform: scale(1.08);
  border-color: #AB47BC;
}

.remision-table td { vertical-align: middle; }
.remision-table thead th { font-size: 0.75rem; font-weight: 600; }

/* ── Tabla pivot de entregas ─────────────────────────────────────────────── */
.pivot-table { min-width: 500px; }
.pivot-table thead th {
  background: var(--id-dark);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
  border-color: rgba(255,255,255,0.1) !important;
}
.pivot-ref-col  { min-width: 180px; background: var(--id-gray-lt) !important; }
.pivot-table thead th.pivot-ref-col {
  background: var(--id-yellow) !important;
  color: var(--id-dark) !important;
  font-weight: 700;
}
.pivot-ent-col  { width: 80px; min-width: 70px; }
.pivot-total-col {
  width: 80px;
  background: #FFF8DC !important;
  border-left: 3px solid var(--id-yellow-d) !important;
  color: #1A237E !important;
  font-size: 0.9rem !important;
}
.pivot-cell { padding: 6px 4px !important; }
.pivot-cell-active { background: rgba(21,101,192,0.07); }
.pivot-table tfoot td {
  border-top: 2px solid var(--id-gray) !important;
}

/* ── Módulo Entregas ─────────────────────────────────────────────────────── */
.foto-drop-zone {
  border: 2px dashed var(--id-gray);
  border-radius: 12px;
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--id-gray-lt);
}
.foto-drop-zone:hover {
  border-color: var(--id-yellow);
  background: rgba(245, 183, 0, 0.05);
}

.foto-preview-item {
  width: 80px; height: 80px;
  border-radius: 8px;
  border: 2px solid var(--id-gray);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--id-white);
  flex-shrink: 0;
}
.foto-preview-item img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.foto-preview-pdf {
  flex-direction: column;
  padding: 6px;
  text-align: center;
}

/* Zona pequeña de fotos (3 columnas en nueva_entrega) */
.foto-zone-sm {
  padding: 1.2rem 0.5rem;
  min-height: 90px;
}
.foto-zone-sm:hover { border-color: var(--id-yellow); }

/* ── Explorador de entregas ──────────────────────────────────────────────── */
.explorador-thumb {
  width: 90px; height: 90px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--id-gray);
  transition: transform 0.15s, border-color 0.15s;
  display: block;
}
.explorador-thumb-link { text-decoration: none; }
.explorador-thumb-link:hover .explorador-thumb {
  transform: scale(1.06);
  border-color: var(--id-yellow);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.explorador-thumb-pdf {
  width: 90px; height: 90px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: #FFF3F3;
  border-radius: 8px;
  border: 2px solid #FFCDD2;
  gap: 4px;
  transition: transform 0.15s, border-color 0.15s;
}
.explorador-thumb-link:hover .explorador-thumb-pdf {
  transform: scale(1.06);
  border-color: var(--id-red);
}
.explorador-thumb-label {
  font-size: 0.65rem; font-weight: 600;
  color: var(--id-gray-md); margin-top: 3px;
  max-width: 90px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: center;
}
.explorador-entrega-header {
  background: var(--id-dark); color: #fff;
  border-radius: 8px 8px 0 0; padding: 8px 14px;
  font-size: 0.82rem; font-weight: 600;
}
.explorador-tipo-label {
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 6px;
}
