/* Aplicación Logística Granipack — misma línea visual que el Informe de Abastecimiento */
:root {
  --pagina: #f9f9f7;
  --superficie: #fcfcfb;
  --tinta: #0b0b0b;
  --tinta-2: #52514e;
  --tinta-suave: #898781;
  --linea: #e1e0d9;
  --borde: rgba(11, 11, 11, 0.10);
  --azul: #2a78d6;
  --azul-osc: #1c5cab;
  --azul-claro: #cde2fb;
  --naranja: #eb6834;
  --ok: #0ca30c;
  --alerta: #fab219;
  --critico: #d03b3b;
  --radio: 10px;
  --sombra: 0 1px 3px rgba(11,11,11,.06), 0 4px 14px rgba(11,11,11,.05);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--pagina); color: var(--tinta); font-size: 14px;
  display: flex; min-height: 100vh;
}
a { color: var(--azul-osc); }

/* ---------- barra lateral ---------- */
.sidebar {
  width: 232px; min-width: 232px; background: #10233c; color: #dbe4ef;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.marca { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; }
.marca-logo {
  width: 38px; height: 38px; border-radius: 9px;
  background: linear-gradient(135deg, var(--azul), var(--azul-osc));
  color: #fff; font-weight: 800; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.marca-logo.grande { width: 56px; height: 56px; font-size: 28px; border-radius: 14px; margin: 0 auto 10px; }
.marca-nombre { font-weight: 700; font-size: 16px; color: #fff; letter-spacing: .2px; }
.marca-sub { font-size: 11.5px; color: #93a5bd; }
nav { padding: 6px 10px; flex: 1; overflow-y: auto; }
nav a {
  display: flex; align-items: center; gap: 10px; color: #c2cfdf; text-decoration: none;
  padding: 9px 12px; border-radius: 8px; margin: 2px 0; font-weight: 500;
}
nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
nav a.activo { background: var(--azul); color: #fff; }
nav .icono { font-size: 15px; width: 18px; text-align: center; opacity: .9; }
nav .contador {
  margin-left: auto; background: var(--critico); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 800; padding: 1px 7px;
}
.grupo-nav { margin-top: 8px; }
.grupo-nav > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.1px; font-weight: 700;
  color: #93a5bd; padding: 9px 12px; border-radius: 8px;
}
.grupo-nav > summary::-webkit-details-marker { display: none; }
.grupo-nav > summary::after { content: "▾"; font-size: 12px; transition: transform .15s; }
.grupo-nav:not([open]) > summary::after { transform: rotate(-90deg); }
.grupo-nav > summary:hover { background: rgba(255,255,255,.07); color: #fff; }
.grupo-nav > a { padding-left: 18px; }
.nav-sep { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.1px; color: #7b8da6; padding: 14px 12px 4px; }
.sidebar-pie { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.sync-estado { font-size: 11.5px; color: #93a5bd; margin-top: 8px; line-height: 1.5; }
.sync-estado b { color: #dbe4ef; }
.pie-usuario { margin-top: 10px; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; }
.pie-usuario a { color: #dbe4ef; text-decoration: none; font-weight: 650; }
.pie-usuario .rol-usuario { color: #93a5bd; font-size: 11.5px; }
.pie-usuario a.enlace-salir { color: #93a5bd; font-weight: 500; text-decoration: underline; font-size: 11.5px; }

/* ---------- contenido ---------- */
main { flex: 1; padding: 24px 28px 60px; min-width: 0; }
.encabezado { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
h1 { font-size: 22px; margin: 0; font-weight: 700; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 700; }
.sub { color: var(--tinta-2); margin-top: 3px; font-size: 13px; max-width: 900px; }
.migas { font-size: 12.5px; color: var(--tinta-suave); margin-bottom: 6px; }
.migas a { color: var(--tinta-2); }

/* ---------- botones y filtros ---------- */
.btn {
  border: 1px solid var(--borde); border-radius: 8px; background: var(--superficie); color: var(--tinta);
  padding: 8px 14px; font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 7px; font-family: inherit; white-space: nowrap;
}
.btn:hover { border-color: var(--azul); color: var(--azul-osc); }
.btn-primario { background: var(--azul); border-color: var(--azul); color: #fff; }
.btn-primario:hover { background: var(--azul-osc); color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #087f08; color: #fff; }
.btn-peligro { color: var(--critico); border-color: #efb9b9; }
.btn-peligro:hover { background: var(--critico); color: #fff; border-color: var(--critico); }
.btn.ancho { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-mini {
  border: 1px solid var(--azul); background: #fff; color: var(--azul-osc); border-radius: 6px;
  padding: 3px 9px; font-size: 11.5px; font-weight: 700; cursor: pointer; font-family: inherit; text-decoration: none;
}
.btn-mini:hover { background: var(--azul); color: #fff; }
.btn-mini.peligro { border-color: #efb9b9; color: var(--critico); }
.btn-mini.peligro:hover { background: var(--critico); color: #fff; }
#btn-sync { width: 100%; justify-content: center; }
.filtros {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--superficie); border: 1px solid var(--borde);
  border-radius: var(--radio); padding: 10px 12px; margin-bottom: 14px;
}
.filtros label { font-size: 12.5px; color: var(--tinta-2); font-weight: 600; }
.filtros .espacio { flex: 1; }
select, input[type="text"], input[type="date"], input[type="month"], input[type="number"],
input[type="password"], input[type="email"], input[type="search"], textarea {
  border: 1px solid var(--linea); border-radius: 7px; padding: 7px 9px; font-size: 13.5px;
  background: #fff; color: var(--tinta); font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--azul); outline: 2px solid var(--azul-claro); }
textarea { width: 100%; min-height: 60px; resize: vertical; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 14px 16px; box-shadow: var(--sombra); text-decoration: none; color: inherit; display: block;
}
a.kpi:hover { border-color: var(--azul); }
.kpi .etiqueta { font-size: 12px; color: var(--tinta-2); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.kpi .valor { font-size: 26px; font-weight: 750; margin-top: 4px; }
.kpi .detalle { font-size: 12px; color: var(--tinta-suave); margin-top: 3px; }
.kpi.rojo .valor { color: var(--critico); }

/* ---------- paneles ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.panel {
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 16px; box-shadow: var(--sombra); margin-bottom: 14px; min-width: 0;
}
.panel h2 .cuenta { color: var(--tinta-suave); font-weight: 600; }
.panel.alerta-roja { border-color: #efb9b9; background: #fffafa; }
.panel-cabecera { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.panel-cabecera h2 { margin: 0; }

/* ---------- formularios ---------- */
.campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.campo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.campo.doble { grid-column: span 2; }
.campo.completo { grid-column: 1 / -1; }
.campo label, .etiqueta-campo { font-size: 12.5px; font-weight: 650; color: var(--tinta-2); }
.campo label .req { color: var(--critico); }
.campo .ayuda { font-size: 11.5px; color: var(--tinta-suave); }
.campo select, .campo input { width: 100%; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; }
.lista-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.acciones { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.inline { display: inline; }

/* ---------- tablas ---------- */
.tabla-contenedor {
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio);
  box-shadow: var(--sombra); overflow: auto; max-height: calc(100vh - 230px);
}
.panel .tabla-contenedor { box-shadow: none; max-height: none; }
table.datos { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.8px; }
table.datos th {
  position: sticky; top: 0; z-index: 3; background: #f2f1ed; color: var(--tinta-2);
  font-size: 11.3px; text-transform: uppercase; letter-spacing: .4px;
  padding: 9px 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--linea);
}
table.datos td { padding: 7px 10px; border-bottom: 1px solid var(--linea); text-align: left; vertical-align: middle; }
table.datos th.num, table.datos td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.datos tbody tr:hover td { background: #f2f6fc; }
table.datos tr.fila-roja td { background: #fdf0f0; }
table.datos tr.fila-roja:hover td { background: #fbe3e3; }
table.datos tr.fila-roja td:first-child { box-shadow: inset 3px 0 0 var(--critico); }
table.datos td.corto { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.datos input[type="number"], table.datos input[type="text"] { width: 100%; }
.vacio { padding: 28px; text-align: center; color: var(--tinta-suave); }
.tabla-vacia { color: var(--tinta-suave); padding: 14px 4px; font-size: 13px; }

/* ---------- etiquetas de estado ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px;
  padding: 2.5px 9px 2.5px 7px; font-size: 11.5px; font-weight: 700; white-space: nowrap;
  background: #f1f0ec; color: var(--tinta-2);
}
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tinta-suave); }
.badge.solicitado, .badge.pendiente, .badge.programada, .badge.programado { background: #eef3fb; color: var(--azul-osc); }
.badge.solicitado::before, .badge.pendiente::before, .badge.programada::before, .badge.programado::before { background: var(--azul); }
.badge.pendiente { background: #f1f0ec; color: var(--tinta-2); }
.badge.pendiente::before { background: var(--tinta-suave); }
.badge.en_transito, .badge.en_ruta { background: #fdf3d7; color: #7a5200; }
.badge.en_transito::before, .badge.en_ruta::before { background: var(--alerta); }
.badge.cerrado, .badge.entregado, .badge.entregada, .badge.OK { background: #e7f6e7; color: #085c08; }
.badge.cerrado::before, .badge.entregado::before, .badge.entregada::before, .badge.OK::before { background: var(--ok); }
.badge.anulado, .badge.novedad, .badge.eliminado { background: #f3e9e9; color: #7a3a3a; }
.badge.anulado::before, .badge.novedad::before, .badge.eliminado::before { background: #b06a6a; }
.badge.CRITICO { background: #fbe3e3; color: #8f1f1f; }
.badge.CRITICO::before { background: var(--critico); }
.tag {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .5px;
  border-radius: 4px; padding: 1px 5px; background: #e3eefb; color: var(--azul-osc);
}
.tag.pd { background: #fdeee6; color: #a3441c; }
.rojo-txt { color: var(--critico); font-weight: 700; }
.verde-txt { color: #085c08; font-weight: 700; }
.suave { color: var(--tinta-suave); }
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; background: var(--superficie); border: 1px solid var(--borde);
  border-radius: 999px; padding: 6px 13px; font-weight: 700; font-size: 13px;
}
.chip .punto { width: 10px; height: 10px; border-radius: 50%; }
.punto.ok { background: var(--ok); } .punto.alerta { background: var(--alerta); }
.punto.critico { background: var(--critico); } .punto.azul { background: var(--azul); }

/* ---------- ficha de detalle ---------- */
.ficha { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 18px; }
.ficha .dato .k { font-size: 11.5px; color: var(--tinta-suave); font-weight: 650; text-transform: uppercase; letter-spacing: .4px; }
.ficha .dato .v { font-size: 14px; font-weight: 600; margin-top: 2px; word-break: break-word; }
.pasos { display: flex; gap: 0; margin: 4px 0 16px; flex-wrap: wrap; }
.paso {
  flex: 1; min-width: 180px; padding: 12px 14px; border: 1px solid var(--linea); background: var(--superficie);
  position: relative;
}
.paso:first-child { border-radius: var(--radio) 0 0 var(--radio); }
.paso:last-child { border-radius: 0 var(--radio) var(--radio) 0; }
.paso + .paso { border-left: none; }
.paso .n { font-size: 11px; font-weight: 800; color: var(--tinta-suave); letter-spacing: .5px; text-transform: uppercase; }
.paso .t { font-weight: 700; margin-top: 3px; }
.paso .d { font-size: 12px; color: var(--tinta-2); margin-top: 3px; }
.paso.hecho { background: #f1faf1; border-color: #b5dfb5; }
.paso.hecho .n { color: #085c08; }
.paso.actual { background: #f2f6fc; box-shadow: inset 0 0 0 2px var(--azul); }
.paso.actual .n { color: var(--azul-osc); }
.paso.rojo { background: #fdf0f0; box-shadow: inset 0 0 0 2px var(--critico); }
.validacion { border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-top: 10px; }
.validacion.ok { background: #e7f6e7; color: #085c08; }
.validacion.mal { background: #fbe3e3; color: #8f1f1f; }
.linea-tiempo { list-style: none; margin: 0; padding: 0; }
.linea-tiempo li { padding: 7px 0 7px 16px; border-left: 2px solid var(--linea); position: relative; font-size: 13px; }
.linea-tiempo li::before {
  content: ""; position: absolute; left: -6px; top: 12px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--azul);
}
.linea-tiempo .cuando { font-size: 11.5px; color: var(--tinta-suave); }

/* ---------- candidatas de transferencia ---------- */
.candidata { border: 1px solid var(--linea); border-radius: var(--radio); padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.candidata.sugerida { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.candidata .cab { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.candidata .lineas { font-size: 12.5px; color: var(--tinta-2); margin-top: 8px; }
.candidata .lineas span { display: inline-block; margin-right: 14px; }

/* ---------- valores en pesos colombianos ---------- */
.pesos { display: flex; align-items: stretch; border: 1px solid var(--linea); border-radius: 7px; background: #fff; overflow: hidden; }
.pesos:focus-within { border-color: var(--azul); outline: 2px solid var(--azul-claro); }
.pesos span { display: flex; align-items: center; padding: 0 9px; color: var(--tinta-2); font-weight: 650; background: #f2f1ed; font-size: 12.5px; }
.pesos input { border: none !important; outline: none !important; flex: 1; min-width: 0; text-align: right; font-variant-numeric: tabular-nums; border-radius: 0; }
.pesos:has(input:disabled) { background: #f6f5f2; opacity: .7; }

/* ---------- lotes al transferir ---------- */
table.lotes { border-collapse: collapse; font-size: 12.5px; }
table.lotes td { padding: 2px 8px 2px 0; border: none; }
table.datos tbody tr:hover table.lotes td { background: transparent; }
.suma-lotes { font-size: 12px; margin-top: 4px; }

/* ---------- líneas del traslado ---------- */
.buscador { position: relative; }
.sugerencias {
  position: absolute; z-index: 30; left: 0; right: 0; top: 100%; background: #fff;
  border: 1px solid var(--linea); border-radius: 8px; box-shadow: var(--sombra); max-height: 280px; overflow: auto;
}
.sugerencias div { padding: 7px 10px; cursor: pointer; font-size: 13px; }
.sugerencias div:hover, .sugerencias div.activa { background: #f2f6fc; }
.sugerencias b { margin-right: 6px; }

/* ---------- programación diaria ---------- */
.prog-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 1200px) { .prog-grid { grid-template-columns: 1fr; } }
.barra-accion {
  position: sticky; bottom: 0; background: #10233c; color: #fff; border-radius: var(--radio);
  padding: 10px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px;
}
.barra-accion input[type="date"] { border-color: transparent; }

/* ---------- agenda del día (orden de salida y paradas) ---------- */
ol.agenda, ol.paradas { list-style: none; margin: 0; padding: 0; }
.item-agenda { border: 1px solid var(--linea); border-radius: var(--radio); background: #fff; margin-bottom: 10px; padding: 10px 12px; }
.item-agenda.fila-roja { border-color: #efb9b9; background: #fffafa; }
.cab-agenda { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.info-agenda { flex: 1; min-width: 200px; }
.pos { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; border-radius: 50%;
  background: #10233c; color: #fff; font-size: 12px; font-weight: 800; }
.flechas { display: inline-flex; flex-direction: column; gap: 2px; }
.flechas button { border: 1px solid var(--linea); background: #fff; border-radius: 4px; cursor: pointer; font-size: 11px;
  line-height: 1; padding: 2px 6px; color: var(--tinta-2); }
.flechas button:hover { border-color: var(--azul); color: var(--azul-osc); }
ol.paradas { margin: 10px 0 0 34px; border-left: 2px dashed var(--linea); padding-left: 12px; }
ol.paradas li { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12.8px; flex-wrap: wrap; }
ol.paradas li .pos { background: var(--naranja); min-width: 20px; height: 20px; font-size: 11px; }
ol.paradas li .corto { flex: 1; min-width: 120px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ol.paradas li.parada-hecha { opacity: .65; }

/* ---------- cronograma ---------- */
.calendario { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden; }
.cal-cabecera, .cal-semana { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-cabecera div {
  padding: 9px 10px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--tinta-2); background: #f2f1ed; border-bottom: 1px solid var(--linea); text-align: center;
}
.cal-dia {
  min-height: 112px; padding: 6px; border-bottom: 1px solid var(--linea); border-right: 1px solid var(--linea);
  background: var(--superficie); display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.cal-semana .cal-dia:last-child { border-right: none; }
.calendario .cal-semana:last-child .cal-dia { border-bottom: none; }
.cal-dia.fuera-mes { background: #f6f5f2; }
.cal-dia.fuera-mes .cal-num { color: #c3c2b7; }
.cal-dia.hoy { background: #f2f6fc; box-shadow: inset 0 0 0 2px var(--azul); }
.cal-dia.soltar { background: #e3eefb; box-shadow: inset 0 0 0 2px var(--azul); }
.cal-num { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.cal-num a { color: inherit; text-decoration: none; }
.cal-num a:hover { color: var(--azul-osc); text-decoration: underline; }
.hoy-marca { font-size: 9.5px; background: var(--azul); color: #fff; border-radius: 4px; padding: 1px 5px; letter-spacing: .5px; }
.partida {
  display: flex; align-items: center; gap: 5px; background: #f1f0ec; border: 1px solid var(--linea);
  border-radius: 7px; padding: 3px 6px; font-size: 11.5px; min-width: 0; text-decoration: none; color: inherit;
}
.partida[draggable="true"] { cursor: grab; }
.partida-texto { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tinta-2); font-weight: 550; }
.partida.hecho { background: #e7f6e7; border-color: #b5dfb5; }
.partida.hecho .partida-texto { color: #085c08; }
.partida.vencida { background: #fbe3e3; border-color: #efb9b9; }
.partida.vencida .partida-texto { color: #8f1f1f; }
.partida.en-curso { background: #fdf3d7; border-color: #f3d98c; }
.partida.en-curso .partida-texto { color: #7a5200; }
.partida .mover { border: none; background: transparent; cursor: pointer; padding: 0 2px; font-size: 12px; color: var(--tinta-suave); }
.partida .mover:hover { color: var(--azul-osc); }
.leyenda { font-weight: 650; padding: 0 5px; border-radius: 4px; font-size: 12px; }
.leyenda.verde { background: #e7f6e7; color: #085c08; }
.leyenda.roja { background: #fbe3e3; color: #8f1f1f; }
.leyenda.amarilla { background: #fdf3d7; color: #7a5200; }
.leyenda.neutra { background: #f1f0ec; color: var(--tinta-2); }

/* ---------- ventana modal ---------- */
.modal-fondo { position: fixed; inset: 0; background: rgba(11,11,11,.35); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-fondo.oculto { display: none; }
.modal { background: #fff; border-radius: 12px; padding: 20px; width: min(460px, 92vw); box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.modal h2 { margin-bottom: 6px; }
.modal .campo { margin-top: 12px; }

/* ---------- avisos ---------- */
.mensajes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.mensaje { border-radius: 8px; padding: 10px 14px; font-size: 13.5px; font-weight: 550; }
.mensaje.ok { background: #e7f6e7; color: #085c08; border: 1px solid #b5dfb5; }
.mensaje.error { background: #fbe3e3; color: #8f1f1f; border: 1px solid #efb9b9; }
.mensaje.info { background: #eef3fb; color: var(--azul-osc); border: 1px solid var(--azul-claro); }
.aviso {
  position: fixed; bottom: 20px; right: 20px; background: #10233c; color: #fff; border-radius: 10px;
  padding: 12px 18px; font-weight: 600; box-shadow: var(--sombra); z-index: 200; max-width: 420px;
}
.aviso.error { background: var(--critico); }
.aviso.oculto { display: none; }

/* ---------- acceso ---------- */
body.publico { background: #10233c; padding: 24px 0; }
.tarjeta-acceso {
  margin: auto; /* centra sin cortarse arriba cuando la ventana es baja */
  background: #fff; border-radius: 16px; padding: 30px 28px; width: min(380px, 92vw);
  display: flex; flex-direction: column; gap: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.3); text-align: center;
}
.tarjeta-acceso label { text-align: left; font-size: 12.5px; font-weight: 650; color: var(--tinta-2); margin-top: 6px; }
.tarjeta-acceso input { width: 100%; padding: 10px; }
.tarjeta-acceso .btn { margin-top: 12px; padding: 11px; }
.error-acceso { background: #fbe3e3; color: #8f1f1f; border-radius: 8px; padding: 8px; font-size: 13px; }

@media (max-width: 800px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  nav { display: flex; flex-wrap: wrap; }
  main { padding: 16px; }
  .campo.doble { grid-column: auto; }
}

/* ---------- incidencias ---------- */
.inc-opciones { display: flex; flex-direction: column; gap: 8px; }
.inc-opciones .check { align-items: flex-start; line-height: 1.35; }
.inc-opciones .check input { margin-top: 2px; flex: none; }
.badge.cancelada { background: #f3e9e9; color: #7a3a3a; }
.badge.cancelada::before { background: #b06a6a; }

.badge.faltante { background: #fbe3e3; color: #8f1f1f; }
.badge.faltante::before { background: var(--critico); }

.quien-paga { display: flex; gap: 14px; margin-top: 6px; font-size: 12.5px; }
.quien-paga .check { font-size: 12.5px; }

table.datos tfoot td { background: #f2f1ed; border-top: 2px solid var(--linea); }

/* ---------- sección de transporte en bloques ---------- */
.bloque { border: 1px solid var(--linea); border-radius: var(--radio); background: #fff; padding: 14px 16px; margin-bottom: 14px; }
.bloque h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--tinta-2); }
.campos-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bloques-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.bloques-3 .bloque { margin-bottom: 0; display: flex; flex-direction: column; gap: 8px; }
.bloques-3 .bloque h3 { margin-bottom: 4px; }
@media (max-width: 1100px) { .campos-3, .bloques-3 { grid-template-columns: 1fr; } }
.fecha-hora { display: grid; grid-template-columns: 1fr 120px; gap: 8px; }
.fecha-hora input { width: 100%; min-width: 0; }
input[type="time"] { border: 1px solid var(--linea); border-radius: 7px; padding: 7px 9px; font-size: 13.5px; background: #fff; color: var(--tinta); font-family: inherit; }
.cobro { display: flex; flex-direction: column; gap: 8px; border-top: 1px dashed var(--linea); padding-top: 10px; margin-top: 4px; }
.cobro.sin-cobro .pesos, .cobro.sin-cobro .segmentado { opacity: .45; }
.interruptor { font-weight: 650; }
.segmentado { display: inline-flex; border: 1px solid var(--linea); border-radius: 8px; overflow: hidden; align-self: flex-start; }
.segmentado label { cursor: pointer; }
.segmentado input { position: absolute; opacity: 0; pointer-events: none; }
.segmentado span { display: block; padding: 6px 14px; font-size: 12.5px; font-weight: 650; color: var(--tinta-2); background: #fff; }
.segmentado label + label span { border-left: 1px solid var(--linea); }
.segmentado input:checked + span { background: var(--azul); color: #fff; }
.segmentado input:focus-visible + span { outline: 2px solid var(--azul-claro); }
.segmentado input:disabled + span { cursor: not-allowed; }
.campos-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .campos-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.inc-grupo { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; margin-top: 6px; }
.inc-grupo.hizo { color: #085c08; }
.inc-grupo.no { color: #8f1f1f; }
.partida .mover { font-size: 10px; letter-spacing: -1px; }

.badge.con_devolucion { background: #fdeee6; color: #a3441c; }
.badge.con_devolucion::before { background: var(--naranja); }

/* ---------- pestañas de informes ---------- */
.pestanas { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid var(--linea); margin-bottom: 14px; }
.pestanas a { padding: 9px 16px; text-decoration: none; color: var(--tinta-2); font-weight: 650; border-radius: 8px 8px 0 0;
  border: 1px solid transparent; border-bottom: none; margin-bottom: -2px; }
.pestanas a:hover { color: var(--azul-osc); background: #f2f6fc; }
.pestanas a.activa { color: var(--azul-osc); background: var(--superficie); border-color: var(--linea); border-bottom: 2px solid var(--superficie); }

.badge.sobrante, .badge.sobrante_transito { background: #fbe3e3; color: #8f1f1f; }
.badge.sobrante::before, .badge.sobrante_transito::before { background: var(--critico); }

td.bodegas-ruta { font-size: 12px; line-height: 1.45; white-space: nowrap; }
td.bodegas-ruta .suave { display: inline-block; min-width: 54px; font-size: 11px; }

/* recibido con novedad: terminado (verde), con un aviso naranja de que algo pasó en el camino */
.badge.cerrado_novedad { background: #e7f6e7; color: #085c08; box-shadow: inset 0 0 0 1.5px var(--naranja); }
.badge.cerrado_novedad::before { background: var(--ok); }

/* ---------- calendario: tocar el elemento abre "¿se hizo?" ---------- */
.partida { cursor: pointer; }
.partida.accionable:hover, .partida.accionable:focus-visible { outline: 2px solid var(--azul); outline-offset: 1px; }
.partida-accion { font-size: 10px; font-weight: 800; color: var(--azul-osc); background: #fff; border: 1px solid var(--azul-claro);
  border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.imprimir-dia { margin-left: auto; text-decoration: none; font-size: 13px; opacity: .55; }
.imprimir-dia:hover { opacity: 1; }
#mover-detalle[hidden] { display: none !important; }
#mover-detalle { display: inline-block; }

/* ---------- cantidades entregadas en la ventana "¿se hizo?" ---------- */
.modal { max-height: 90vh; overflow-y: auto; width: min(620px, 94vw); }
.inc-pedido { margin-top: 8px; font-size: 12.5px; }
.inc-tabla { margin-top: 4px; font-size: 12px; }
.inc-tabla td, .inc-tabla th { padding: 4px 6px; }
.inc-tabla input { width: 90px; text-align: right; }
.inc-tabla input.con-diferencia { border-color: var(--naranja); background: #fdeee6; }

/* ---------- pedidos a facturar ---------- */
.titulo-dia { font-size: 15px; margin: 18px 0 8px; }
.fact-cabeza { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.fact-estado { text-align: right; font-size: 12.5px; }
.fact-nuevo td { border-top: 2px solid var(--linea, #D9D7CF); }

.tabla-facturar .fila-pedido td { background: #F2F1ED; border-top: 2px solid #D9D7CF; vertical-align: top; }
.tabla-facturar tbody.fila-roja .fila-pedido td { background: #FBE3E3; }
.tabla-facturar .fila-referencia td { font-size: 12.5px; }
.tabla-facturar .fila-referencia td:nth-child(2) { padding-left: 24px; }
.tabla-facturar td:first-child { width: 90px; white-space: nowrap; }

/* ---------- ambiente ---------- */
.chip-ambiente { display: inline-block; margin-top: 6px; padding: 2px 10px; border-radius: 10px; font-weight: 700;
  font-size: 11px; letter-spacing: .06em; }
.chip-ambiente.pruebas { background: #F5C451; color: #3D2B00; }
.chip-ambiente.produccion { background: #2E9E5B; color: #fff; }
.tarjetas-ambiente { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.tarjeta-ambiente.activa { outline: 3px solid #2E9E5B; }
.tarjeta-ambiente form { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tarjeta-ambiente input[name=confirmacion] { width: 150px; }
