/* Densidad general: Bootstrap usa unidades "rem" para casi todo
   (paddings, márgenes, tamaños de letra), así que achicando la
   letra base de la página se achica todo en la misma proporción,
   simulando el efecto de bajar el zoom del navegador. */
html {
  font-size: 87%;
}

body {
  background: #f4f6fa;
}

/* Colchón de espacio abajo de cada pantalla, para que la última
   sección no quede pegada al borde inferior de la ventana. */
.page-content {
  padding-bottom: 6rem;
}

/* ---------- Layout general: menú lateral + contenido ---------- */
.app-shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex: 0 0 240px;
  background: #1c2434;
  color: #cbd5e1;
  min-height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-brand .brand-name {
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}
.sidebar-brand .brand-sub {
  font-size: 0.72rem;
  color: #7c8aa5;
  letter-spacing: 0.12em;
}

.sidebar-nav {
  flex: 1 1 auto;
  padding: 0.75rem 0.75rem;
  overflow-y: auto;
}

.sidebar-group-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #64748b;
  padding: 0.9rem 0.6rem 0.35rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: 0.4rem;
  color: #b8c2d6;
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 0.1rem;
}
.sidebar-link i {
  font-size: 1rem;
  width: 1.1rem;
  text-align: center;
  flex-shrink: 0;
}
.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.sidebar-link.active {
  background: #2f6fed;
  color: #fff;
}
.sidebar-link.disabled {
  color: #545f75;
  cursor: default;
  pointer-events: none;
}

.sidebar-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #64748b;
  padding: 0.9rem 0.6rem 0.35rem;
  cursor: pointer;
}
.sidebar-group-toggle:hover {
  color: #b8c2d6;
}
.sidebar-group-toggle i {
  font-size: 0.85rem;
  transition: transform 0.15s ease;
}
.sidebar-group-toggle[aria-expanded="true"] i {
  transform: rotate(180deg);
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.85rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.sidebar-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #2f6fed;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}
.sidebar-footer .user-name {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
}
.sidebar-footer .user-role {
  color: #7c8aa5;
  font-size: 0.72rem;
}
.sidebar-footer a {
  color: #7c8aa5;
  margin-left: auto;
}
.sidebar-footer a:hover {
  color: #fff;
}
.sidebar-version {
  padding: 0 1.1rem 0.85rem;
  font-size: 0.68rem;
  color: #556078;
}

/* Bultos del pedido (Revisión) — renglón de "Armado de lo suelto" marcado
   "— (dentro de otro bulto)": caja/cantidad se ven y se comportan como
   deshabilitados, pero sin el atributo "disabled" real (ver comentario en
   revision_detalle.html sobre por qué: un campo disabled no viaja en el
   POST y desalinea los renglones que arma el servidor por posición). */
.campo-bloqueado {
  pointer-events: none;
  background: #eee;
  opacity: .65;
}

.main-area {
  flex: 1 1 auto;
  min-width: 0;
}

/* ---------- Encabezado de pantalla ---------- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.page-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}
.page-header .page-subtitle {
  color: #6b7280;
  font-size: 0.88rem;
}

.breadcrumb-nav {
  font-size: 0.82rem;
  color: #6b7280;
  margin-bottom: 0.6rem;
}
.breadcrumb-nav a {
  color: #6b7280;
  text-decoration: none;
}
.breadcrumb-nav a:hover {
  color: #2f6fed;
}

/* ---------- Tarjetas ---------- */
.card-panel {
  background: #fff;
  border: 1px solid #e5e9f1;
  border-radius: 0.6rem;
  padding: 1.1rem 1.25rem;
}

.dash-card {
  background: #fff;
  border: 1px solid #e5e9f1;
  border-radius: 0.6rem;
  padding: 1.1rem 1.2rem;
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.dash-card:hover {
  box-shadow: 0 6px 16px rgba(30, 41, 59, 0.08);
  transform: translateY(-1px);
  color: inherit;
}
.dash-card.disabled {
  opacity: 0.55;
  pointer-events: none;
}
.dash-card-icon {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}
.dash-card h5 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.dash-card p {
  font-size: 0.82rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}
.dash-card .dash-card-count {
  font-size: 0.78rem;
  color: #9ca3af;
}

/* ---------- Tablas de listado ---------- */
.list-toolbar {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.list-toolbar .search-box {
  position: relative;
  flex: 1 1 260px;
  max-width: 360px;
}
.list-toolbar .search-box i {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
}
.list-toolbar .search-box input {
  padding-left: 2.1rem;
}

.table-card {
  background: #fff;
  border: 1px solid #e5e9f1;
  border-radius: 0.6rem;
  overflow: hidden;
}
.table-card table {
  margin-bottom: 0;
}
.table-card thead th {
  background: #f8fafc;
  color: #6b7280;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  border-bottom: 1px solid #e5e9f1;
}
.table-card tbody td {
  vertical-align: middle;
  font-size: 0.88rem;
}
.table-card tbody tr[data-href] {
  cursor: pointer;
}

.badge-pill {
  display: inline-block;
  padding: 0.18rem 0.65rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}
.badge-pill.badge-yes {
  background: #dcfce7;
  color: #15803d;
}
.badge-pill.badge-no {
  background: #f1f5f9;
  color: #64748b;
}
.badge-pill.badge-warn {
  background: #fef3c7;
  color: #92400e;
}
.badge-pill.badge-info {
  background: #dbeafe;
  color: #1d4ed8;
}
.badge-pill.badge-purple {
  background: #ede9fe;
  color: #6d28d9;
}
.badge-pill.badge-teal {
  background: #ccfbf1;
  color: #0f766e;
}
.badge-pill.badge-orange {
  background: #ffedd5;
  color: #c2410c;
}
.badge-pill.badge-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.4rem;
  color: #6b7280;
  text-decoration: none;
  margin-right: 0.15rem;
}
.icon-action:hover {
  background: #eef2ff;
  color: #2f6fed;
}
.icon-action.danger:hover {
  background: #fef2f2;
  color: #dc2626;
}

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-top: 1px solid #e5e9f1;
  font-size: 0.82rem;
  color: #6b7280;
}
.table-footer .pagination {
  margin-bottom: 0;
}
.table-footer .page-link {
  font-size: 0.82rem;
}

/* ---------- Barra de resumen (ej: pie de ficha de Cliente) ---------- */
.resumen-bar {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid #e5e9f1;
  border-radius: 0.6rem;
  padding: 1.1rem 1.75rem;
}
.resumen-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex: 1;
  min-width: 0;
}
.resumen-icon {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 1.5px solid #2f6fed;
  color: #2f6fed;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}
.resumen-label {
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 0.15rem;
  white-space: nowrap;
}
.resumen-value {
  font-size: 1.02rem;
  font-weight: 700;
  color: #1f2937;
}
.resumen-divider {
  width: 1px;
  align-self: stretch;
  background: #e5e9f1;
  margin: 0 1.75rem;
}

/* ---------- Botón filtros ---------- */
.btn-filtro {
  background: #fff;
  border: 1px solid #d7dce5;
  color: #374151;
}
.btn-filtro:hover {
  background: #f8fafc;
}

/* Un poco menos de aire en las filas de tabla que lo que trae Bootstrap por defecto. */
.table > :not(caption) > * > * {
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

/* ---------- Gantt de producción (grilla + barras continuas superpuestas) ---------- */
.gantt-grid {
  display: grid;
  font-size: 1.02rem;
  width: max-content;
}
.gantt-grid-cell {
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid #e5e9f1;
  border-right: 1px solid #e5e9f1;
  display: flex;
  align-items: center;
}
.gantt-grid-head {
  background: #f8fafc;
  color: #6b7280;
  font-size: 0.92rem;
  font-weight: 600;
  justify-content: center;
  text-align: center;
  line-height: 1.3;
}
.gantt-grid-machine {
  font-weight: 600;
  background: #fff;
}
.gantt-grid-head-hoy {
  background: rgba(47, 111, 237, 0.12);
  color: #2f6fed;
}
.gantt-daycell-hoy {
  box-shadow: inset 2px 0 0 #2f6fed, inset -2px 0 0 #2f6fed;
}
.gantt-sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
}
.gantt-bgrow {
  position: relative;
  display: flex;
  height: 4.2rem;
  border-bottom: 1px solid #e5e9f1;
}
.gantt-bgrow-real {
  height: 1.8rem;
}
.gantt-daycell {
  flex: 1 1 0;
  display: block;
  border-right: 1px solid #f1f5f9;
  cursor: pointer;
  text-decoration: none;
  position: relative;
}
.gantt-daycell:hover {
  background: #eef2ff;
}
.gantt-daycell::after {
  content: "";
  position: absolute;
  top: 1.35rem;
  left: 0;
  right: 0;
  height: 1px;
  background: #e5e9f1;
  pointer-events: none;
}
.gantt-daycell-feriado {
  background: #ede9fe;
  cursor: default;
}
.gantt-daycell-feriado:hover {
  background: #ddd6fe;
}
.gantt-daycell-pausa_total {
  background: #fef9c3;
  cursor: default;
}
.gantt-daycell-pausa_total:hover {
  background: #fef08a;
}
.gantt-daycell-sin_horario {
  background: repeating-linear-gradient(45deg, #f1f5f9, #f1f5f9 6px, #e5e9f1 6px, #e5e9f1 12px);
  cursor: default;
  pointer-events: none;
}
.gantt-daycell-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  color: #6d28d9;
}
.gantt-daycell-pausa_total .gantt-daycell-label {
  color: #854d0e;
}
.gantt-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.gantt-bar {
  position: absolute;
  top: 1.35rem;
  bottom: 3px;
  border-radius: 4px;
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
  color: #fff;
  text-decoration: none;
  display: block;
}
.gantt-bar:hover {
  filter: brightness(1.08);
  color: #fff;
}
.gantt-bar[draggable="true"] {
  cursor: grab;
}
.gantt-bar-arrastrando {
  opacity: 0.35;
}
.gantt-drop-marker {
  position: fixed;
  width: 3px;
  border-radius: 2px;
  background: #f8fafc;
  box-shadow: 0 0 0 1px #0f172a, 0 0 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 50;
  display: none;
}
.gantt-bar-txt {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 0.5rem;
  line-height: 1.25;
}
.gantt-bloque-linea1 {
  font-weight: 600;
  font-size: 0.94rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gantt-bloque-linea2 {
  font-size: 0.84rem;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gantt-bar-pausa {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #fde047;
}
.gantt-real-track {
  position: absolute;
  top: 0.4rem;
  height: 0.65rem;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: visible;
}
.gantt-real-fill {
  height: 100%;
  border-radius: 999px 0 0 999px;
}
.gantt-real-label {
  position: absolute;
  left: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
}

/* Misma barra "Real" del Gantt, pero para una celda de tabla normal (sin
   posicionamiento absoluto ni superposicion de barras). */
.orden-progreso-track {
  background: #e2e8f0;
  border-radius: 999px;
  height: 0.65rem;
  overflow: hidden;
}
.orden-progreso-fill {
  height: 100%;
  border-radius: 999px;
  background: #2f6fed;
}

/* ---------- Detalle de día (franjas horarias) ---------- */
.franja {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  border-left: 4px solid transparent;
}
.franja-hora {
  font-weight: 600;
  font-size: 0.82rem;
  color: #374151;
  min-width: 130px;
}

/* ---------- Tableros (Kanban) ---------- */
.tableros-board {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  overflow-x: auto;
  padding: 1.1rem;
  background: linear-gradient(180deg, #1b2a47, #16243d);
  border-radius: 0.75rem;
  min-height: calc(100vh - 220px);
}
.tablero-columna {
  flex: 0 0 272px;
  background: #f1f2f5;
  border-radius: 0.55rem;
  padding: 0.6rem 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 220px);
}
.tablero-columna-recibidas {
  background: #e3e9fa;
}
.tablero-columna-arrastrando {
  opacity: 0.4;
}
.tablero-columna-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0.15rem 0.25rem 0.15rem 0.35rem;
  cursor: grab;
}
.tablero-columna-titulo {
  font-weight: 700;
  font-size: 0.85rem;
  color: #172b4d;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.tablero-columna-count {
  background: rgba(9, 30, 66, 0.13);
  color: #5e6c84;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.05rem 0.45rem;
  border-radius: 1rem;
}
.tablero-columna-menu {
  border: none;
  background: transparent;
  color: #5e6c84;
  font-size: 1rem;
  line-height: 1;
  padding: 0.2rem 0.45rem;
  border-radius: 0.3rem;
}
.tablero-columna-menu:hover {
  background: rgba(9, 30, 66, 0.1);
  color: #172b4d;
}
.tablero-lista-tarjetas {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 20px;
}
.tablero-tarjeta {
  background: #fff;
  border-radius: 0.4rem;
  padding: 0.55rem 0.65rem;
  box-shadow: 0 1px 0 rgba(9, 30, 66, 0.22);
  cursor: pointer;
}
.tablero-tarjeta:hover {
  background: #f7f8fa;
}
.tablero-tarjeta-arrastrando {
  opacity: 0.4;
}
.tablero-tarjeta-labels {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.35rem;
}
.tablero-etiqueta-bar {
  width: 2rem;
  height: 0.4rem;
  border-radius: 0.2rem;
  display: inline-block;
}
.tablero-tarjeta-titulo {
  font-size: 0.84rem;
  color: #172b4d;
  line-height: 1.35;
  margin-bottom: 0.3rem;
}
.tablero-tarjeta-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}
.tablero-tarjeta-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  color: #5e6c84;
  background: rgba(9, 30, 66, 0.06);
  padding: 0.1rem 0.4rem;
  border-radius: 0.3rem;
  white-space: nowrap;
}
.tablero-tarjeta-badge-vencida {
  background: #fbe1e1;
  color: #ae2e24;
  font-weight: 600;
}
.tablero-tarjeta-badge-completo {
  background: #4bce97;
  color: #fff;
}
.tablero-etiqueta-dot {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 3px;
  display: inline-block;
}
.tablero-etiqueta-dot-grande {
  width: 1.4rem;
  height: 1.4rem;
  cursor: pointer;
}
.tablero-color-radio input:checked + span {
  outline: 2px solid #201f1c;
  outline-offset: 2px;
}
.tablero-agregar-tarjeta {
  margin-top: 0.5rem;
}
.tablero-columna-nueva {
  flex: 0 0 272px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 0.55rem;
  padding: 0.65rem;
  align-self: flex-start;
}
.tablero-columna-nueva label {
  color: #dde3ec;
}
.tablero-drop-marker {
  position: fixed;
  height: 2px;
  background: #2f6fed;
  z-index: 9999;
  display: none;
  pointer-events: none;
}
.tablero-drop-marker-col {
  position: fixed;
  width: 2px;
  background: #2f6fed;
  z-index: 9999;
  display: none;
  pointer-events: none;
}

/* ---------- Tableros: modal de detalle de tarjeta ---------- */
.tablero-detalle-botones {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.tablero-detalle-boton {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #172b4d;
  background: rgba(9, 30, 66, 0.06);
  border: none;
  border-radius: 0.3rem;
  padding: 0.4rem 0.65rem;
  text-decoration: none;
}
.tablero-detalle-boton:hover {
  background: rgba(9, 30, 66, 0.14);
  color: #172b4d;
}
.tablero-detalle-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #5e6c84;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 1.1rem 0 0.4rem;
}
.tablero-detalle-titulo-input {
  font-size: 1.05rem;
  font-weight: 600;
  color: #172b4d;
  border: none;
  background: transparent;
  padding: 0.2rem 0.3rem;
  width: 100%;
  border-radius: 0.3rem;
}
.tablero-detalle-titulo-input:focus {
  background: #f4f5f7;
  outline: none;
}
.tablero-detalle-venc {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #f4f5f7;
  border-radius: 0.3rem;
  padding: 0.45rem 0.75rem;
  color: #172b4d;
  font-size: 0.85rem;
}
.tablero-detalle-venc input[type="date"] {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 0.85rem;
  color: #172b4d;
}
.tablero-detalle-venc input[type="date"]:focus {
  outline: none;
}
.tablero-detalle-etiquetas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.tablero-detalle-pill {
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  padding: 0.32rem 0.75rem;
  border-radius: 0.3rem;
  border: none;
}
.tablero-detalle-desc {
  width: 100%;
  min-height: 4.5rem;
  background: #f4f5f7;
  border: none;
  border-radius: 0.3rem;
  padding: 0.6rem 0.7rem;
  font-size: 0.85rem;
  color: #172b4d;
}
.tablero-detalle-desc:focus {
  background: #eceef2;
  outline: none;
}
.tablero-checklist-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tablero-checklist-pct {
  font-size: 0.75rem;
  color: #5e6c84;
  font-weight: 600;
}
.tablero-progreso {
  height: 0.45rem;
  background: #e4e6ea;
  border-radius: 0.3rem;
  margin: 0.5rem 0 0.65rem;
  overflow: hidden;
}
.tablero-progreso-fill {
  height: 100%;
  background: #4bce97;
}
.tablero-checklist-bloque {
  margin-bottom: 1.1rem;
}
.tablero-popup-etiquetas,
.tablero-popup-checklist {
  width: 250px;
}
.tablero-popup-etiquetas .dropdown-item {
  cursor: pointer;
}
.franja-detalle {
  font-size: 0.86rem;
  color: #374151;
}
.franja.franja-produccion {
  background: #eff6ff;
  border-left-color: #2563eb;
}
.franja.franja-puesta_marcha {
  background: #fffbeb;
  border-left-color: #d97706;
}
.franja.franja-cambio_molde {
  background: #fef2f2;
  border-left-color: #dc2626;
}
.franja.franja-pausa {
  background: #f1f5f9;
  border-left-color: #64748b;
}
.franja.franja-tiempo_muerto {
  background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 8px, #f1f5f9 8px, #f1f5f9 16px);
  border-left-color: #cbd5e1;
  color: #94a3b8;
}
