@font-face {
  font-family: "Manrope";
  src: url("manrope.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* Base */
  --plum: #191326;
  --action: #593ed6;
  --paper: #f6f4f1;
  --iris: #ece6ff;
  --amber: #ffb26b; /* Horarios y entregas. Solo con ciruela: sobre papel no alcanza contraste. */

  /* Derivados */
  --plum-raised: #2c2242;
  --plum-line: #4a3f62;
  --on-plum: #d8cfee;
  --action-dark: #4329b8;
  --action-ink: #3a259c;
  --iris-line: #c9bbf6;
  --surface: #fff;
  --ink: var(--plum);
  --muted: #5f566f;
  --line: #d9d3e0;
  --line-strong: #857b9a;
  --alert: #9a2a4a;
  --alert-soft: #fbe9ee;

  /* Marcas de parada; cambian sobre fondo oscuro */
  --pickup-mark: var(--action);
  --delivery-edge: var(--plum);

  /* Líneas de carril para el indicador de recorrido */
  --lane-x: repeating-linear-gradient(90deg, var(--amber) 0 8px, transparent 8px 15px);
  --lane-y: repeating-linear-gradient(180deg, var(--amber) 0 10px, transparent 10px 20px);

  /* --gutter usa el ancho del contenedor; --bleed, el de la ventana (para márgenes negativos) */
  --page: 1400px;
  --edge: clamp(16px, 3.4vw, 48px);
  --gutter: max(var(--edge), calc((100% - var(--page)) / 2));
  --bleed: max(var(--edge), calc((100vw - var(--page)) / 2));

  font-family: "Manrope", "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p, dl, dd, ol, ul { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
a { color: var(--action); }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 3px solid var(--action); outline-offset: 3px; }
:where(.masthead, .stage-main) :focus-visible { outline-color: var(--iris); }
:where(a, button, h1, h2, h3, dd, dt, p, td, strong) { overflow-wrap: anywhere; }

.visually-hidden,
.skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  position: fixed;
  z-index: 2;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: 6px;
  font-weight: 700;
}

/* Cabecera */

.masthead {
  display: flex;
  align-items: center;
  gap: 8px clamp(20px, 2.6vw, 40px);
  min-height: 68px;
  padding: 8px var(--gutter);
  color: var(--on-plum);
  background: var(--plum);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: #fff;
  font-size: 1.0625rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
}

/* Carretera hacia el horizonte */
.brand-mark {
  position: relative;
  flex: none;
  width: var(--mark, 34px);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 26%;
  background: var(--action);
}
.brand-mark::before {
  position: absolute;
  inset: 20% 10% 0;
  background: var(--iris);
  clip-path: polygon(41% 0, 59% 0, 100% 100%, 0 100%);
  content: "";
}
.brand-mark::after {
  position: absolute;
  inset: 32% 46% 0;
  background: linear-gradient(var(--action) 0 16%, transparent 16% 32%, var(--action) 32% 56%, transparent 56% 74%, var(--action) 74%);
  content: "";
}

.navigation { display: flex; flex: 1; flex-wrap: wrap; gap: 2px; min-width: 0; }
.navigation a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 13px;
  border-radius: 8px;
  color: var(--on-plum);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}
.navigation .nav-external { gap: 5px; }
.navigation a:hover, .session-button:hover { color: #fff; background: var(--plum-raised); }
.navigation a[aria-current] { color: var(--plum); background: var(--iris); font-weight: 750; }

.account { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.account-name {
  max-width: 13rem;
  overflow: hidden;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-button {
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  color: var(--on-plum);
  background: transparent;
  font-size: 0.875rem;
  white-space: nowrap;
  cursor: pointer;
}

/* Estructura: columna de contenido con franjas a todo el ancho */

.main-content {
  display: grid;
  grid-template-columns:
    [full-start] minmax(var(--edge), 1fr)
    [content-start] minmax(0, var(--page)) [content-end]
    minmax(var(--edge), 1fr) [full-end];
  align-content: start;
  padding-bottom: clamp(48px, 6vw, 88px);
}
.main-content > * { grid-column: content; min-width: 0; }
main:focus { outline: none; }

.page-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 18px 32px;
  padding-block: clamp(24px, 3.6vw, 52px) clamp(20px, 2.4vw, 34px);
}
.page-heading > div:first-child { min-width: 0; }
h1 { font-size: clamp(2rem, 3.5vw, 3.25rem); line-height: 1.08; letter-spacing: -0.045em; font-weight: 780; }
h2 { font-size: 1.375rem; line-height: 1.25; letter-spacing: -0.028em; font-weight: 760; }
h3 { font-size: 1.125rem; line-height: 1.3; letter-spacing: -0.015em; font-weight: 740; }
h4 { font-size: 0.875rem; font-weight: 740; }
.page-summary { max-width: 62ch; margin-top: 8px; color: var(--muted); }
.actions, .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  max-width: 100%;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 720;
  line-height: 1.26;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.button-primary { color: #fff; background: var(--action); }
.button-primary:hover { background: var(--action-dark); }
.button-secondary { color: var(--ink); background: transparent; border-color: var(--ink); }
.button-secondary:hover, .button-quiet:hover { background: var(--iris); }
.button-light { color: var(--plum); background: var(--paper); }
.button-light:hover { background: var(--iris); }
.stage-main .button-secondary { color: #fff; border-color: var(--on-plum); }
.stage-main .button-secondary:hover { background: var(--plum-raised); }
.stage-main .quiet-link { padding-inline: 8px; color: #fff; }
.button-quiet { color: var(--ink); background: transparent; border-color: transparent; }
.button-danger { color: var(--alert); }
.button:disabled { opacity: 0.58; cursor: default; }
.quiet-link, .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  min-height: 44px;
  font-size: 0.9375rem;
  font-weight: 680;
  text-underline-offset: 4px;
}

/* Horarios: ventana en ciruela, cita en ámbar, hora por confirmar sin relleno */

.slot { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.plate {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.45em;
  max-width: 100%;
  padding: 3px 9px;
  border: 2px solid var(--plum);
  border-radius: 6px;
  color: var(--amber);
  background: var(--plum);
  font-size: 0.9375rem;
  font-weight: 750;
}
.slot-appointment .plate { color: var(--plum); background: var(--amber); }
.slot-open .plate, .slot-pending .plate { border-style: dashed; color: var(--plum); background: transparent; }
.plate .time-zone, .plate .muted { color: inherit; }
.stop-hours { font-variant-numeric: tabular-nums; white-space: nowrap; }
.time-zone { font-size: 0.8125rem; font-weight: 650; overflow-wrap: anywhere; }
.slot-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; font-size: 0.8125rem; font-weight: 650; }

/* Un intervalo con extremos, una marca única o un trazo discontinuo */
.slot-type { display: inline-flex; align-items: center; gap: 7px; font-size: 0.8125rem; font-weight: 650; }
.slot-type::before { flex: none; width: 16px; height: 10px; content: ""; }
.slot-window .slot-type::before {
  border: solid currentColor;
  border-width: 0 2px;
  background: linear-gradient(currentColor, currentColor) 50% 50% / 100% 2px no-repeat;
}
.slot-appointment .slot-type::before { width: 3px; height: 13px; background: currentColor; }
.slot-open .slot-type::before { height: 0; border-top: 2px dashed currentColor; }

/* Tipo de parada: aro con salida o bloque con llegada */

.stop-kind {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-right: 5px;
  font-size: 0.875rem;
  font-weight: 650;
  white-space: nowrap;
}
.stop-kind::before {
  order: -2;
  flex: none;
  width: 12px;
  height: 12px;
  border: 3px solid var(--pickup-mark);
  border-radius: 50%;
  content: "";
}
.stop-kind::after {
  order: -1;
  flex: none;
  width: 25px;
  height: 6px;
  margin-right: 5px;
  border-radius: 3px;
  background: var(--lane-x) 1px 50% / calc(100% - 2px) 2px no-repeat var(--plum);
  content: "";
}
.stop-kind.kind-delivery::before {
  order: -1;
  margin-right: 5px;
  border: 2px solid var(--delivery-edge);
  border-radius: 3px;
  background: var(--amber);
}
.stop-kind.kind-delivery::after { order: -2; margin-right: 0; }

/* Inicio: próxima cita */

.stage {
  grid-column: full;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
  padding-inline: var(--gutter);
  color: #fff;
  background: var(--plum);
}
.stage-main {
  --pickup-mark: var(--iris);
  --delivery-edge: var(--amber);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(22px, 3vw, 44px);
  min-width: 0;
  padding-block: clamp(20px, 3.4vw, 52px) clamp(26px, 3.6vw, 56px);
}
/* La foto (3:2) cubre el marco y su borde derecho queda al 70 %, antes del rótulo de la puerta.
   Si cambia el archivo, hay que revisar estas proporciones. */
.stage-photo, .access-photo { container-type: size; position: relative; background: var(--plum-raised); }
.stage-photo::before, .access-photo::before {
  --photo-width: max(143cqw, 151cqh);
  position: absolute;
  inset: 0;
  background: url("route-hero.webp") calc(100cqw - 0.7 * var(--photo-width)) var(--photo-y, 62%) / var(--photo-width) auto no-repeat;
  content: "";
}
.stage-photo {
  height: clamp(104px, 24vw, 230px);
  margin-inline: calc(-1 * var(--bleed));
  clip-path: polygon(0 30px, 100% 0, 100% 100%, 0 100%);
}
.next-kind { color: var(--on-plum); font-size: 1.125rem; letter-spacing: -0.01em; }
.next-city {
  display: block;
  margin-top: 8px;
  font-size: clamp(2.75rem, 6.2vw, 5.75rem);
  font-weight: 780;
  line-height: 1;
  letter-spacing: -0.055em;
}
.next-facility { margin-top: clamp(12px, 1.4vw, 20px); font-size: clamp(1.125rem, 1.5vw, 1.375rem); font-weight: 700; line-height: 1.3; }
.next-address { max-width: 46ch; margin-top: 3px; color: var(--on-plum); }
.stage-empty .next-address { margin-top: 16px; font-size: 1.0625rem; }
.next-when { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 22px; }
.next-date { flex: 1 0 100%; font-size: 1.125rem; font-weight: 650; }
.next-time { color: var(--amber); font-size: clamp(2rem, 3.3vw, 3.125rem); font-weight: 760; line-height: 1.15; letter-spacing: -0.04em; }
.next-time .time-zone { font-size: 1.125rem; letter-spacing: 0; }
.next-time .muted { color: inherit; }
.next-when .slot-type { font-size: 1rem; }
.next-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px clamp(20px, 2.6vw, 40px);
  margin-block: clamp(14px, 1.6vw, 22px) clamp(16px, 1.8vw, 24px);
  padding-top: clamp(12px, 1.4vw, 18px);
  border-top: 1px solid var(--plum-line);
}
.next-facts dt { color: var(--on-plum); font-size: 0.8125rem; }
.next-facts dd { font-weight: 700; font-variant-numeric: tabular-nums; }

/* La hoja comparte color con la página y continúa bajo la foto */
.stage-queue {
  min-width: 0;
  margin-inline: calc(-1 * var(--bleed));
  padding: 14px var(--bleed) 0;
  color: var(--ink);
  background: var(--paper);
}
.queue-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 16px; }
.queue-heading h3 { font-size: 1.25rem; }
.queue, .agenda-stops, .legs, .documents { list-style: none; padding: 0; }
.queue-stop {
  display: grid;
  grid-template-columns: 10.25rem minmax(0, 1fr);
  gap: 8px 16px;
  align-items: start;
  padding-block: 12px;
  border-top: 1px solid var(--line);
}
.queue-place { display: grid; gap: 4px; padding-top: 4px; }
.queue-load { display: flex; flex-wrap: wrap; gap: 0 14px; color: var(--muted); font-size: 0.875rem; }
.queue-empty { padding-block: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); }

@media (min-width: 1040px) {
  .stage {
    grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
    grid-template-rows: minmax(clamp(190px, 17vw, 270px), 1fr) auto;
    column-gap: clamp(28px, 4.4vw, 76px);
  }
  .stage-main { grid-row: 1 / -1; grid-column: 1; }
  .stage-photo {
    --photo-y: 48%;
    grid-row: 1;
    grid-column: 2;
    height: auto;
    margin-left: 0;
    clip-path: polygon(84px 0, 100% 0, 100% 100%, 0 100%);
  }
  .stage-queue { grid-row: 2; grid-column: 2; margin-left: 0; padding-left: 30px; }
  .stage-empty { grid-template-rows: minmax(390px, auto); }
}

@media (min-width: 1280px) {
  .queue-stop { grid-template-columns: 13rem minmax(0, 1fr); }
}

/* Manifiesto */

.manifest { padding-top: clamp(30px, 3.6vw, 54px); }
.manifest-heading, .schedule-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 16px 32px;
}
.manifest-heading h2, .schedule-heading h2 { font-size: clamp(1.5rem, 2.1vw, 2rem); }
.tally { display: flex; flex-wrap: wrap; gap: 2px 22px; margin-top: 6px; font-size: 0.9375rem; }
.tally > div { display: flex; gap: 7px; }
.tally dt { color: var(--muted); }
.tally dd { font-weight: 780; font-variant-numeric: tabular-nums; }

.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; min-width: 0; }
.manifest > .filters { max-width: 780px; margin-block: 20px 14px; }
.filter-field { flex: 1 1 9.5rem; min-width: 0; }
.filter-search { flex: 2 1 16rem; }
.filter-field label, .field > label { display: block; margin-bottom: 5px; font-size: 0.875rem; font-weight: 660; }

.record-table { width: 100%; border-collapse: collapse; text-align: left; }
.record-table th, .record-table td { padding: 14px 20px 14px 0; vertical-align: middle; }
.record-table th { padding-block: 9px; border-bottom: 2px solid var(--plum); color: var(--muted); font-size: 0.8125rem; font-weight: 660; }
.record-table td { border-bottom: 1px solid var(--line); font-size: 0.9375rem; }
.record-table th:last-child, .record-table td:last-child { padding-right: 0; }
.column-label { display: none; }
.record-link {
  color: var(--ink);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-decoration: underline;
  text-decoration-color: var(--action);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.record-link:hover { color: var(--action); }
.record-primary .record-link { font-size: 1.0625rem; }
.record-subtitle { display: block; margin-top: 2px; color: var(--muted); font-size: 0.875rem; }
.city { font-weight: 720; }
.muted { color: var(--muted); }
.numeric { font-variant-numeric: tabular-nums; font-weight: 720; }
.manifest-table .cell-route { width: 43%; }
.manifest-table .cell-rate { text-align: right; white-space: nowrap; }
.manifest-table .cell-status { white-space: nowrap; }

/* Solo une la recogida y la entrega de una misma carga; su largo no indica distancia */
.route, .route-labels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.route-end { position: relative; min-width: 0; padding: 20px 12px 0 0; }
.route-end::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  border: 4px solid var(--pickup-mark);
  border-radius: 50%;
  content: "";
}
.route-to::before { border: 2px solid var(--delivery-edge); border-radius: 3px; background: var(--amber); }
.route-from::after {
  position: absolute;
  top: 4px;
  right: 4px;
  left: 18px;
  height: 6px;
  border-radius: 3px;
  background: var(--lane-x) 5px 50% / calc(100% - 10px) 2px no-repeat var(--plum);
  content: "";
}
.route-open .route-from::after { top: 6px; height: 0; border-top: 2px dashed var(--line-strong); border-radius: 0; background: none; }
.route-end.route-missing::before { border: 2px dashed var(--line-strong); background: none; }

/* El texto nombra el estado; el borde y el relleno ayudan a distinguirlo */
.status {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.45;
}
.status-scheduled { color: var(--action-ink); background: var(--iris); border-color: var(--iris-line); }
.status-in_transit { color: #fff; background: var(--action); }
.status-delivered, .status-applied, .status-active { border-color: var(--line-strong); }
.status-draft, .status-review { color: var(--alert); border: 1px dashed var(--alert); }
.status-cancelled, .status-inactive { padding-inline: 0; color: var(--muted); }
.status-cancelled { text-decoration: line-through; }

.empty-state { display: grid; justify-items: start; gap: 4px; padding-block: clamp(22px, 4vw, 44px); color: var(--muted); }

/* Agenda */

.schedule-heading { padding-bottom: 20px; border-bottom: 2px solid var(--plum); }
.agenda-nav { display: flex; flex-wrap: wrap; gap: 0 20px; }
.agenda-nav a { display: inline-flex; align-items: center; min-height: 44px; font-size: 0.9375rem; font-weight: 680; text-underline-offset: 4px; }
.agenda-day { padding-block: 18px 6px; border-bottom: 1px solid var(--line-strong); }
.day-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding-bottom: 8px; }
.day-date { display: grid; grid-template-columns: auto auto; column-gap: 12px; line-height: 1.25; }
.day-number {
  grid-row: 1 / span 2;
  grid-column: 1;
  align-self: center;
  font-size: 3.25rem;
  font-weight: 780;
  line-height: 1;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
}
.day-name { grid-row: 1; grid-column: 2; align-self: end; }
.day-month { grid-row: 2; grid-column: 2; align-self: start; color: var(--muted); font-size: 0.875rem; font-weight: 550; letter-spacing: 0; }
.day-today { padding: 2px 9px; border-radius: 5px; background: var(--iris); font-size: 0.875rem; letter-spacing: 0; }
.agenda-stop {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 8px 24px;
  align-items: start;
  padding-block: 16px;
}
.agenda-stop + .agenda-stop { border-top: 1px solid var(--line); }
.agenda-stop > .slot, .agenda-place { grid-row: 1 / span 2; }
.agenda-place, .agenda-load { min-width: 0; padding-top: 4px; }
.agenda-place .city { font-size: 1.0625rem; }
.agenda-facility { margin-top: 4px; font-size: 0.9375rem; font-weight: 600; }
.agenda-load { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.agenda-driver { grid-column: 3; min-width: 0; font-size: 0.9375rem; font-weight: 600; }
.agenda-label { display: block; color: var(--muted); font-size: 0.8125rem; font-weight: 500; }

@media (min-width: 1040px) {
  .schedule-heading .filters { flex: 0 1 30rem; }
  .agenda-day { display: grid; grid-template-columns: 204px minmax(0, 1fr); column-gap: 32px; }
  .day-heading { position: sticky; top: 12px; align-self: start; padding-top: 10px; }
  .agenda-stop { grid-template-columns: 11rem minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 0.7fr); }
  .agenda-driver { grid-row: 1; grid-column: 4; padding-top: 4px; }
}

/* Expediente */

.load-facts { display: flex; flex-wrap: wrap; gap: 10px 32px; margin-top: 16px; }
.load-facts dt, .leg-reference dt { color: var(--muted); font-size: 0.8125rem; }
.load-facts dd { margin-top: 2px; font-weight: 680; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 32px clamp(32px, 4.6vw, 76px); }
.itinerary { min-width: 0; padding-top: 20px; border-top: 2px solid var(--plum); }
.legs { margin-top: 22px; }
.leg {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(13rem, 15rem);
  gap: 14px 28px;
  align-items: start;
  padding: 0 0 46px 56px;
}
.leg:last-child { padding-bottom: 6px; }
.leg::before {
  position: absolute;
  top: 0;
  left: 2px;
  width: 28px;
  height: 28px;
  border: 8px solid var(--pickup-mark);
  border-radius: 50%;
  content: "";
}
.leg-delivery::before { border: 4px solid var(--delivery-edge); border-radius: 6px; background: var(--amber); }
.leg:not(:last-child)::after {
  position: absolute;
  top: 34px;
  bottom: 6px;
  left: 10px;
  width: 12px;
  border-radius: 6px;
  background: var(--lane-y) 50% 8px / 2px calc(100% - 16px) no-repeat var(--plum);
  content: "";
}
.leg-place, .leg-when { min-width: 0; }
.leg-kind { font-size: 0.9375rem; font-weight: 650; line-height: 28px; }
.leg h3 { margin-top: 2px; font-size: clamp(1.25rem, 1.8vw, 1.625rem); letter-spacing: -0.03em; }
.stop-address { margin-top: 6px; color: var(--muted); }
.leg-when { display: grid; gap: 8px; }
.leg-date { font-size: 0.9375rem; font-weight: 650; line-height: 28px; }
.leg .plate { font-size: 1.125rem; }
.leg-reference { margin-top: 6px; }
.stop-note { grid-column: 1 / -1; max-width: 70ch; padding: 12px 15px; border-radius: 8px; background: var(--iris); font-size: 0.9375rem; }
.stop-note h4 { margin-bottom: 2px; }

.paperwork { min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.paperwork > section { padding: clamp(16px, 1.8vw, 24px); }
.paperwork > section + section { border-top: 1px solid var(--line); }
.paperwork h2 { margin-bottom: 8px; font-size: 1.1875rem; }
.paperwork-empty { color: var(--muted); }
.documents li { padding-block: 12px 4px; }
.documents li + li { border-top: 1px solid var(--line); }
.document-heading { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: 5px 10px; }
.document-review { margin-top: 5px; color: var(--alert); font-size: 0.875rem; }
.money > div { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 16px; padding-block: 7px; }
.money dt { color: var(--muted); font-size: 0.9375rem; }
.money dd { font-weight: 740; font-variant-numeric: tabular-nums; }
.money-freight dd { font-size: 1.75rem; letter-spacing: -0.04em; line-height: 1.2; }
.unit { font-size: 0.8125rem; font-weight: 650; letter-spacing: 0; }

@media (min-width: 1040px) {
  .detail-layout { grid-template-columns: minmax(0, 1.8fr) minmax(310px, 1fr); }
}

/* Formularios */

.panel { min-width: 0; }
.form-panel { padding: clamp(16px, 2.4vw, 30px); border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.form-panel h2 + form, .form-panel h2 + .fields { margin-top: 16px; }
.narrow-panel { max-width: 720px; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
input:not([type=checkbox], [type=radio], [type=hidden]),
select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 1rem;
}
input::placeholder { color: var(--muted); opacity: 1; }
textarea { display: block; min-height: 92px; resize: vertical; }
input[type=checkbox] { width: 20px; height: 20px; margin: 0; accent-color: var(--action); }
.field > .check-label { display: flex; align-items: center; gap: 9px; min-height: 44px; margin-bottom: 0; }
.field-hint { margin-top: 6px; color: var(--muted); font-size: 0.875rem; }
.fields { display: grid; gap: 14px 16px; }
.field { min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field-error input, .field-error select, .field-error textarea { border: 2px solid var(--alert); }
.errorlist { margin: 6px 0 0; padding-left: 1.2em; color: var(--alert); font-size: 0.875rem; font-weight: 600; }
.errorlist.nonfield { margin: 8px 0 14px; }
.form-actions { margin-top: 20px; }
.page-actions { margin-top: 0; }
.load-fields, .stop-fields, .driver-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.file-field { padding: clamp(14px, 2vw, 22px); border: 2px dashed var(--action); border-radius: 10px; background: var(--iris); }
.file-field .field-hint { color: var(--ink); }
.file-field input[type=file] { padding: 7px; }
input[type=file]::file-selector-button {
  min-height: 36px;
  margin-right: 8px;
  padding: 5px 11px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--plum);
  font-weight: 680;
  cursor: pointer;
}
.stop-form-list { display: grid; gap: 26px; margin-block: 18px; }
.stop-form { min-width: 0; margin: 0; padding: 12px 0 0; border: 0; border-top: 2px solid var(--plum); }
.stop-form legend { padding: 0 12px 0 0; font-size: 1.0625rem; font-weight: 750; letter-spacing: -0.015em; }
.stop-form-actions, .stop-form [data-remove-stop] { margin-top: 8px; }

/* Avisos */

.messages { grid-column: full; }
.message { padding: 12px var(--gutter); border-bottom: 1px solid var(--iris-line); background: var(--iris); font-weight: 600; }
.message.warning { border-color: var(--alert); color: var(--alert); background: var(--alert-soft); }
.message.error { border-color: var(--alert); color: #fff; background: var(--alert); }

/* Acceso */

.login-content { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.access { display: grid; flex: 1; grid-template-columns: minmax(0, 1.3fr) minmax(400px, 0.7fr); }
.access-brand { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-width: 0; color: #fff; background: var(--plum); }
.access-photo { min-height: 128px; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 72px), 0 100%); }
.access-name {
  --mark: clamp(44px, 5vw, 72px);
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.5vw, 22px);
  padding: clamp(14px, 2.4vw, 34px) var(--edge) clamp(20px, 4vw, 56px);
  font-size: clamp(2.125rem, 5vw, 4.75rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.055em;
}
.login-panel { align-self: center; width: 100%; max-width: 500px; padding: 32px var(--edge); }
.login-panel form { margin-top: 24px; }
.login-panel form > .button { width: 100%; margin-top: 18px; }
.preview-access { margin-top: 24px; border-top: 1px solid var(--line); }
.preview-access form { margin-top: 6px; }

@media (prefers-reduced-motion: no-preference) {
  .button, .navigation a, .session-button { transition: background-color 140ms ease-out, color 140ms ease-out; }
}

@media (max-width: 1179px) {
  .masthead { flex-wrap: wrap; gap: 0 16px; min-height: 0; }
  .navigation { order: 1; flex: 1 0 100%; margin-inline: -10px; }
  .navigation a { padding-inline: 10px; }
}

@media (max-width: 860px) {
  .record-table, .record-table tbody, .record-table tr, .record-table td { display: block; }
  .record-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .record-table tbody { border-top: 2px solid var(--plum); }
  .record-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px 16px;
    padding-block: 16px;
    border-bottom: 1px solid var(--line-strong);
  }
  .record-table tbody td { padding: 0; border: 0; }
  .record-table .record-primary { grid-column: 1 / -1; }
  .column-label { display: block; color: var(--muted); font-size: 0.8125rem; font-weight: 500; }

  .manifest-table tbody tr { grid-template-areas: "load status" "route route" "driver rate"; }
  .manifest-table .record-primary { grid-area: load; }
  .manifest-table .cell-route { grid-area: route; width: auto; }
  .manifest-table .cell-driver { grid-area: driver; }
  .manifest-table .cell-rate { grid-area: rate; text-align: left; }
  .manifest-table .cell-status { grid-area: status; justify-self: end; }

  .access { grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); }
  .access-photo { height: clamp(128px, 30vw, 250px); clip-path: polygon(0 0, 100% 0, 100% calc(100% - 30px), 0 100%); }
  .login-panel { align-self: start; justify-self: center; }
}

@media (max-width: 680px) {
  .navigation a { font-size: 0.875rem; }
  .manifest-heading .actions { width: 100%; }
  .manifest-heading .actions .button { flex: 1 1 auto; }
  .schedule-heading .filters { width: 100%; }
  .agenda-stop { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 16px; }
  .agenda-stop > .slot, .agenda-place { grid-row: auto; grid-column: 1 / -1; }
  .agenda-stop > .slot { flex-flow: row wrap; align-items: center; gap: 6px 12px; }
  .agenda-place { padding-top: 0; }
  .agenda-driver { grid-column: 2; padding-top: 4px; }
  .leg { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 0 0 34px 46px; }
  .load-fields, .stop-fields, .driver-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .account-name { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); }
  .stop-fields .field:has(select[name$="-appointment"]),
  .stop-fields .field:has(select[name$="-timezone"]) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 380px) {
  .brand { font-size: 0.9375rem; }
  .queue-stop { grid-template-columns: minmax(0, 1fr); }
  .load-fields, .stop-fields, .driver-fields { grid-template-columns: minmax(0, 1fr); }
}
