/* Capote Dock — prototipo de interfaz
   Dos capas de marca:
   - .platform : marca Capote (login y pie). Colores del logotipo oficial.
   - .tenant   : marca de la empresa cliente. En producción estas variables
                 se rellenan desde dbo.Empresas (color_primario, fuentes...). */

:root {
  /* Capote — muestreados de Capo-LogoOficial.png */
  --capote-indigo: #090061;
  --capote-magenta: #FF017B;
  --capote-cyan: #16D8E6;
  --capote-orange: #FF9000;
  --capote-capsule: #E8ECF0;

  /* Empresa cliente (SFS por defecto) */
  --brand: #E01E26;
  --brand-hover: #C2161D;
  --brand-ink: #1D1D1F;
  --steel: #5A636E;
  --line: #E1E5EA;
  --paper: #F5F6F8;
  --white: #FFFFFF;

  /* Estados con los dos colores de SFS: lo normal en tinta, lo que pide atención en rojo.
     (El rojo de texto es algo más oscuro que el de marca para leerse bien sobre su fondo.) */
  --ok: #1D1D1F;
  --ok-tint: #ECEEF1;
  --warn: #B3141B;
  --warn-edge: #E01E26;
  --warn-tint: #FDECEC;
  --pending: #45505C;
  --pending-tint: #ECEFF3;

  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-text: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius-s: 4px;
  --radius-m: 8px;
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1280px;
}

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

html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

button, a, [role="button"], summary, label.check, .carrier-option { touch-action: manipulation; }
button, .btn, summary, .nav a, .carrier-option span, .tag { user-select: none; -webkit-user-select: none; }

body {
  margin: 0;
  font-family: var(--font-text);
  font-size: 15px;
  line-height: 1.5;
  color: var(--brand-ink);
  background: var(--paper);
  font-feature-settings: "tnum" 1, "cv11" 1;
}

img { display: block; max-width: 100%; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--capote-cyan);
  outline-offset: 2px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important;
  margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important;
}

/* ---------- Botones ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  font: 600 15px/1 var(--font-text);
  border-radius: var(--radius-m);
  border: 1.5px solid transparent;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform 160ms cubic-bezier(.23, 1, .32, 1);
}
/* Al pulsar, el botón cede un poco: confirma que se ha oído el toque. */
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--brand); color: var(--white); }
.btn-quiet { background: var(--white); color: var(--brand-ink); border-color: var(--line); }

/* ---------- Pie de Capote (todas las páginas) ---------- */

.credit {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  max-width: var(--max); margin: 0 auto;
  padding: 28px var(--gutter) calc(36px + env(safe-area-inset-bottom, 0px));
  font-size: 13px; color: var(--steel);
}
.credit a { text-decoration: none; }
.credit-brand { display: inline-flex; align-items: center; gap: 10px; }
.credit-brand img { width: 92px; height: auto; }
.credit-sep { color: #A3ABB5; }

/* =========================================================
   LOGIN (marca Capote)
   ========================================================= */

.platform {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--white);
  overflow-x: hidden;
}

.login {
  flex: 1;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  align-items: center;
  gap: clamp(32px, 6vw, 96px);
  width: 100%; max-width: var(--max);
  margin: 0 auto;
  padding: 56px var(--gutter);
  isolation: isolate;
}

/* La cápsula gris del logotipo, ampliada a escenario de la página. */
.login::before {
  content: "";
  position: absolute; z-index: -1;
  top: 50%; left: calc(var(--gutter) - 64px); right: -40vw;
  height: min(560px, 78%);
  transform: translateY(-50%);
  background: var(--capote-capsule);
  border-radius: 999px;
}

.login-intro { max-width: 460px; }
.login-intro img { width: min(300px, 70%); height: auto; margin-bottom: 40px; }
.login-intro h1 {
  margin: 0 0 12px;
  font: 800 clamp(34px, 4vw, 48px)/1.05 var(--font-text);
  letter-spacing: -0.02em;
  color: var(--capote-indigo);
}
.login-intro p { margin: 0; font-size: 17px; color: #3B3F5C; max-width: 36ch; }

.login-card {
  position: relative;
  background: var(--white);
  border-radius: 20px;
  padding: 40px 36px 32px;
  box-shadow: 0 1px 2px rgba(9, 0, 97, .06), 0 18px 48px -24px rgba(9, 0, 97, .28);
}
/* La barra magenta del logotipo marca el inicio del formulario. */
.login-card::before {
  content: "";
  position: absolute; top: 0; left: 36px;
  width: 72px; height: 8px;
  background: var(--capote-magenta);
  border-radius: 0 0 8px 8px;
}
.login-card h2 { margin: 0 0 6px; font: 700 24px/1.2 var(--font-text); color: var(--capote-indigo); }
.login-card .hint { margin: 0 0 28px; color: #5B5F7A; font-size: 14px; }

.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; color: #23264A; }
.field input {
  width: 100%; height: 48px; padding: 0 14px;
  font: 400 16px var(--font-text); color: var(--capote-indigo);
  background: var(--white);
  border: 1.5px solid #CDD3DB; border-radius: var(--radius-m);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus { outline: none; border-color: var(--capote-indigo); box-shadow: 0 3px 0 0 var(--capote-magenta); }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 24px; font-size: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--capote-indigo); }
.link-quiet { color: var(--capote-indigo); font-weight: 600; text-decoration: none; }

.btn-capote {
  width: 100%; min-height: 52px;
  background: var(--capote-indigo); color: var(--white);
  border-radius: 999px; font-size: 16px;
}

/* Los cuatro puntos del logotipo como indicador de carga. */
.dots { display: none; gap: 6px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; animation: dot 1s ease-in-out infinite; }
.dots i:nth-child(1) { background: var(--white); }
.dots i:nth-child(2) { background: var(--capote-orange); animation-delay: .12s; }
.dots i:nth-child(3) { background: var(--capote-cyan); animation-delay: .24s; }
.dots i:nth-child(4) { background: var(--capote-magenta); animation-delay: .36s; }
.is-loading .dots { display: inline-flex; }
.is-loading .btn-label { display: none; }
@keyframes dot { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-5px); } }

.login-foot { margin: 22px 0 0; font-size: 13px; color: #5B5F7A; }

.platform .credit { color: #4A4E6A; }

/* =========================================================
   APLICACIÓN (marca de la empresa cliente)
   ========================================================= */

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; align-items: center; gap: 28px;
  max-width: var(--max); margin: 0 auto;
  height: 68px; padding: 0 calc(var(--gutter) + env(safe-area-inset-right, 0px)) 0 calc(var(--gutter) + env(safe-area-inset-left, 0px));
}
.topbar { padding-top: env(safe-area-inset-top, 0px); }
.tenant-mark { display: flex; align-items: center; gap: 12px; text-decoration: none; flex-shrink: 0; }
.tenant-mark img { width: 52px; height: auto; }
.tenant-mark span { font: 700 20px/1 var(--font-display); text-transform: uppercase; letter-spacing: .01em; }

.nav { display: flex; gap: 4px; }
.nav a { white-space: nowrap;
  position: relative;
  padding: 0 12px; height: 68px;
  display: flex; align-items: center;
  font-weight: 500; font-size: 15px; color: var(--steel);
  text-decoration: none;
}
.nav a[aria-current="page"] { color: var(--brand-ink); font-weight: 600; }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px;
  height: 3px; background: var(--brand); border-radius: 3px 3px 0 0;
}

.locate { margin-left: auto; position: relative; width: min(320px, 32vw); }
.locate input {
  width: 100%; height: 40px; padding: 0 12px 0 38px;
  font: 400 16px var(--font-text);
  background: var(--paper); border: 1.5px solid transparent; border-radius: var(--radius-m);
}
.locate input:focus { outline: none; background: var(--white); border-color: var(--brand-ink); }
.locate svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--steel); }

/* Menú de secciones del móvil (hamburguesa): en el ordenador van las pestañas. */
.nav-menu { display: none; position: relative; }
.nav-menu summary { list-style: none; display: grid; place-items: center; width: 44px; height: 44px; margin-left: -8px; border-radius: var(--radius-m); color: var(--brand-ink); cursor: pointer; }
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu[open] summary { background: var(--paper); }
.nav-menu-pop {
  position: absolute; left: -8px; top: calc(100% + 10px); z-index: 30;
  width: min(300px, calc(100vw - 2 * var(--gutter))); padding: 8px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: 0 16px 40px -14px rgba(29, 29, 31, .3);
}
.nav-menu-pop a {
  display: flex; align-items: center; min-height: 48px; padding: 0 14px;
  font: 600 16px var(--font-text); color: var(--brand-ink); text-decoration: none; border-radius: var(--radius-s);
}
.nav-menu-pop a[aria-current="page"] { background: var(--paper); box-shadow: inset 3px 0 0 var(--brand); }
@media (max-width: 860px) {
  .nav-menu { display: block; order: -1; }   /* a la izquierda del logo */
  .topbar .nav { display: none; }
}
.user { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--steel); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-ink); color: var(--white);
  font: 600 13px var(--font-text);
}

.page { max-width: var(--max); margin: 0 auto; padding: 36px var(--gutter) 24px; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 28px; }
.page-head h1 {
  margin: 0;
  font: 700 clamp(32px, 4vw, 44px)/1 var(--font-display);
  text-transform: uppercase; letter-spacing: .005em;
}
.page-head p { margin: 8px 0 0; color: var(--steel); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.crumbs { margin: 0 0 14px; font-size: 14px; color: var(--steel); }
.crumbs a { text-decoration: none; }

/* ---------- Etiqueta interna (réplica de la pegatina física) ---------- */

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 5px;
  background: var(--white);
  border: 1px solid #CBD1D8; border-radius: var(--radius-s);
  box-shadow: 0 1px 0 #E4E8EC;
  white-space: nowrap;
}
.tag img { width: 22px; height: auto; }
.tag b { font: 700 19px/1 var(--font-display); letter-spacing: .02em; }
.tag-none { font-size: 13px; color: var(--steel); }

/* ---------- Estado ---------- */

.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-ok { color: var(--ok); background: var(--ok-tint); }
.status-warn { color: var(--warn); background: var(--warn-tint); }
.status-pending { color: var(--pending); background: var(--pending-tint); }

/* ---------- Tráileres del día ---------- */

.day-summary {
  display: flex; flex-wrap: wrap; gap: 8px 28px;
  margin: 0 0 20px; padding: 0; list-style: none;
  color: var(--steel); font-size: 14px;
}
.day-summary strong { color: var(--brand-ink); font-weight: 600; }

.trailers { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); }
.trailer {
  display: grid;
  grid-template-columns: 120px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) 190px 28px;
  align-items: center; gap: 20px;
  padding: 18px 22px;
  border-top: 1px solid var(--line);
  text-decoration: none;
  transition: background-color .12s ease;
}
.trailer:first-child { border-top: 0; }
.carrier { font: 700 26px/1 var(--font-display); text-transform: uppercase; letter-spacing: .01em; }
.trailer .main b { display: block; font-weight: 600; }
.trailer .sub { display: block; font-size: 13px; color: var(--steel); }
.pieces b { font-weight: 600; }
.pieces .delta { color: var(--warn); font-weight: 600; }
.progress { display: block; height: 6px; margin-top: 8px; background: var(--pending-tint); border-radius: 6px; overflow: hidden; max-width: 140px; }
.progress span { display: block; height: 100%; background: var(--brand-ink); border-radius: 6px; }
.chev { color: #A3ABB5; transition: transform .12s ease, color .12s ease; }

/* ---------- Detalle de recepción ---------- */

.facts { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 14px; color: var(--steel); }
.facts strong { color: var(--brand-ink); font-weight: 600; }

.layout-detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }

.counts {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 20px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m);
}
.counts div { padding: 14px 18px; border-left: 1px solid var(--line); }
.counts div:first-child { border-left: 0; }
.counts dt { font-size: 13px; color: var(--steel); }
.counts dd { margin: 2px 0 0; font: 700 30px/1.1 var(--font-display); }
.counts .is-warn dd { color: var(--warn); }

.section-title { margin: 0 0 10px; font: 700 22px/1 var(--font-display); text-transform: uppercase; }
.compare { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.compare th {
  text-align: left; font-size: 13px; font-weight: 600; color: var(--steel);
  padding: 11px 14px; background: #FAFBFC; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.compare td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
.compare tbody tr:last-child td { border-bottom: 0; }
.compare .num { text-align: right; }
.compare .pro { font-size: 13px; color: var(--steel); }
.compare .who b { display: block; font-weight: 600; }
.compare .who span { color: var(--steel); font-size: 13px; }
.was { color: var(--steel); text-decoration: line-through; margin-right: 6px; }

.compare tr.is-warn td { background: var(--warn-tint); }
.compare tr.is-warn .status-warn { background: #FFE2B8; }
.compare tr.is-warn td:first-child { box-shadow: inset 4px 0 0 var(--warn-edge); }
.compare tr.note-row td { padding-top: 0; }
.note { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; font-size: 14px; }
.note p { margin: 0; }
.note .thumbs { display: flex; gap: 6px; }
.note .thumbs span {
  width: 44px; height: 34px; border-radius: var(--radius-s);
  background: linear-gradient(135deg, #C9B79C, #8E7A5E);
  border: 1px solid rgba(0,0,0,.08);
}
.note .thumbs span:nth-child(2) { background: linear-gradient(135deg, #A99A84, #6E6150); }

.pill-haz { display: inline-block; margin-left: 6px; padding: 0 6px; font-size: 11px; font-weight: 700; color: #7A2E00; background: #FFE3CC; border-radius: 3px; vertical-align: 1px; }

.aside { display: grid; gap: 20px; position: sticky; top: 92px; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 18px; }
.panel h2 { margin: 0 0 12px; font: 700 20px/1 var(--font-display); text-transform: uppercase; }
.panel p { margin: 0; font-size: 14px; color: var(--steel); }
.scan { display: block; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; margin-bottom: 10px; }
.scan img { width: 100%; height: 240px; object-fit: cover; object-position: top; }
.signature { height: 74px; border-bottom: 1.5px solid var(--brand-ink); margin-bottom: 8px; }
.signature svg { width: 100%; height: 100%; }
.panel .btn { width: 100%; }
.panel .btn + .btn { margin-top: 10px; }

/* =========================================================
   APLICACIÓN — componentes de la versión funcional
   ========================================================= */

.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; padding: 8px 14px; background: var(--white); border: 2px solid var(--brand-ink); border-radius: var(--radius-m); }
.skip:focus { left: 12px; }

.sub { display: block; font-size: 13px; color: var(--steel); }
.muted { color: var(--steel); }
.optional { font-weight: 400; color: var(--steel); font-size: 13px; }

.flash { margin: 0 0 20px; padding: 12px 16px; background: var(--ok-tint); color: var(--ok); border-radius: var(--radius-m); font-weight: 500; }
.form-error { margin: 0 0 20px; padding: 12px 16px; background: #FDECEC; color: #A3121A; border-radius: var(--radius-m); font-weight: 500; }
.form-note { margin: 0 0 20px; padding: 12px 16px; background: var(--pending-tint); color: var(--pending); border-radius: var(--radius-m); }
.login-card .form-error, .login-card .form-note { font-size: 14px; }

.empty { padding: 40px 24px; text-align: center; background: var(--white); border: 1px dashed #C9D0D7; border-radius: var(--radius-m); color: var(--steel); }
.empty p { margin: 0 auto 16px; max-width: 52ch; }
.empty p:last-child { margin-bottom: 0; }

.btn-s { min-height: 34px; padding: 0 12px; font-size: 14px; }
.link-button { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

/* Menú de usuario (details/summary, sin JavaScript) */
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--steel); padding: 6px 0; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20;
  width: 260px; padding: 8px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: 0 12px 32px -12px rgba(29, 29, 31, .25);
}
.user-pop p { margin: 0; padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-pop p b { display: block; }
.user-pop p span { display: block; font-size: 13px; color: var(--steel); overflow-wrap: anywhere; }
.user-pop a, .user-pop button {
  display: block; width: 100%; padding: 9px 10px; text-align: left;
  font: 500 14px var(--font-text); color: var(--brand-ink); text-decoration: none;
  background: none; border: 0; border-radius: var(--radius-s); cursor: pointer;
}

/* Navegación de días */
.day-nav { display: flex; gap: 8px; }
.day-nav .btn { padding: 0 14px; }

/* Formularios del interior */
.tenant .field label, .tenant .field legend { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; color: var(--brand-ink); }
.tenant .field input, .tenant .field select {
  width: 100%; height: 44px; padding: 0 12px;
  font: 400 16px var(--font-text); color: var(--brand-ink);
  background: var(--white); border: 1.5px solid #CDD3DB; border-radius: var(--radius-m);
}
.tenant .field input:focus, .tenant .field select:focus { outline: none; border-color: var(--brand-ink); box-shadow: 0 0 0 3px rgba(29, 29, 31, .08); }
.tenant .field input[type=radio], .tenant .field input[type=checkbox] { width: 18px; height: 18px; padding: 0; flex: 0 0 18px; box-shadow: none; }
.radios { border: 0; padding: 0; margin: 0 0 18px; }
.radios .check > span.sub { flex-basis: 100%; margin-left: 28px; margin-top: -6px; }
.radios .check { flex-wrap: wrap; }
.radios .check { display: flex; align-items: flex-start; gap: 10px; margin: 8px 0; font-size: 15px; }
.radios .check input { margin-top: 3px; accent-color: var(--brand); }
.radios .check .sub { display: block; }

.panel .field:last-of-type { margin-bottom: 20px; }
.panel-text { margin-bottom: 14px !important; }
.panel-hint { margin-top: 12px !important; font-size: 13px !important; }

.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px;
  margin: 0 0 20px; padding: 16px 18px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m);
}
.filters .field { margin: 0; min-width: 150px; }
.filters .field-grow { flex: 1 1 240px; }
.filters-check { height: 44px; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.filters-actions { display: flex; gap: 8px; }

/* Tablas genéricas */
.table-wrap { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--steel); padding: 11px 14px; background: #FAFBFC; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; }
.data-table tr.is-off td { color: var(--steel); }
.row-link { text-decoration: none; font-weight: 600; }
.pager { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* Dos columnas: contenido + formulario lateral */
.layout-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.section-gap { margin-top: 32px; }
.aside-stack { display: grid; gap: 20px; align-content: start; }

/* Zonas */
.zone-list { list-style: none; margin: 0; padding: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); }
.zone { display: grid; grid-template-columns: minmax(0, 1fr) 220px auto; align-items: center; gap: 16px; padding: 16px 20px; border-top: 1px solid var(--line); }
.zone:first-child { border-top: 0; }
.zone.is-off { background: #FAFBFC; color: var(--steel); }
.zone-main b { font: 700 24px/1.1 var(--font-display); text-transform: uppercase; }
.zone-load { font-size: 14px; }
.zone-load .progress { max-width: none; }
.zone-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.zone-edit { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1.4fr 140px; gap: 12px; align-items: end; }
.zone-edit .field { margin: 0; }
.zone-list .zone-edit:has(select) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.data-table td.actions { text-align: right; white-space: nowrap; }
.zone-edit .zone-actions { grid-column: 1 / -1; justify-content: flex-start; }

/* Permisos */
.perm-list { list-style: none; margin: 0; padding: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); }
.perm { display: flex; gap: 12px; align-items: flex-start; padding: 11px 16px; border-top: 1px solid var(--line); font-size: 14px; color: var(--steel); }
.perm:first-child { border-top: 0; }
.perm.is-on { color: var(--brand-ink); }
.perm-mark { flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; border: 1.5px solid #C9D0D7; }
.perm.is-on .perm-mark { background: var(--ok); border-color: var(--ok); color: var(--white); }

.temp-pass { margin: 0 0 24px; padding: 18px 20px; background: var(--white); border: 2px solid var(--brand-ink); border-radius: var(--radius-m); }
.temp-pass h2 { margin: 0 0 6px; font: 700 22px/1.1 var(--font-display); text-transform: uppercase; }
.temp-pass p { margin: 0 0 12px; color: var(--steel); }
.temp-pass code { display: inline-block; padding: 8px 14px; font: 600 22px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; background: var(--paper); border-radius: var(--radius-s); user-select: all; }

/* Localizar */
.locate-big { display: flex; gap: 10px; max-width: 560px; margin: 0 0 28px; }
.locate-big input { flex: 1; min-width: 0; height: 56px; padding: 0 18px; font: 600 22px var(--font-text); border: 2px solid #C9D0D7; border-radius: var(--radius-m); background: var(--white); }
.locate-big input:focus { outline: none; border-color: var(--brand-ink); }
.locate-big .btn { min-height: 56px; padding: 0 28px; font-size: 16px; }
.found { display: grid; grid-template-columns: 240px minmax(0, 1fr); max-width: 900px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.found-zone { display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 28px; background: var(--brand-ink); color: var(--white); }
.found-zone span { font-size: 14px; opacity: .8; }
.found-zone strong { font: 700 48px/1 var(--font-display); text-transform: uppercase; }
.found-body { padding: 24px 28px; }
.found-body h2 { margin: 14px 0 6px; font: 700 28px/1.1 var(--font-display); text-transform: uppercase; }
.found-body .facts { margin-bottom: 18px; }
.tag-lg { padding: 5px 12px 5px 7px; }
.tag-lg img { width: 30px; }
.tag-lg b { font-size: 26px; }

/* Firma y escaneo desde Blob */
.signature img { width: 100%; height: 100%; object-fit: contain; object-position: left bottom; }
.scan-file { display: block; padding: 40px 16px; text-align: center; font-weight: 600; }
.thumbs a { display: block; }
.thumbs img { width: 44px; height: 34px; object-fit: cover; border-radius: var(--radius-s); border: 1px solid rgba(0,0,0,.08); }

/* Login: variantes */
.login-simple { grid-template-columns: minmax(0, 460px); justify-content: center; }
.login-simple::before { left: -40vw; }
.login-card-wide { min-width: min(460px, 100%); }
/* Privacidad y soporte: texto largo en la tarjeta de la plataforma. */
.login-legal { grid-template-columns: minmax(0, 720px); align-items: start; }
.legal { font-size: 15px; line-height: 1.6; color: #23264A; }
.legal h3 { margin: 24px 0 6px; font: 700 17px/1.3 var(--font-text); color: var(--capote-indigo); }
.legal p, .legal ul { margin: 0 0 12px; }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 6px; }
.company-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 10px; }
.company-list button {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  font: inherit; text-align: left; color: var(--capote-indigo);
  background: var(--white); border: 1.5px solid #CDD3DB; border-radius: 12px; cursor: pointer;
}
.company-list button:disabled { opacity: .5; cursor: not-allowed; }
.company-list img { width: 44px; height: auto; }
.company-list b { display: block; }
.company-list small { color: #5B5F7A; }

/* Dashboard */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 0 0 24px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border-left: 1px solid var(--line); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi-label { font-size: 13px; color: var(--steel); }
.kpi strong { font: 700 36px/1.05 var(--font-display); }
.kpi-sub { font-size: 13px; color: var(--steel); }
.kpi.is-warn strong { color: var(--warn); }

.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.dash-wide { grid-column: 1 / -1; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.link-quiet-ink { font-size: 14px; font-weight: 600; text-decoration: none; }

.legend { display: flex; gap: 16px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--steel); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; }

.chart { width: 100%; max-width: 100%; height: auto; display: block; }
.chart .grid { stroke: #EEF0F3; stroke-width: 1; }
.chart .axis { stroke: #C9D0D7; stroke-width: 1; }
.chart .tick { font: 500 11px var(--font-text); fill: var(--steel); }
.chart .value { font: 600 12px var(--font-text); fill: var(--brand-ink); }
.chart .hit { fill: transparent; }
.chart .bar-link:focus-visible .hit { stroke: var(--capote-cyan); stroke-width: 2; }

.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hbars li { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) 52px; align-items: center; gap: 12px; font-size: 14px; }
.hbar-track { height: 12px; background: #F0F2F5; border-radius: 4px; overflow: hidden; }
.hbar { display: block; height: 100%; min-width: 0; border-radius: 0 4px 4px 0; }
.hbar-value { text-align: right; font-weight: 600; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mini-table th, .mini-table td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.mini-table thead th { font-size: 13px; font-weight: 600; color: var(--steel); }
.mini-table tbody th { font-weight: 600; }
.mini-table tbody tr:last-child th, .mini-table tbody tr:last-child td { border-bottom: 0; }
.mini-table .num { text-align: right; }
.rate { display: inline-flex; align-items: center; gap: 8px; }
.rate-track { width: 80px; height: 8px; background: #F0F2F5; border-radius: 4px; overflow: hidden; }
.rate-track span { display: block; height: 100%; border-radius: 0 4px 4px 0; }

.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.item-list li:first-child { border-top: 0; padding-top: 0; }
.item-list a { text-decoration: none; min-width: 0; }
.item-list b { font-weight: 600; }
.item-list-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
.item-list-cols li:nth-child(2) { border-top: 0; padding-top: 0; }
.item-dim { font-weight: 400; color: var(--steel); margin-left: 6px; }

/* Flujo de recepción */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0 0 24px; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; padding: 12px 16px 12px 52px; background: var(--white); border: 1px solid var(--line); margin-left: -1px; counter-increment: step; }
.steps li:first-child { border-radius: var(--radius-m) 0 0 var(--radius-m); margin-left: 0; }
.steps li:last-child { border-radius: 0 var(--radius-m) var(--radius-m) 0; }
.steps li::before {
  content: counter(step); position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font: 700 14px var(--font-text); background: var(--pending-tint); color: var(--steel);
}
.steps b { display: block; font-size: 14px; }
.steps span { font-size: 13px; color: var(--steel); }
.steps .is-current { border-color: var(--brand-ink); z-index: 1; }
.steps .is-current::before { background: var(--brand); color: var(--white); }
.steps .is-done::before { content: "✓"; background: var(--ok); color: var(--white); }

.upload { max-width: 720px; }
.carrier-pick { display: flex; flex-wrap: wrap; gap: 10px; }
.carrier-pick legend { margin-bottom: 10px; }
.carrier-option { position: relative; }
.carrier-option input { position: absolute; opacity: 0; }
.carrier-option span {
  display: inline-flex; align-items: center; min-height: 52px; padding: 0 22px;
  font: 700 24px/1 var(--font-display); text-transform: uppercase;
  background: var(--white); border: 1.5px solid #CDD3DB; border-radius: var(--radius-m); cursor: pointer;
}
.carrier-option input:checked + span { border-color: var(--brand); box-shadow: inset 0 0 0 1.5px var(--brand); color: var(--brand); }
.carrier-option input:focus-visible + span { outline: 3px solid var(--capote-cyan); outline-offset: 2px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  margin: 8px 0 20px; padding: 32px 20px; cursor: pointer;
  border: 2px dashed #C9D0D7; border-radius: var(--radius-m); background: var(--paper); color: var(--steel);
}
.dropzone b { color: var(--brand-ink); font-size: 16px; }
.dropzone:focus-within { outline: 3px solid var(--capote-cyan); outline-offset: 2px; }
.file-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-status { font-size: 13px; color: var(--steel); }
.upload-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.upload-actions .panel-hint { margin: 0 !important; }
.btn-busy { display: none; }
.is-busy { pointer-events: none; opacity: .75; }
.is-busy .btn-label { display: none; }
.is-busy .btn-busy { display: inline; }
.btn-big { min-height: 52px; padding: 0 28px; font-size: 16px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.progress-wide { max-width: 360px; margin-top: 10px; }

.layout-check { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }
.scan-pane { position: sticky; top: 92px; }
.scan-tall img { height: auto; max-height: 62vh; object-fit: contain; background: var(--paper); }
.header-edit { margin-top: 14px; }
.header-edit summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.header-edit form { margin-top: 12px; }

.lines { display: grid; gap: 12px; }
.line-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); scroll-margin-top: 90px; }
.line-card[open] { border-color: #B9C1CA; box-shadow: 0 8px 24px -16px rgba(29, 29, 31, .3); }
.line-card.is-checked:not([open]) { background: #FBFCFD; }
.line-card summary { display: flex; align-items: center; gap: 14px; padding: 14px 18px; cursor: pointer; list-style: none; }
.line-card summary::-webkit-details-marker { display: none; }
.line-num { flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); font-weight: 700; font-size: 13px; }
.line-title { flex: 1; min-width: 0; }
.line-title b { display: block; }
.line-form { padding: 0 18px 18px; border-top: 1px solid var(--line); }
.line-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px 14px; padding-top: 16px; margin-bottom: 14px; }
.line-grid .field { margin: 0; }
.line-grid .field-wide { grid-column: span 5; }
.line-grid .field-s { min-width: 0; }
.tenant .field input[type=file] { height: auto; padding: 8px; }
.hint { display: block; margin-top: 4px; font-size: 12px; color: var(--warn); }
.line-extra summary .line-num { background: var(--brand); color: var(--white); }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline-form input[type=text], .inline-form input:not([type]) { flex: 1 1 200px; min-width: 0; height: 44px; padding: 0 12px; font: 400 16px var(--font-text); border: 1.5px solid #CDD3DB; border-radius: var(--radius-m); }
.finish { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 20px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); scroll-margin-top: 90px; }
.finish p { margin: 0; color: var(--steel); }

.sigpad { position: relative; height: 170px; margin: 0 0 18px; background: var(--white); border: 1.5px solid #CDD3DB; border-radius: var(--radius-m); }
.sigpad canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; border-radius: var(--radius-m); }
.sigpad .sig-clear { position: absolute; right: 8px; top: 8px; }
.sig-hint { position: absolute; left: 16px; bottom: 34px; right: 16px; padding-top: 6px; border-top: 1.5px solid var(--brand-ink); font-size: 13px; color: var(--steel); pointer-events: none; }
.sigpad.is-signed .sig-hint { color: transparent; }
.driver { margin: 6px 0 20px; }
.driver summary { cursor: pointer; font-weight: 600; margin-bottom: 12px; }

.summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 16px; }
.summary dt { font-size: 13px; color: var(--steel); }
.summary dd { margin: 0; font: 700 28px/1.1 var(--font-display); }
.summary dd.warn { color: var(--warn); }
.summary-sub { margin: 4px 0 8px; font: 700 18px/1 var(--font-display); text-transform: uppercase; }
.aside .panel form, aside.panel form { margin-top: 16px; }

.tenant .field textarea { width: 100%; padding: 10px 12px; font: 400 16px var(--font-text); color: var(--brand-ink); border: 1.5px solid #CDD3DB; border-radius: var(--radius-m); resize: vertical; }
.tenant .field textarea:focus { outline: none; border-color: var(--brand-ink); box-shadow: 0 0 0 3px rgba(29, 29, 31, .08); }
.sent-list { list-style: none; margin: 16px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); font-size: 14px; display: grid; gap: 8px; }
.photo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.photo-list li { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; align-items: center; }
.photo-thumb img { width: 84px; height: 63px; object-fit: cover; border-radius: var(--radius-s); display: block; }
.photo-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 14px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-s); }

/* ---------- Hover sólo con puntero preciso (en táctil se quedaría "pegado") ---------- */
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--brand-hover); }
  .btn-quiet:hover { border-color: var(--steel); }
  .credit a:hover span { text-decoration: underline; text-underline-offset: 3px; }
  .field input:hover { border-color: #9AA3B0; }
  .link-quiet:hover { text-decoration: underline; text-underline-offset: 3px; }
  .btn-capote:hover { background: #17108A; }
  .nav a:hover { color: var(--brand-ink); }
  .crumbs a:hover { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 3px; }
  .trailer:hover { background: #FAFBFC; }
  .trailer:hover .chev { color: var(--brand); transform: translateX(2px); }
  .scan:hover { border-color: var(--steel); }
  .user-menu summary:hover .user-name { color: var(--brand-ink); }
  .user-pop a:hover, .user-pop button:hover { background: var(--paper); }
  .data-table tbody tr:hover td { background: #FAFBFC; }
  .row-link:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
  .company-list button:hover { border-color: var(--capote-indigo); }
  .link-quiet-ink:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
  .chart .bar-link:hover .hit { fill: rgba(29, 29, 31, .04); }
  .item-list a:hover b { color: var(--brand); }
  .dropzone:hover { border-color: var(--brand-ink); }
}

/* ---------- Escaneo plegable (sólo en móvil) ---------- */
.scan-details > summary { display: none; align-items: center; justify-content: space-between; min-height: 44px; cursor: pointer; list-style: none; font: 700 20px/1 var(--font-display); text-transform: uppercase; }
.scan-details > summary::-webkit-details-marker { display: none; }
.scan-details > summary span { font: 400 13px var(--font-text); text-transform: none; color: var(--steel); }

/* ---------- Filtros plegables (sólo en móvil) ---------- */
.filters-box > summary { display: none; }
.filters-box .filters { margin-bottom: 20px; }

/* ---------- Volver arriba ---------- */
.to-top {
  position: fixed; z-index: 30;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-ink); color: var(--white); border: 0; cursor: pointer;
  box-shadow: 0 6px 20px -6px rgba(29, 29, 31, .45);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .18s ease-out, transform .18s ease-out;
}
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top:active { transform: scale(.94); }

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .layout-check { grid-template-columns: minmax(0, 1fr); }
  .scan-pane { position: static; }
  .line-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .line-grid .field-wide { grid-column: 1 / -1; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(4) { border-left: 0; }
  .kpi:nth-child(n+4) { border-top: 1px solid var(--line); }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .item-list-cols { grid-template-columns: 1fr; }
  .item-list-cols li:nth-child(2) { border-top: 1px solid var(--line); padding-top: 10px; }
  .layout-detail, .layout-split { grid-template-columns: minmax(0, 1fr); }
  .zone { grid-template-columns: minmax(0, 1fr) auto; }
  .zone-load { grid-column: 1 / -1; grid-row: 2; }
  .aside { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .trailer { grid-template-columns: 100px minmax(0, 1fr) minmax(0, 1fr) 170px 20px; }
  .trailer .col-zone { display: none; }
}

@media (max-width: 860px) {
  .steps li { padding: 10px 8px 10px 40px; }
  .steps li::before { left: 8px; width: 24px; height: 24px; font-size: 12px; }
  .steps b { font-size: 12.5px; line-height: 1.2; }
  .steps span { display: none; }
  .line-form .btn-primary, .finish .btn, .upload-actions .btn { width: 100%; }
  .scan-details > summary { display: flex; }
  .scan-details > summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--steel); border-bottom: 2px solid var(--steel); transform: rotate(45deg); margin: -4px 0 0 10px; }
  .scan-details[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
  .day-nav { flex-wrap: wrap; width: 100%; }
  .day-nav .btn-primary { flex: 1 1 100%; }
  .day-nav .btn-quiet { flex: 1; }
  .carrier-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .carrier-option span { width: 100%; justify-content: center; }
  .filters-box { margin: 0 0 20px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); }
  .filters-box > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 0 16px; cursor: pointer; list-style: none; font-weight: 600; }
  .filters-box > summary::-webkit-details-marker { display: none; }
  .filters-box > summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--steel); border-bottom: 2px solid var(--steel); transform: rotate(45deg); margin-top: -4px; flex: 0 0 auto; transition: transform .15s ease-out; }
  .filters-box[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
  .filters-current { margin-left: auto; font-weight: 400; font-size: 13px; color: var(--steel); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .filters-box .filters { margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius-m) var(--radius-m); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters-box .filters .field { min-width: 0; }
  .filters-box .filters .field-grow, .filters-box .filters .filters-actions, .filters-box .filters .filters-check { grid-column: 1 / -1; }
  .filters-box .filters .filters-actions .btn { flex: 1; }
  .hide-sm { display: none; }
  .rate-track { display: none; }
  .mini-table th, .mini-table td { padding: 9px 6px; }
  .topbar { position: static; }
  .page { padding-bottom: 72px; }
  .to-top { width: 44px; height: 44px; }
  .page-head { align-items: stretch; }
  .page-actions { width: 100%; }
  .page-actions .btn, .page-actions form { flex: 1; }
  .page-actions form .btn { width: 100%; }
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 10px; row-gap: 0; }
  /* Pestañas fijas que caben en el ancho: sin desplazamiento lateral que se mueva al bajar con el dedo. */
  .nav { order: 10; width: calc(100% + 2 * var(--gutter)); margin: 10px calc(var(--gutter) * -1) 0; padding: 0 6px; gap: 0; overflow: hidden; border-top: 1px solid var(--line); }
  .nav a { flex: 1 1 auto; justify-content: center; height: 46px; padding: 0 6px; font-size: 14px; }
  .nav a[aria-current="page"]::after { left: 6px; right: 6px; }
  .nav .nav-extra { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(odd) { border-left: 0; }
  .kpi:nth-child(4) { border-left: 1px solid var(--line); }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .hbars li { grid-template-columns: 100px minmax(0, 1fr) 44px; }
  .user-name { display: none; }
  .found { grid-template-columns: 1fr; }
  .zone-edit { grid-template-columns: 1fr; }
  .locate-big .btn { padding: 0 18px; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .data-table td { border: 0; padding: 4px 14px; }
  .data-table td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 110px; color: var(--steel); font-size: 13px; }
  .data-table .num { text-align: left; }
  .locate { width: auto; flex: 1; }
  .topbar-inner { gap: 14px; }
  .tenant-mark span { display: none; }

  .login { grid-template-columns: 1fr; padding-top: 0; gap: 28px; }
  .login::before { display: none; }
  /* En móvil la cápsula envuelve la presentación completa. */
  .login-intro {
    max-width: none;
    margin: 0 calc(var(--gutter) * -1);
    padding: 18px var(--gutter) 20px;
    background: var(--capote-capsule);
    border-radius: 0 0 28px 28px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
  }
  /* Franja compacta: el formulario tiene que verse sin desplazarse. */
  .login-intro img { width: 120px; height: auto; margin: 0; }
  .login-intro h1 { margin: 0; font-size: 22px; text-align: right; }
  .login-intro p { display: none; }
  .login-card { padding: 28px 22px 24px; }
  .login-card .hint { margin-bottom: 20px; }
  .login-card::before { left: 22px; }

  .trailer { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 16px; }
  .trailer .carrier { grid-column: 1 / -1; font-size: 22px; }
  .trailer .col-pieces { grid-column: 1; }
  .trailer .col-status { grid-column: 2; grid-row: 2 / span 2; align-self: start; }
  .trailer .chev { display: none; }

  .counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .counts div:nth-child(3) { border-left: 0; }
  .counts div:nth-child(n+3) { border-top: 1px solid var(--line); }

  /* Comparativa en móvil: una tarjeta compacta por envío */
  .compare thead { display: none; }
  .compare, .compare tbody { display: block; width: 100%; }
  .compare tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .compare td { display: block; border: 0; padding: 0; background: none !important; font-size: 13px; }
  .compare tr.is-warn { background: var(--warn-tint); box-shadow: inset 4px 0 0 var(--warn-edge); }
  .compare tr.is-warn td:first-child { box-shadow: none; }
  .compare td[data-label="Label"] { flex: 1 1 auto; order: 1; }
  .compare td[data-label="Result"] { order: 2; margin-left: auto; }
  .compare td.who { order: 3; flex: 1 1 100%; font-size: 14px; }
  .compare td[data-label="Manifest"], .compare td[data-label="Received"], .compare td[data-label="Zone"], .compare td.pro { order: 4; color: var(--brand-ink); }
  .compare td[data-label="Manifest"]::before, .compare td[data-label="Received"]::before, .compare td[data-label="Zone"]::before, .compare td.pro::before {
    content: attr(data-label) " "; color: var(--steel);
  }
  .compare td[data-label="Zone"]::before { content: ""; }
  .compare td.pro { flex: 1 1 100%; color: var(--steel); }
  .compare .num { text-align: left; }
  .compare tr.note-row { padding-top: 0; border-top: 0; margin-top: -1px; }
  .compare tr.note-row td { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

main:focus { outline: none; }

/* ---------- Recorrido: fotos del tráiler primero ---------- */
.steps-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.required { font-weight: 600; color: var(--brand); font-size: 13px; }
.trailer-photos { margin-bottom: 16px; }
.trailer-photos.is-required { border: 2px solid var(--brand-ink); box-shadow: 0 10px 30px -18px rgba(29, 29, 31, .35); }
.trailer-photos .inline-form { margin-top: 4px; }
.thumbs-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.thumbs-row img { width: 56px; height: 42px; }
.empty.locked { padding: 28px 24px; }
.btn-block { display: flex; width: 100%; margin-top: 10px; }
.link-button { padding: 0; border: 0; background: none; font: 600 14px var(--font-text); color: var(--brand-ink); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.row-actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
form.inline { display: inline; }

/* Firma: en escritorio, un recuadro con proporción de firma y no una franja de lado a lado. */
.sigpad { height: auto; aspect-ratio: 5 / 2; min-height: 170px; max-height: 260px; max-width: 620px; }
.panel .sigpad .sig-clear { width: auto; margin: 0; }
#sign-form .field, #sign-form .driver, #sign-form .btn-big { max-width: 620px; }

/* ---------- Manifiesto de salida ---------- */
.finding-list { list-style: none; margin: 0 0 18px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-m); }
.finding { padding: 12px 14px; border-top: 1px solid var(--line); font-size: 14px; }
.finding:first-child { border-top: 0; }
.finding label { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.finding input[type=checkbox] { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 1px; accent-color: var(--brand-ink); }
.finding b { font-weight: 600; }
.finding.is-warn { background: var(--warn-tint); }
.finding.is-warn b { color: var(--warn); }

/* ---------- Dock Check ---------- */
.dock-search { position: relative; display: flex; gap: 10px; max-width: 720px; margin: 0 0 24px; }
.dock-search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--steel); pointer-events: none; }
.dock-search input { flex: 1; min-width: 0; height: 56px; padding: 0 16px 0 46px; font: 600 20px var(--font-text); border: 2px solid #C9D0D7; border-radius: var(--radius-m); background: var(--white); }
.dock-search input:focus { outline: none; border-color: var(--brand-ink); }
.dock-search .btn { min-height: 56px; padding: 0 26px; }
.dock-picks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.dock-pick { display: block; text-decoration: none; }
.dock-pick b { font: 700 20px/1.1 var(--font-display); text-transform: uppercase; }
.dock-bulk { position: sticky; top: 72px; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; padding: 10px 14px; background: var(--brand-ink); color: var(--white); border-radius: var(--radius-m); }
.dock-bulk-label { font-weight: 600; font-size: 14px; }
.dock-bulk select { height: 40px; min-width: 150px; padding: 0 10px; font: 500 16px var(--font-text); border: 0; border-radius: var(--radius-s); }
.dock-bulk .btn { min-height: 40px; background: var(--white); color: var(--brand-ink); border-color: var(--white); }
.dock-receipt { margin: 0 0 24px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); }
.dock-receipt-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dock-receipt-head h2 { margin: 0; font: 700 22px/1 var(--font-display); text-transform: uppercase; }
.dock-receipt-head .sub { display: inline; }
.dock-links { margin-left: auto; display: flex; gap: 16px; }
.dock-lines { list-style: none; margin: 0; padding: 0; }
.dock-line { display: grid; grid-template-columns: auto 150px minmax(0, 1fr) 190px; align-items: center; gap: 14px; padding: 12px 18px; border-top: 1px solid var(--line); scroll-margin-top: 140px; }
.dock-line:first-child { border-top: 0; }
.dock-line input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--brand-ink); }
.dock-line .dock-code b { font: 700 28px/1 var(--font-display); letter-spacing: .01em; }
.dock-who b { font-weight: 600; }
.dock-zone select { width: 100%; height: 44px; padding: 0 10px; font: 600 16px var(--font-text); border: 1.5px solid #CDD3DB; border-radius: var(--radius-m); background: var(--white); color: var(--brand-ink); }
.dock-line.is-unzoned .dock-zone select { border-color: var(--warn-edge); background: var(--warn-tint); }
.dock-line.is-moved { background: var(--ok-tint); }
.dock-label-form { display: flex; gap: 6px; }
.dock-label-form input { width: 90px; min-width: 0; height: 36px; padding: 0 8px; font: 600 16px var(--font-text); border: 1.5px solid #CDD3DB; border-radius: var(--radius-s); }
.dock-lines li:not(:has(input[type=checkbox])) { grid-template-columns: 150px minmax(0, 1fr) 190px; }

/* ---------- POD ---------- */
.pod-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pod-row { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.pod-icon { flex: 0 0 40px; height: 40px; display: grid; place-items: center; border-radius: var(--radius-m); background: var(--paper); color: var(--steel); }
.pod-main { flex: 1; min-width: 0; }
.pod-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod-row .status { flex-shrink: 0; }

@media (max-width: 860px) {
  .steps-4 li { padding-left: 36px; }
  .sigpad { max-width: none; aspect-ratio: auto; height: 190px; }
  .dock-search .btn { padding: 0 16px; }
  .dock-search input { font-size: 18px; }
  .dock-bulk { top: 8px; }
  .dock-bulk-label { flex-basis: 100%; }
  .dock-bulk select { flex: 1; min-width: 0; }
  .dock-line, .dock-lines li:not(:has(input[type=checkbox])) { grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; padding: 12px 14px; }
  .dock-line .dock-code { grid-column: 2; }
  .dock-lines li:not(:has(input[type=checkbox])) .dock-code { grid-column: 1 / -1; }
  .dock-line .dock-who, .dock-line .dock-zone { grid-column: 1 / -1; }
  .dock-line:has(input[type=checkbox]) .dock-who, .dock-line:has(input[type=checkbox]) .dock-zone { grid-column: 2; }
  .dock-links { margin-left: 0; width: 100%; }
  .row-actions { gap: 10px; }
  .item-list li:has(.row-actions) { flex-wrap: wrap; }
}

/* Entregado con POD: fuera del stock de la zona */
.dock-line.is-delivered { background: #FAFBFC; }
.dock-line.is-delivered .dock-code b, .dock-line.is-delivered .dock-who b { color: var(--steel); }
.dock-zone .status + .sub { margin-top: 4px; }

/* Historial de la recepción */
.history > summary { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; }
.history > summary::-webkit-details-marker { display: none; }
.history > summary h2 { margin: 0; }
.history-list { list-style: none; margin: 14px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.history-list li { position: relative; padding: 0 0 12px; font-size: 14px; }
.history-list li::before { content: ""; position: absolute; left: -19px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: #B9C1CA; }
.history-list li:first-child::before { background: var(--brand-ink); }

/* =====================================================================
   Nueva dirección (muestra): Overview y Dock Check, bajo .v2
   Muelle de carga: la pegatina SFS como elemento propio, menos cajas,
   títulos de sección en minúscula normal; la tinta manda, el rojo sólo actúa.
   ===================================================================== */

/* La pegatina: como la del papel, logo y número grande. */
.sticker { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 5px; background: var(--white); border: 1.5px solid var(--brand-ink); border-radius: 6px; line-height: 1; white-space: nowrap; }
.sticker img { width: 22px; height: auto; display: block; }
.sticker b { font: 700 20px/1 var(--font-display); letter-spacing: .01em; font-variant-numeric: tabular-nums; color: var(--brand-ink); }
.sticker-l { padding: 4px 11px 4px 6px; }
.sticker-l img { width: 28px; }
.sticker-l b { font-size: 27px; }
.sticker-empty { border-style: dashed; border-color: #B9C1CA; color: var(--steel); font-size: 13px; padding: 6px 10px; }

.v2 h2, .v2 h3 { text-transform: none; letter-spacing: 0; }
.v2 .page-head { margin-bottom: 22px; }

/* Overview: tablero del muelle + pendientes */
.board-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; margin-bottom: 40px; }
.dock-board { background: var(--white); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.board-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.board-head h2 { margin: 0; font: 600 26px/1 var(--font-display); }
.board-head span { font-size: 14px; color: var(--steel); }
.board-empty { margin: 0; padding: 28px 22px; color: var(--steel); }
.board-rows { list-style: none; margin: 0; padding: 0; }
.board-rows li + li { border-top: 1px solid var(--line); }
.board-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) minmax(160px, 1.1fr) 150px auto; align-items: center; gap: 18px; padding: 16px 22px; text-decoration: none; color: inherit; }
.board-carrier { font: 700 30px/1 var(--font-display); text-transform: uppercase; letter-spacing: .01em; }
.board-id b { display: block; font-weight: 600; font-variant-numeric: tabular-nums; }
.board-id span, .board-who span { display: block; font-size: 13px; color: var(--steel); }
.board-progress { display: grid; gap: 6px; font-size: 13px; color: var(--steel); }
.board-bar { height: 8px; border-radius: 4px; background: #E6E9ED; overflow: hidden; }
.board-bar i { display: block; height: 100%; background: var(--brand-ink); border-radius: 4px; }
.board-who { font-size: 14px; font-weight: 500; }
.board-go { padding: 9px 14px; border-radius: var(--radius-m); background: var(--brand-ink); color: var(--white); font-weight: 600; font-size: 14px; }

.todo { background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 16px 0 6px; }
.todo h2 { margin: 0 22px 8px; font: 600 26px/1 var(--font-display); }
.todo-done { margin: 0; padding: 8px 22px 16px; color: var(--steel); font-size: 14px; }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-list a { display: block; padding: 11px 22px 11px 19px; border-left: 3px solid var(--warn-edge); text-decoration: none; color: inherit; }
.todo-list li + li a { border-top: 1px solid var(--line); }
.todo-list b { display: block; font-weight: 600; font-size: 14.5px; }
.todo-list span { display: block; font-size: 13px; color: var(--steel); }

/* El periodo: una línea de cifras, sin baldosas */
.period-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.period-head h2 { margin: 0; font: 600 26px/1 var(--font-display); }
.period-head .filters-box { flex: 1 1 auto; }
.period-head .filters { margin: 0; justify-content: flex-end; background: none; border: 0; padding: 0; }
.period-stats { display: flex; flex-wrap: wrap; margin: 0 0 36px; padding: 18px 0; border-top: 2px solid var(--brand-ink); border-bottom: 1px solid var(--line); }
.period-stats > div { flex: 1 1 150px; padding: 0 22px; border-left: 1px solid var(--line); }
.period-stats > div:first-child { padding-left: 0; border-left: 0; }
.period-stats dt { font-size: 13px; color: var(--steel); }
.period-stats dd { margin: 4px 0 2px; font: 700 36px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.period-stats span { font-size: 13px; color: var(--steel); }
.period-stats .is-warn dd { color: var(--warn); }

.v2-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 36px 40px; align-items: start; }
.v2-grid { grid-template-areas: "chart zones" "exc side"; }
.v2-chart { grid-area: chart; } .v2-zones { grid-area: zones; } .v2-exc { grid-area: exc; } .v2-side { grid-area: side; }
.v2-wide { grid-column: 1 / -1; }
.v2-stack { display: grid; gap: 36px; }
.v2-sect-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.v2-sect-head h3 { margin: 0; font: 600 22px/1 var(--font-display); }
.v2-hint { margin: 10px 0 0; font-size: 13px; color: var(--steel); }
.exc-list { list-style: none; margin: 0; padding: 0; }
.exc-list a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 10px 0; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); }
.exc-who b { display: block; font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exc-who span { display: block; font-size: 13px; color: var(--steel); }
.exc-type { font-size: 13px; font-weight: 600; color: var(--warn); }
.type-split { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 12px 0 0; padding: 0; font-size: 13px; color: var(--steel); }
.type-split b { color: var(--brand-ink); }
.is-warn-text { color: var(--warn); font-weight: 600; }

/* Dock Check */
.dock-search-hero input { height: 64px; font-size: 24px; padding-left: 50px; }
.dock-search-hero svg { left: 18px; }
.dock-search-hero .btn { min-height: 64px; padding: 0 30px; font-size: 16px; }
.v2 .dock-receipt { border-radius: 10px; }
.v2 .dock-receipt-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; padding: 16px 20px; }
.v2 .dock-receipt-head h2 { font: 600 26px/1 var(--font-display); }
.dock-carrier { text-transform: uppercase; font-weight: 700; margin-right: 4px; }
.v2 .dock-receipt-head .sub { grid-column: 1; }
.v2 .dock-links { grid-column: 2; grid-row: 1; }
.zone-split { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 6px 0 0; padding: 0; }
.zone-split li { padding: 5px 11px; border-radius: 999px; background: var(--paper); font-size: 13.5px; color: var(--steel); }
.zone-split b { color: var(--brand-ink); font-variant-numeric: tabular-nums; margin-right: 2px; }
.zone-split .is-warn { background: var(--warn-tint); color: var(--warn); }
.zone-split .is-warn b { color: var(--warn); }
.zone-split .is-done { background: var(--ok-tint); color: var(--ok); }
.zone-split .is-done b { color: var(--ok); }
.v2 .dock-line { grid-template-columns: auto 170px minmax(0, 1fr) 200px; padding: 12px 20px; }
.v2 .dock-lines li:not(:has(input[type=checkbox])) { grid-template-columns: 170px minmax(0, 1fr) 200px; }
.v2 .dock-who .flag { display: inline-block; margin-top: 4px; font-size: 12.5px; font-weight: 600; color: var(--warn); }
.v2 .dock-bulk { box-shadow: 0 10px 28px -12px rgba(29, 29, 31, .5); }
.v2 .dock-bulk[hidden] { display: none; }
.v2 .dock-line.is-delivered .sticker { opacity: .55; }

@media (hover: hover) and (pointer: fine) {
  .board-row:hover, .todo-list a:hover, .exc-list a:hover { background: #FAFBFC; }
  .board-row:hover .board-go { background: var(--brand); }
}

@media (max-width: 1080px) {
  .board-grid, .v2-grid { grid-template-columns: minmax(0, 1fr); }
  .v2-grid { grid-template-areas: "chart" "zones" "exc" "side"; }
}
@media (max-width: 860px) {
  .board-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; padding: 14px 16px; }
  .board-carrier { font-size: 26px; }
  .board-id { grid-column: 2; grid-row: 1; text-align: right; }
  .board-progress { grid-column: 1 / -1; }
  .board-who { grid-column: 1; }
  .board-go { grid-column: 2; }
  .board-head, .todo h2 { padding-left: 16px; padding-right: 16px; margin-left: 0; }
  .todo h2 { padding: 0 16px; }
  .todo-list a { padding: 11px 16px 11px 13px; }
  .period-stats > div { flex: 1 1 45%; padding: 10px 12px 10px 0; border-left: 0; }
  .period-stats dd { font-size: 30px; }
  .dock-search-hero input { height: 56px; font-size: 19px; }
  .dock-search-hero .btn { min-height: 56px; padding: 0 18px; }
  .v2 .dock-line, .v2 .dock-lines li:not(:has(input[type=checkbox])) { grid-template-columns: auto minmax(0, 1fr); padding: 12px 14px; }
  .v2 .dock-receipt-head { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
  .v2 .dock-links { grid-column: 1; grid-row: auto; }
  .exc-list a { grid-template-columns: auto minmax(0, 1fr); }
  .exc-type { grid-column: 2; }
}

/* To do agrupado por recepción */
.todo-receipt { padding: 11px 22px 12px 19px; border-left: 3px solid var(--warn-edge); }
.todo-list li + li.todo-receipt, .todo-list li + li { border-top: 1px solid var(--line); }
.todo-list li + li a { border-top: 0; }
.todo-receipt .todo-title { padding: 0; border: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.todo-receipt .todo-title span { flex-shrink: 0; }
.todo-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.todo-actions a { display: inline-block; padding: 5px 10px; border: 0; border-radius: 999px; background: var(--warn-tint); color: var(--warn); font-size: 13px; font-weight: 600; text-decoration: none; }

/* Filtros del periodo, compactos al lado del título */
.period-head .filters .field { min-width: 0; }
.period-head .filters .field label { font-size: 12.5px; margin-bottom: 4px; color: var(--steel); font-weight: 500; }
.period-head .filters input, .period-head .filters select { height: 38px !important; font-size: 14px !important; }
.period-head .filters .field:nth-child(2), .period-head .filters .field:nth-child(3) { width: 120px; }
.period-head .filters .btn { min-height: 38px; padding: 0 14px; }
@media (max-width: 860px) {
  .todo-receipt { padding: 11px 16px 12px 13px; }
  .period-head .filters .field:nth-child(2), .period-head .filters .field:nth-child(3) { width: auto; }
}
@media (hover: hover) and (pointer: fine) {
  .todo-actions a:hover { background: #F9D6D8; }
  .todo-receipt .todo-title:hover b { text-decoration: underline; }
}

/* ---------- Dock Check: inventario ---------- */
.inv-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; margin: 0 0 22px; }
.inv-search { position: relative; flex: 1 1 340px; }
.inv-search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--steel); pointer-events: none; }
.inv-search input { width: 100%; height: 52px; padding: 0 14px 0 46px; font: 600 18px var(--font-text); border: 2px solid var(--brand-ink); border-radius: var(--radius-m); background: var(--white); }
.inv-search input:focus { outline: none; box-shadow: 0 0 0 3px rgba(29, 29, 31, .12); }
.inv-filters .field { margin: 0; }
.inv-filters .field label { display: block; margin-bottom: 4px; font-size: 12.5px; font-weight: 500; color: var(--steel); }
.inv-filters select, .inv-filters input[type=date] { height: 52px; padding: 0 10px; font: 500 15px var(--font-text); border: 1.5px solid #CDD3DB; border-radius: var(--radius-m); background: var(--white); color: var(--brand-ink); }
.inv-actions { display: flex; gap: 8px; }
.inv-actions .btn { min-height: 52px; }
.inv-manifest { display: grid; gap: 6px; margin: 0 0 20px; padding: 16px 20px; background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--brand-ink); border-radius: 10px; }
.inv-manifest h2 { margin: 0; font: 600 26px/1 var(--font-display); }
.inv-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 10px; }
.inv-head h2 { margin: 0; font: 600 24px/1 var(--font-display); }
.inv-table { background: var(--white); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.inv-row { display: grid; grid-template-columns: 40px 150px minmax(0, 1.4fr) minmax(0, 1fr) 64px 130px 170px; align-items: center; gap: 14px; padding: 10px 18px; border-top: 1px solid var(--line); scroll-margin-top: 140px; }
.inv-table:not(:has(input[data-bulk-all])) .inv-row { grid-template-columns: 150px minmax(0, 1.4fr) minmax(0, 1fr) 64px 130px 170px; }
.inv-row-head { border-top: 0; padding-top: 12px; padding-bottom: 12px; background: var(--paper); font-size: 12.5px; font-weight: 600; color: var(--steel); }
.inv-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--brand-ink); }
.inv-who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-who .flag { display: inline-block; margin-top: 3px; font-size: 12.5px; font-weight: 600; color: var(--warn); }
.inv-man a { text-decoration: none; color: inherit; font-size: 14px; }
.inv-man b { text-transform: uppercase; font-family: var(--font-display); font-size: 16px; letter-spacing: .01em; margin-right: 2px; }
.inv-pcs { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.inv-date { font-size: 13.5px; color: var(--steel); }
.inv-zone select { width: 100%; height: 40px; padding: 0 8px; font: 600 15px var(--font-text); border: 1.5px solid #CDD3DB; border-radius: var(--radius-m); background: var(--white); color: var(--brand-ink); }
.inv-row.is-unzoned .inv-zone select { border-color: var(--warn-edge); background: var(--warn-tint); color: var(--warn); }
.inv-row.is-moved { background: #F1F3F6; box-shadow: inset 4px 0 0 var(--brand-ink); }
.inv-row.is-delivered { color: var(--steel); }
.inv-row.is-delivered .sticker { opacity: .55; }
.inv-row .num { text-align: right; }
.dock-bulk[hidden] { display: none; }

@media (hover: hover) and (pointer: fine) {
  .inv-row:not(.inv-row-head):hover { background: #FAFBFC; }
  .inv-man a:hover { text-decoration: underline; }
}
@media (max-width: 1080px) {
  .inv-row, .inv-table:not(:has(input[data-bulk-all])) .inv-row { grid-template-columns: 34px 140px minmax(0, 1fr) 150px; }
  .inv-man, .inv-date { display: none; }
  .inv-pcs { display: none; }
  .inv-row-head span:nth-child(4), .inv-row-head span:nth-child(5), .inv-row-head span:nth-child(6) { display: none; }
}
@media (max-width: 860px) {
  .inv-filters .field, .inv-actions { flex: 1 1 45%; }
  .inv-filters select, .inv-filters input[type=date] { width: 100%; height: 46px; }
  .inv-actions .btn { flex: 1; min-height: 46px; }
  .inv-row-head { display: none; }
  .inv-row, .inv-table:not(:has(input[data-bulk-all])) .inv-row { grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; padding: 12px 14px; }
  .inv-row .inv-who, .inv-row .inv-zone { grid-column: 2; }
  .inv-table:not(:has(input[data-bulk-all])) .inv-row .inv-who, .inv-table:not(:has(input[data-bulk-all])) .inv-row .inv-zone { grid-column: 1 / -1; }
  .inv-man { display: block; grid-column: 2; font-size: 13px; }
}

/* Overview: entregas recientes */
.pod-mini { list-style: none; margin: 0; padding: 0; }
.pod-mini a { display: block; padding: 10px 0 10px 14px; border-bottom: 1px solid var(--line); border-left: 3px solid var(--brand-ink); text-decoration: none; color: inherit; }
.pod-mini b { display: block; font-weight: 600; font-size: 14.5px; }
.pod-mini span { display: block; font-size: 13px; color: var(--steel); }

/* =====================================================================
   Rediseño en toda la web (antes sólo en la muestra)
   Títulos de sección en minúscula normal; mayúsculas sólo para el título
   de página, transportistas y pegatinas. Tinta y rojo SFS.
   ===================================================================== */
.panel { border-radius: 10px; }
.panel h2, .section-title, .summary-sub, .temp-pass h2, .found-body h2, .dock-pick b, .scan-details > summary, .zone-main b {
  text-transform: none; letter-spacing: 0; font-weight: 600;
}
.panel h2 { font-size: 23px; }
.section-title { font-size: 24px; }
.summary-sub { font-size: 19px; }
.found-body h2 { font-size: 30px; }
.zone-main b { font-size: 24px; }
.item-with-sticker { display: inline-flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.line-title b .sticker { margin-right: 8px; vertical-align: middle; }
.line-title b .sticker b { font-size: 18px; }
.compare td .sticker b { font-size: 19px; }
.steps .is-current { border-color: var(--brand); }
.compare tr.is-warn td:first-child { box-shadow: inset 4px 0 0 var(--brand); }
.flash { background: #ECEEF1; color: var(--brand-ink); border-left: 4px solid var(--brand-ink); }
.inv-search { flex-basis: 100%; }
.inv-filters input[type=text] { width: 130px; height: 52px; padding: 0 10px; font: 500 15px var(--font-text); border: 1.5px solid #CDD3DB; border-radius: var(--radius-m); background: var(--white); }
.inv-filters select, .inv-filters input[type=text] { height: 46px; }
.inv-actions .btn { min-height: 46px; }
@media (max-width: 860px) { .inv-filters input[type=text] { width: 100%; } }

/* Exportar todo */
.export-list { list-style: none; margin: 0 0 22px; padding: 0; }
.export-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.export-list li:first-child { border-top: 0; padding-top: 0; }
.export-list b { display: block; font-weight: 600; }

/* POD: coincidencias por revisar y páginas sin envío */
.pod-review { margin: 0 0 24px; border-left: 4px solid var(--warn-edge); }
.pod-review .row-actions form { display: inline; }
.pod-gaps { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.pod-gaps a { font-weight: 600; }

/* POD: revisión página a página */
.page-chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 8px 0 14px; padding: 0; }
.page-chips a { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 36px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius-m); font-weight: 600; color: var(--brand-ink); text-decoration: none; background: var(--white); }
.page-chips a.is-current { background: var(--brand-ink); color: var(--white); border-color: var(--brand-ink); }
.pod-page { margin: 0 0 24px; scroll-margin-top: 16px; }
.pod-page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.pod-page-head h2 { margin: 0; }
.pod-page-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.pod-page-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.pod-page-view { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--paper); overflow: hidden; min-height: 320px; }
.pod-page-view canvas { display: block; width: 100%; height: auto; background: var(--white); }
.pod-page-status { margin: 0; padding: 48px 20px; text-align: center; color: var(--steel); }
.pod-page-side { display: grid; gap: 14px; }
.pod-page-form .btn { width: 100%; }
.code-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.code-chips button { font: 600 15px/1 var(--font-text); padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-m);
  background: var(--paper); color: var(--brand-ink); cursor: pointer; font-variant-numeric: tabular-nums; }
@media (hover: hover) and (pointer: fine) { .code-chips button:hover, .page-chips a:hover { border-color: var(--brand-ink); } }
@media (max-width: 860px) {
  .pod-page-body { grid-template-columns: minmax(0, 1fr); }
}

/* POD: fecha de entrega y firmante de cada envío */
.delivery-edit { flex-basis: 100%; margin-top: 6px; font-size: 14px; }
.delivery-edit > summary { cursor: pointer; color: var(--steel); }
.delivery-form { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin-top: 10px; }
.delivery-form .field { margin: 0; min-width: 200px; }

/* =========================================================
   PORTAL DE SEGUIMIENTO (público, con la marca de la empresa)
   ========================================================= */
.track { background: var(--paper); min-height: 100vh; display: flex; flex-direction: column; }
.track-top { background: var(--white); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.track-top-inner { max-width: 760px; margin: 0 auto; padding: 14px var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.track-top .tenant-mark img { width: 56px; height: auto; }
.track-top-label { color: var(--steel); font-size: 14px; font-weight: 600; }
.track-main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 32px var(--gutter) 48px; display: grid; gap: 20px; align-content: start; }
.track-search h1 { margin: 0 0 8px; }
.track-lead { margin: 0 0 18px; color: var(--steel); max-width: 56ch; }
.track-form { display: flex; gap: 10px; }
.track-form input { flex: 1; min-width: 0; height: 52px; padding: 0 16px; font: 500 18px var(--font-text); border: 1.5px solid var(--line); border-radius: var(--radius-m); background: var(--white); }
.track-form input:focus { outline: none; border-color: var(--brand-ink); }
.track-form .btn { height: 52px; padding: 0 26px; }
.track-card { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.track-card h2 { margin: 0; font-size: 28px; }
.track-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.track-carrier { margin: 0 0 2px; color: var(--steel); font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; }
.track-status { flex: 0 0 auto; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; background: var(--paper); color: var(--brand-ink); }
.track-status.is-done { background: var(--brand-ink); color: var(--white); }
.track-now { margin: 6px 0 20px; font-size: 17px; }
.track-steps { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 0; }
.track-steps li { position: relative; padding: 0 0 18px 34px; display: grid; gap: 2px; color: var(--steel); }
.track-steps li::before { content: ""; position: absolute; left: 6px; top: 4px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); background: var(--white); }
.track-steps li:not(:last-child)::after { content: ""; position: absolute; left: 12px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.track-steps li.is-done { color: var(--brand-ink); }
.track-steps li.is-done::before { background: var(--brand); border-color: var(--brand); }
.track-steps li span { font-size: 14px; color: var(--steel); }
.track-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0 0 22px; padding: 16px 0 0; border-top: 1px solid var(--line); }
.track-facts dt { font-size: 13px; color: var(--steel); }
.track-facts dd { margin: 2px 0 0; font-weight: 600; }
.track-pod { padding-top: 18px; border-top: 1px solid var(--line); }
.track-pod h3 { margin: 0 0 4px; font: 700 18px/1.2 var(--font-text); }
.track-pod p { margin: 0 0 12px; color: var(--steel); }
.track-pod-note { margin: 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--steel); }
.track-foot { text-align: center; padding: 20px var(--gutter) 28px; font-size: 14px; }
.track-foot p { margin: 4px 0; }
@media (max-width: 600px) {
  .track-form { flex-direction: column; }
  .track-form input { flex: none; }
  .track-form .btn { width: 100%; }
  .track-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .track-card { padding: 20px 18px; }
}


/* =========================================================
   MORNING CHECK (conteo físico de cada mañana)
   ========================================================= */
.mc-alerts { border-left: 4px solid var(--warn-edge); margin-bottom: 24px; }
.mc-alerts h2 { color: var(--warn); }
.mc-alert { display: grid; gap: 6px; width: 100%; }
.mc-resolve { display: flex; gap: 8px; margin-top: 4px; }
.mc-resolve input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: var(--radius-m); font: inherit; }
.mc-zones { list-style: none; margin: 0; padding: 0; display: grid; }
.mc-zones li { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 2.4fr) auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.mc-zones li:last-child { border-bottom: 0; }
.mc-zone-name { display: grid; gap: 2px; }
.mc-zone-go { display: flex; align-items: center; gap: 12px; justify-content: end; }
.mc-scan { margin-bottom: 20px; }
.mc-last { margin: 14px 0 6px; padding: 12px 14px; border-radius: var(--radius-m); font-size: 17px; background: var(--paper); }
.mc-last.is-ok { background: #E9F6EE; }
.mc-last.is-urgent { background: var(--warn-tint); color: var(--warn); }
.mc-last.is-check { background: #FFF6E5; }
.mc-tag { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--paper); color: var(--brand-ink); white-space: nowrap; }
.mc-tag.is-ok { background: #E9F6EE; color: #17643A; }
.mc-tag.is-check { background: #FFF6E5; color: #7A4B00; }
.mc-tag.is-urgent { background: var(--warn-tint); color: var(--warn); }
.mc-late { background: var(--warn-tint); }
.mc-late-tag { color: var(--warn); font-weight: 700; font-size: 14px; }
@media (max-width: 860px) {
  .mc-zones li { grid-template-columns: 1fr; gap: 6px; }
  .mc-zone-go { justify-content: start; }
  .mc-resolve { flex-direction: column; }
}
.todo-urgent a { border-left: 4px solid var(--warn-edge); padding-left: 12px; }
.todo-urgent b { color: var(--warn); }

/* Ficha del envío (Dock Check → historial) */
.shipment-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.shipment-title > span { font-size: inherit; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.details dt { color: #5A636E; font-weight: 500; }
.details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.history-list li.is-warn::before { background: var(--warn); }
.history-list li.is-warn > span:first-child { color: var(--warn); font-weight: 600; }
a.inv-history { color: inherit; text-decoration: none; }
a.inv-history:hover b { text-decoration: underline; }

/* Ayuda (/help): guías con capturas y preguntas frecuentes */
.help { max-width: 980px; }
.help-head h1 { margin-bottom: 6px; }
.help .lead { font-size: 17px; color: #3B4048; max-width: 62ch; margin: 0 0 22px; }
.help-toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 36px; }
.help-toc a { display: block; padding: 14px 16px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); text-decoration: none; color: var(--brand-ink); }
.help-toc a:hover { border-color: var(--brand-ink); }
.help-toc b { display: block; font-size: 15px; }
.help-toc span { display: block; font-size: 13px; color: var(--steel); margin-top: 2px; }
.help-section { padding: 26px 0 10px; border-top: 1px solid var(--line); scroll-margin-top: 90px; }
.help-section h2 { margin: 0 0 12px; }
.help-section h3 { margin: 22px 0 6px; font-size: 17px; }
.help-section p, .help-section li, .help-section dd { font-size: 15.5px; line-height: 1.6; max-width: 72ch; }
.help-steps { padding-left: 22px; margin: 0 0 18px; }
.help-steps li { margin-bottom: 8px; }
.help-list { padding-left: 20px; }
.help-keys { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 8px 18px; margin: 12px 0 18px; }
.help-keys dt { font-weight: 700; }
.help-keys dd { margin: 0; }
.help-note { padding: 12px 14px; background: var(--paper); border-left: 3px solid var(--brand); border-radius: var(--radius-s); }
.help-shot { margin: 16px 0 22px; }
.help-shot img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: 0 10px 28px -18px rgba(29, 29, 31, .35); background: var(--white); }
.help-shot figcaption { font-size: 13px; color: var(--steel); margin-top: 8px; }
.help-shot.is-phone { max-width: 260px; }
.help-shot.is-phone img { border-radius: 22px; }
.help-pair { display: flex; flex-wrap: wrap; gap: 0 22px; align-items: flex-start; }
.help-pair .help-shot:not(.is-phone) { flex: 1 1 380px; }
.help-faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.help-faq summary { font-weight: 600; cursor: pointer; font-size: 15.5px; }
.help-faq details p { margin: 8px 0 0; }
@media (max-width: 860px) {
  .help-keys { grid-template-columns: 1fr; gap: 2px; }
  .help-keys dd { margin-bottom: 10px; }
  .help-shot.is-phone { max-width: calc(50% - 11px); }
}

/* Pueblos y códigos postales de cada zona */
.zone-towns { flex-basis: 100%; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line, #e3e5e8); }
.zone-towns > summary { cursor: pointer; font-weight: 600; }
.town-list { list-style: none; margin: 10px 0; padding: 0; }
.town-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 2px 16px; padding: 7px 0; border-bottom: 1px solid var(--line, #e3e5e8); }
.town-list li:last-child { border-bottom: 0; }
.town-list .row-actions { font-size: 14px; }
.town-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; width: 100%; }
.town-form input, .town-form select { width: auto; min-width: 0; min-height: 44px; padding: 8px 12px; flex: 1 1 150px; border: 1px solid var(--line-strong, #c4c8cd); border-radius: 8px; font: inherit; background: #fff; }
.town-form .town-state { flex: 0 0 64px; }
.town-form .town-zip { flex: 0 0 96px; }
.void-panel { margin-bottom: 16px; }
.void-panel > summary { cursor: pointer; font-weight: 600; }

/* Fotos de la mercancía en la ficha del envío */
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.shipment-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.shipment-photos a { display: block; aspect-ratio: 4 / 3; border-radius: var(--radius-s, 8px); overflow: hidden; border: 1px solid rgba(0,0,0,.08); }
.shipment-photos img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Estado del Morning Check: qué zonas faltan y si el informe ya salió */
.mc-status { margin-bottom: 16px; }
.mc-status h2 { margin-bottom: 4px; }
.mc-status.is-pending { border-left: 4px solid var(--brand, #E01E26); }
.mc-status form { margin-top: 10px; }
