/* ============================================================
   QRastrea — estilos compartidos
   Estética: ficha de ruta industrial refinada.
   Grafito + ámbar de señalización, superficies con profundidad,
   micro-animaciones sobrias.
   ============================================================ */

:root {
  --ink: #14171c;         /* grafito oscuro */
  --bg: #e9ebee;          /* hormigón claro */
  --card: #ffffff;
  --line: #d9dde2;
  --muted: #68717d;
  --amber: #f2a900;       /* ámbar de señalización */
  --amber-hi: #ffc226;
  --amber-deep: #d99700;
  --amber-soft: rgba(242, 169, 0, .16);
  --danger: #c23a17;
  --danger-soft: #fbe9e4;
  --ok: #2e7d4f;
  --radius-sm: 10px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-1: 0 1px 2px rgba(20, 23, 28, .06), 0 4px 16px -8px rgba(20, 23, 28, .12);
  --shadow-2: 0 2px 4px rgba(20, 23, 28, .07), 0 14px 32px -14px rgba(20, 23, 28, .25);
  --shadow-3: 0 8px 20px rgba(20, 23, 28, .16), 0 28px 64px -24px rgba(20, 23, 28, .38);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --hazard: repeating-linear-gradient(-45deg,
      var(--amber) 0 10px, var(--ink) 10px 20px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1000px 480px at 50% -180px, rgba(255, 255, 255, .85), rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, var(--bg), #e2e5e9);
  background-attachment: fixed;
  color: var(--ink);
  font-family: 'Barlow', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

::selection { background: var(--amber); color: var(--ink); }

/* ---------- tipografía ---------- */
h1, h2, h3 {
  font-family: 'Barlow Condensed', 'Barlow', sans-serif;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  margin: 0;
}

.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }

/* ---------- transición entre pantallas ----------
   El navegador funde la pantalla que se va con la que llega, en lugar del
   parpadeo en blanco de una navegación común. Donde no está implementado —hoy,
   Firefox y Safari viejo— la navegación es exactamente la de siempre: no hay
   nada que reemplazar ni ningún respaldo que escribir.

   Va dentro de la consulta de movimiento reducido y no en el bloque del final:
   las pseudo-clases de la transición no son alcanzables con ese "*", así que
   la única forma de respetar la preferencia es no pedirla. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}

/* El código de la pieza es lo único que las dos pantallas tienen en común, así
   que se lo marca para que el navegador lo mueva de una a la otra en vez de
   fundirlo con el resto. El nombre lo pone el JavaScript, con el código de la
   pieza adentro: tiene que ser el mismo de los dos lados y único en cada
   pantalla. */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: .22s;
  animation-timing-function: var(--ease-out);
}

/* ---------- animaciones base ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
}
@keyframes fade-in {
  from { opacity: 0; }
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(18px) scale(.96); }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(10px) scale(.97); }
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 -6px rgba(242, 169, 0, 0); }
  50%      { box-shadow: 0 0 26px -4px rgba(242, 169, 0, .55); }
}

/* entrada escalonada del contenido principal */
.wrap > * { animation: rise .5s var(--ease-out) backwards; }
.wrap > *:nth-child(1) { animation-delay: .03s; }
.wrap > *:nth-child(2) { animation-delay: .09s; }
.wrap > *:nth-child(3) { animation-delay: .15s; }
.wrap > *:nth-child(4) { animation-delay: .21s; }
.wrap > *:nth-child(5) { animation-delay: .27s; }

/* ---------- barra superior ---------- */
/* Grafito neutro, sin la componente azulada del gris pizarra */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #16181b;
  color: #fff;
  padding: 0 18px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  min-height: 58px;
  border-bottom: 1px solid #000;
  box-shadow: 0 1px 0 rgba(242, 169, 0, .5), 0 10px 26px -16px rgba(0, 0, 0, .9);
}
.topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.topbar .brand img { display: block; width: 22px; height: 22px; }

/* La marca combina dos tratamientos: la sigla en versal ámbar y el resto
   en caja baja clara, de modo que se lean como una sola palabra. */
.brand-nombre {
  display: inline-flex;
  align-items: baseline;
  font-family: 'Barlow Condensed', sans-serif;
  line-height: 1;
}
.brand-nombre .bn-qr {
  font-weight: 700;
  font-size: 1.42rem;
  letter-spacing: .04em;
  color: var(--amber);
}
.brand-nombre .bn-resto {
  font-weight: 600;
  font-size: 1.28rem;
  letter-spacing: .12em;
  color: rgba(255, 255, 255, .93);
  margin-left: .06em;
}
.topbar .brand:hover .bn-resto { color: #fff; }

/* Secciones: texto con indicador inferior, sin recuadros */
.topbar .actions {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  position: relative;
}
.nav-menu { display: flex; align-items: stretch; gap: 2px; }

/* El disparador del menú solo existe en pantallas angostas */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  align-self: center;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255, 255, 255, .82);
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.nav-toggle:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-toggle.abierto {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: var(--amber-hi);
}
.nav-toggle:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 0;
  background: transparent;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: .98rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: rgba(255, 255, 255, .62);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color .18s ease, background-color .18s ease;
}
.nav-item::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 3px;
  background: var(--amber);
  border-radius: 2px 2px 0 0;
  transform: scaleX(0);
  transition: transform .22s var(--ease-out);
}
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.nav-item:hover::after { transform: scaleX(.55); }
.nav-item.activa { color: #fff; }
.nav-item.activa::after { transform: scaleX(1); }
.nav-item:focus-visible { outline: 2px solid var(--amber); outline-offset: -3px; }

/* Salir: separado del resto y con acento propio, por ser una acción de cierre */
.nav-item.salir {
  margin-left: 8px;
  padding-left: 18px;
  color: rgba(255, 255, 255, .48);
}
.nav-item.salir::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, .16);
}
.nav-item.salir::after { background: var(--danger); }
.nav-item.salir:hover { color: #ff9270; background: rgba(194, 58, 23, .14); }

/* ---------- barra superior en pantallas angostas ---------- */
/* Las cinco secciones no entran en línea: se agrupan en un desplegable. */
@media (max-width: 860px) {
  .topbar { padding: 0 14px; min-height: 54px; }
  .nav-toggle { display: inline-flex; }

  .nav-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 45;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    min-width: 216px;
    padding: 7px;
    background: #1c1f24;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: var(--radius);
    box-shadow: var(--shadow-3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(.98);
    transform-origin: top right;
    transition: opacity .18s ease, transform .22s var(--ease-out), visibility .18s;
  }
  .nav-menu.abierto {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .nav-menu .nav-item {
    justify-content: flex-start;
    padding: 13px 14px;
    border-radius: 8px;
    font-size: 1.02rem;
  }
  /* En vertical el indicador pasa a ser una barra lateral */
  .nav-menu .nav-item::after {
    left: 0;
    right: auto;
    top: 9px;
    bottom: 9px;
    width: 3px;
    height: auto;
    border-radius: 0 2px 2px 0;
    transform: scaleY(0);
  }
  .nav-menu .nav-item:hover::after { transform: scaleY(.6); }
  .nav-menu .nav-item.activa::after { transform: scaleY(1); }
  .nav-menu .nav-item.activa { background: rgba(242, 169, 0, .1); }

  /* Salir queda separado por una línea horizontal, no vertical */
  .nav-menu .nav-item.salir {
    margin: 5px 0 0;
    padding-left: 14px;
    border-top: 1px solid rgba(255, 255, 255, .1);
    padding-top: 14px;
  }
  .nav-menu .nav-item.salir::before { display: none; }
  .nav-menu .nav-item.salir::after { top: 13px; }
}

/* ---------- contenedores ---------- */
.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

/* El inicio necesita más ancho: con 720px las fichas quedan chicas
   y sobra espacio a los costados en pantallas grandes. */
.wrap.ancho { max-width: 1080px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: 24px;
  margin-bottom: 18px;
}

.card > h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  margin-bottom: 20px;
}
.card > h2::before {
  content: "";
  width: 6px;
  height: 18px;
  background: linear-gradient(180deg, var(--amber-hi), var(--amber));
  border-radius: 3px;
  flex: none;
}

/* ---------- ficha de pieza (firma visual) ---------- */
.tag {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  margin-bottom: 18px;
}
.tag-hazard {
  height: 8px;
  background: repeating-linear-gradient(-45deg,
      var(--amber) 0 8px, var(--ink) 8px 16px);
}
.tag-head {
  padding: 18px 20px 6px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.tag-code {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 2.1rem;
  letter-spacing: .1em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.tag-sub {
  color: var(--muted);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 600;
  margin-bottom: 2px;
}
.tag-body { padding: 8px 20px 20px; }

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
  margin-bottom: 8px;
}
.field-grid .label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  font-weight: 600;
}
.field-grid .value { font-weight: 600; word-break: break-word; }

/* anillo contador de reparaciones */
.ring-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ring {
  position: relative;
  width: 68px;
  height: 68px;
  flex: none;
}
.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  display: block;
}
.ring circle {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
}
.ring .ring-bg { stroke: #edeff2; }
.ring .ring-fg {
  stroke: var(--amber);
  stroke-dasharray: 188.5;
  stroke-dashoffset: 188.5;
  transition: stroke-dashoffset 1s var(--ease-out), stroke .4s ease;
}
.ring.danger .ring-fg { stroke: var(--danger); }
.ring .num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.75rem;
  font-variant-numeric: tabular-nums;
}
.ring.danger .num { color: var(--danger); }
/* cifra destacada (ficha de cliente) */
.dato-fuerte {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.dato-fuerte .df-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.dato-fuerte .df-lbl {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  font-weight: 600;
  margin-top: 3px;
}

.ring-lbl {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 600;
  max-width: 110px;
  line-height: 1.3;
}

.alert-descarte {
  background: var(--hazard);
  border-radius: var(--radius);
  padding: 4px;
  margin: 12px 0;
  animation: pulse-glow 2.6s ease-in-out infinite;
}
.alert-descarte > div {
  background: var(--ink);
  color: var(--amber);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 1.05rem;
  text-align: center;
}

/* ---------- historial (línea de tiempo) ---------- */
.history { list-style: none; margin: 0; padding: 0; }
.history li {
  position: relative;
  padding: 10px 0 12px 24px;
  margin-left: 6px;
  border-left: 2px solid var(--line);
}
.history li:last-child { border-left-color: transparent; }
.history li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--amber-soft);
}
.history .h-date {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  letter-spacing: .05em;
  font-size: 1.02rem;
}
.history .h-mec { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.history .h-work {
  margin-top: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;   /* un número de parte largo no debe salirse */
}

/* ---------- formularios ---------- */
/* La separación va en la fila y no en "form .row": hay pantallas donde los
   campos viven sueltos dentro de una tarjeta (configuración, filtros, ajustes
   de la pieza) y sin esto quedaban pegados al rótulo del campo siguiente.
   Solo se anula en la última fila suelta de una tarjeta o de un formulario;
   dentro de .grid-2 se conserva, porque en pantalla angosta las dos columnas
   se apilan y necesitan aire entre sí. */
.row { margin-bottom: 22px; }
.card > .row:last-child,
form > .row:last-of-type { margin-bottom: 0; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}
label {
  display: block;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  margin-bottom: 9px;
  font-weight: 600;
  line-height: 1.35;
}

/* Aclaración de campo no obligatorio. Se nota, pero sin disputarle el peso
   al nombre del campo: caja baja, sin versalita ni espaciado. */
label .opt {
  text-transform: none;
  letter-spacing: .01em;
  font-weight: 400;
  font-size: .95em;
  color: #8a939e;
}

/* texto de apoyo debajo de un campo */
.ayuda {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.5;
}

/* subtítulo dentro de una tarjeta */
h3.sub {
  font-size: .82rem;
  letter-spacing: .1em;
  color: var(--muted);
  margin: 26px 0 8px;
}
h3.sub:first-of-type { margin-top: 0; }
.card p { line-height: 1.62; }

/* pie discreto */
.pie {
  text-align: center;
  margin-top: 6px;
  font-size: .84rem;
}
.pie a { color: var(--muted); text-decoration: none; }
.pie a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- acceso a la presentación ----------
   Va encima del aviso legal, en el acceso y en la ficha que abre el código QR:
   son las dos pantallas a las que llega alguien que todavía no sabe qué es
   esto. Discreto, pero no tanto como un enlace de pie. */
.pie-presentacion {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: fit-content;
  margin: 26px auto 0;
  padding: 10px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-1);
  color: var(--ink);
  text-decoration: none;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  transition: transform .18s var(--ease-out), box-shadow .18s ease, border-color .18s ease;
}
.pie-presentacion:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: #c8cdd4;
}
.pie-presentacion .pp-punto {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}
.pie-presentacion svg {
  flex: none;
  color: var(--muted);
  transition: transform .18s var(--ease-out);
}
.pie-presentacion:hover svg { transform: translateX(3px); }
.pie-presentacion + .pie { margin-top: 14px; }

/* texto introductorio de una sección */
.intro {
  margin: -4px 0 20px;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.55;
}
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease;
}
input:hover, textarea:hover { border-color: #c3c9d0; }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 4px var(--amber-soft);
}

/* Valor que no se puede interpretar. Se señala en el propio campo, sin avisos
   emergentes: en un filtro que reacciona a cada tecla serían constantes. */
input.invalido {
  border-color: var(--danger);
  background: var(--danger-soft);
}
input.invalido:focus { box-shadow: 0 0 0 4px rgba(194, 58, 23, .15); }
button:focus-visible, a:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}
textarea { min-height: 110px; resize: vertical; }
::placeholder { color: #8b95a1; }

/* importe con su moneda */
.monto { display: flex; gap: 10px; }
.monto input { flex: 1; min-width: 0; }

/* fila de acción: campo + botón */
.fila-accion { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }

/* ---------- selector segmentado ---------- */
.segmentado {
  display: inline-flex;
  flex: none;
  padding: 3px;
  gap: 3px;
  background: #eef0f3;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.segmentado button {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 8px 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.segmentado button:hover { color: var(--ink); }
.segmentado button.activo {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-1);
}
.segmentado button:focus-visible { outline: 3px solid var(--amber); outline-offset: 1px; }

/* ---------- campo con sugerencias ---------- */
.autocomplete { position: relative; }
.ac-lista {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  animation: rise .18s var(--ease-out);
}
.ac-op {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ac-op + .ac-op { border-top: 1px solid var(--line); }
.ac-op.marcada { background: var(--amber-soft); }
.ac-op .ac-t { font-weight: 600; }
.ac-op .ac-d { color: var(--muted); font-size: .84rem; white-space: nowrap; }

/* ---------- campo de archivo ---------- */
.archivo { display: inline-flex; }
.archivo input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.archivo label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
}

/* ---------- enlace discreto dentro de un texto ---------- */
.enlace {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1.5px solid var(--amber);
  padding-bottom: 1px;
  transition: background-color .18s ease;
}
.enlace:hover { background: var(--amber-soft); }

/* ---------- panel de inicio ---------- */
/* Una columna en teléfono; dos en escritorio, con fichas grandes que
   ocupan el ancho disponible en lugar de dejar los costados vacíos. */
.accesos {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 700px) {
  .accesos { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .acceso { padding: 30px 32px; gap: 14px; min-height: 190px; }
  .acceso .ac-icono { width: 54px; height: 54px; border-radius: 14px; }
  .acceso .ac-icono svg { width: 27px; height: 27px; }
  .acceso .ac-nombre { font-size: 1.6rem; }
  .acceso .ac-desc { font-size: .95rem; max-width: 34ch; }
}
.acceso {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  text-decoration: none;
  color: var(--ink);
  position: relative;
  overflow: hidden;
  transition: transform .2s var(--ease-out), box-shadow .2s ease, border-color .2s ease;
  animation: rise .45s var(--ease-out) backwards;
}
/* La descripción se empuja al pie para que los títulos queden alineados */
.acceso .ac-desc { margin-top: auto; }
.accesos .acceso:nth-child(2) { animation-delay: .05s; }
.accesos .acceso:nth-child(3) { animation-delay: .10s; }
.accesos .acceso:nth-child(4) { animation-delay: .15s; }
.acceso::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--amber-hi), var(--amber));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s var(--ease-out);
}
.acceso:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
  border-color: #c8cdd4;
}
.acceso:hover::after { transform: scaleX(1); }
.acceso .ac-icono {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--amber-soft);
  color: var(--amber-deep);
}
.acceso .ac-nombre {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.22rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.acceso .ac-desc { color: var(--muted); font-size: .88rem; line-height: 1.45; }

/* resumen numérico del inicio */
.resumen {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px;
}
.resumen .r-item { text-align: center; }
.resumen .r-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.resumen .r-lbl {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  font-weight: 600;
  margin-top: 5px;
}

/* buscador con icono */
.search { position: relative; }
.search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search input { padding-left: 42px; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  border: 1px solid var(--amber-deep);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--amber-hi), var(--amber));
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  min-height: 46px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 8px -3px rgba(217, 151, 0, .65);
  transition: transform .16s var(--ease-out), box-shadow .2s ease, filter .2s ease, background-color .2s ease;
}
.btn svg { flex: none; }
.btn:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 7px 16px -5px rgba(217, 151, 0, .75);
}
.btn:active { transform: translateY(0); filter: brightness(.95); }
.btn.secondary {
  background: #fff;
  border-color: var(--line);
  box-shadow: var(--shadow-1);
}
.btn.secondary:hover { border-color: #c3c9d0; box-shadow: var(--shadow-2); }
.btn.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, .3);
  color: #fff;
  font-size: .9rem;
  padding: 8px 14px;
  min-height: 0;
  box-shadow: none;
}
.btn.ghost:hover {
  background: rgba(255, 255, 255, .09);
  border-color: rgba(255, 255, 255, .5);
  transform: none;
  box-shadow: none;
}
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; transform: none; }

/* estado de carga con spinner */
.btn.loading { pointer-events: none; }
.btn.loading::after {
  content: "";
  width: 15px;
  height: 15px;
  flex: none;
  border-radius: 50%;
  border: 2px solid rgba(20, 23, 28, .3);
  border-top-color: var(--ink);
  animation: spin .7s linear infinite;
}
.btn.secondary.loading::after {
  border-color: rgba(20, 23, 28, .2);
  border-top-color: var(--muted);
}

/* ---------- listado de piezas (panel) ---------- */
.pieza-item {
  position: relative;
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 13px 16px;
  margin-bottom: 10px;
  text-decoration: none;
  color: var(--ink);
  overflow: hidden;
  transition: transform .18s var(--ease-out), box-shadow .18s ease, border-color .18s ease;
  animation: rise .4s var(--ease-out) backwards;
}
#lista .pieza-item:nth-child(1) { animation-delay: .02s; }
#lista .pieza-item:nth-child(2) { animation-delay: .06s; }
#lista .pieza-item:nth-child(3) { animation-delay: .10s; }
#lista .pieza-item:nth-child(4) { animation-delay: .14s; }
#lista .pieza-item:nth-child(5) { animation-delay: .18s; }
#lista .pieza-item:nth-child(6) { animation-delay: .22s; }
.pieza-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--amber);
  transform: scaleY(0);
  transform-origin: center;
  transition: transform .2s var(--ease-out);
}
.pieza-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: #c8cdd4;
}
.pieza-item:hover::before { transform: scaleY(1); }
.pieza-item .pi-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.pieza-item .pi-code {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  letter-spacing: .1em;
  font-size: 1.12rem;
  font-variant-numeric: tabular-nums;
}
.pieza-item .pi-count {
  font-size: .76rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  background: #f1f3f5;
  border-radius: 999px;
  padding: 2px 10px;
}
.pieza-item .pi-count.warn { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
/* Va antes del contador y empuja: en una fila angosta lo que se sacrifica es el
   recuento de reparaciones, no la marca de garantía. */
.pieza-item .pi-gar {
  margin-left: auto;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
  color: var(--ok);
  background: rgba(46, 125, 79, .12);
  border-radius: 999px;
  padding: 2px 9px;
}
.pieza-item .pi-sub {
  color: var(--muted);
  font-size: .9rem;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

/* ---------- listado de clientes ---------- */
.cliente-item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 13px 16px;
  margin-bottom: 10px;
  animation: rise .4s var(--ease-out) backwards;
}
.cliente-item.archivado { opacity: .62; }
.cliente-item .ci-info {
  flex: 1;
  min-width: 180px;
  text-decoration: none;
  color: inherit;
}
.cliente-item .ci-info:hover .ci-nombre { color: var(--amber-deep); }
.cliente-item .ci-nombre {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.12rem;
  letter-spacing: .02em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.cliente-item .ci-tag {
  font-family: 'Barlow', sans-serif;
  font-size: .68rem;
  letter-spacing: .06em;
  background: #f1f3f5;
  color: var(--muted);
  border-radius: 999px;
  padding: 2px 8px;
  vertical-align: middle;
}
.cliente-item .ci-datos {
  color: var(--muted);
  font-size: .88rem;
  margin-top: 2px;
  overflow-wrap: anywhere;
}
/* Tres acciones no entran en una línea de teléfono: se dejan envolver */
.cliente-item .ci-acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.cliente-item .btn { min-height: 38px; padding: 8px 14px; font-size: .92rem; }

/* variante de botón fantasma sobre fondo claro */
.btn.ghost.oscuro {
  border-color: var(--line);
  color: var(--muted);
}
.btn.ghost.oscuro:hover {
  background: #f1f3f5;
  border-color: #c3c9d0;
  color: var(--ink);
}

/* acciones irreversibles */
.btn.ghost.peligro {
  border-color: var(--line);
  color: var(--muted);
}
.btn.ghost.peligro:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}
.btn.peligro-solido {
  background: var(--danger);
  border-color: #9d2f12;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 2px 8px -3px rgba(194, 58, 23, .6);
}
.btn.peligro-solido:hover {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 7px 16px -5px rgba(194, 58, 23, .7);
}

/* ---------- costo de un trabajo ---------- */
.h-costo {
  display: inline-block;
  margin-top: 4px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--amber-soft);
  border-radius: 6px;
  padding: 1px 8px;
  font-size: .9rem;
}

/* Garantía de un trabajo. Vencida no se esconde: se apaga. Que el cliente vea
   que la hubo y cuándo terminó vale más que la prolijidad de ocultarla. */
.h-gar {
  display: inline-block;
  margin-top: 6px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ok);
  background: rgba(46, 125, 79, .1);
  border-radius: 6px;
  padding: 2px 9px;
}
.h-gar.vencida {
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  font-weight: 500;
}

/* ---------- observaciones internas ----------
   Deliberadamente distintas del historial de trabajos: aquélla es una línea de
   tiempo sellada; éstas son apuntes del taller, corregibles, así que se leen
   como fichas sueltas sobre papel de nota y no como hitos de una bitácora. */
.notas {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.notas:empty { display: none; }
.nota {
  position: relative;
  background: #fbfbfc;
  border: 1px solid var(--line);
  border-left: 3px solid #ccd2d9;
  border-radius: var(--radius-sm);
  padding: 10px 12px 11px;
  animation: rise .35s var(--ease-out) backwards;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.nota:hover {
  border-left-color: var(--amber);
  box-shadow: var(--shadow-1);
}
.nota-cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}
.nota-fecha {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.nota-editada {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  font-style: italic;
  color: #98a1ac;
}
.nota-acciones {
  display: flex;
  gap: 2px;
  flex: none;
}
.nota-txt {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}
.nota-edicion textarea {
  min-height: 84px;
  margin-bottom: 10px;
}
.nota-edicion .fila-accion .btn {
  min-height: 38px;
  padding: 8px 14px;
  font-size: .92rem;
}

/* botón de acción reducido a su icono */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}
.icon-btn:hover {
  background: #eef0f3;
  border-color: var(--line);
  color: var(--ink);
}
.icon-btn.peligro:hover {
  background: var(--danger-soft);
  border-color: rgba(194, 58, 23, .35);
  color: var(--danger);
}

/* ---------- estados: vacío y esqueletos de carga ---------- */
.empty {
  text-align: center;
  padding: 30px 14px;
  color: var(--muted);
}
.empty svg { opacity: .35; margin-bottom: 10px; }
.empty p { margin: 0; }

.sk {
  border-radius: 8px;
  background: linear-gradient(90deg, #e7e9ec 25%, #f4f5f7 45%, #e7e9ec 65%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.sk-item { height: 66px; margin-bottom: 10px; border-radius: var(--radius); }
.sk-line { height: 14px; margin-bottom: 12px; }

/* ---------- mensajes (toasts) ---------- */
#toaster {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(92vw, 440px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  padding: 12px 16px;
  font-size: .95rem;
  animation: toast-in .35s var(--spring);
}
.toast svg { flex: none; margin-top: 2px; }
.toast.error { border-left-color: var(--danger); }
.toast.error svg { color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
.toast.ok svg { color: var(--ok); }
.toast.espera { border-left-color: var(--amber-deep); }
.toast.espera svg { color: var(--amber-deep); }
.toast.out { animation: toast-out .25s ease forwards; }

/* ---------- estado de la conexión ---------- */
/* Franja al pie: la diferencia entre "no se guardó" y "se guardó acá y se
   envía solo en cuanto vuelva la señal". */
.barra-conexion {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99;
  padding: 9px 16px;
  text-align: center;
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ink);
  background: var(--amber-hi);
  border-top: 1px solid var(--amber-deep);
  box-shadow: 0 -2px 12px -6px rgba(20, 23, 28, .35);
}
.barra-conexion.pendiente {
  color: #fff;
  background: var(--ok);
  border-top-color: var(--ok);
}
/* Con la franja visible, el aviso flotante se corre para no taparla */
body:has(.barra-conexion:not(.hidden)) #toaster { bottom: 56px; }

/* Trabajo guardado en el dispositivo que todavía no llegó al servidor */
.h-pend {
  color: var(--amber-deep);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.hidden { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- login ---------- */
.login-wrap { max-width: 440px; padding-top: 7vh; }

/* ---------- modal QR ---------- */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(20, 23, 28, .55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
  animation: fade-in .22s ease;
}
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  padding: 24px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  animation: modal-in .4s var(--spring);
}
.modal h2 { justify-content: center; font-size: 1.2rem; }
.modal .qr-box {
  display: inline-flex;
  justify-content: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-1);
  margin: 16px auto;
}
.modal-acciones {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}
.modal .qr-code-text {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: .15em;
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
}

/* ---------- marca del taller ---------- */
.marca {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 16px;
  padding: 14px 18px;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  transition: transform .18s var(--ease-out), box-shadow .18s ease, border-color .18s ease;
}
.marca img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
  flex: none;
}
.marca .m-txt { flex: 1; min-width: 0; }
.marca .m-nombre {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.marca .m-sub {
  color: var(--muted);
  font-size: .84rem;
  margin-top: 1px;
}
.marca .m-chev { color: var(--muted); flex: none; }
.marca.clickable { cursor: pointer; }
.marca.clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: #c8cdd4;
}
.marca.clickable:hover .m-chev { color: var(--ink); }
.marca:disabled { cursor: default; }

/* ---------- tarjeta de presentación del taller ---------- */
.taller-card {
  position: relative;
  text-align: left;
  max-width: 420px;
}
.tc-cerrar {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease;
}
.tc-cerrar:hover { background: #f1f3f5; color: var(--ink); }
.tc-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 34px;
  margin-bottom: 14px;
}
.tc-head img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--line);
  flex: none;
}
.tc-head > div { min-width: 0; }
.tc-nombre {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.tc-rotulo {
  color: var(--muted);
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
  margin-top: 2px;
}
.tc-desc {
  margin: 0 0 14px;
  font-size: .95rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tc-dato {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: .92rem;
}
.tc-dato .tc-k {
  color: var(--muted);
  flex: none;
  min-width: 82px;
}
/* Una dirección larga tiene que envolver dentro de la tarjeta, no salirse */
.tc-dato > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.tc-acciones {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
.tc-acciones .btn { font-size: 1rem; }

/* ---------- interruptores de configuración ---------- */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.switch-row:last-child { border-bottom: 0; }
.switch-row .sw-txt { flex: 1; }
.switch-row .sw-title {
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  font-size: .98rem;
  color: var(--ink);
  margin: 0;
}
.switch-row .sw-desc { color: var(--muted); font-size: .84rem; }

.switch { position: relative; flex: none; width: 48px; height: 28px; }
.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.switch .track {
  position: absolute;
  inset: 0;
  background: #cfd4da;
  border-radius: 999px;
  transition: background-color .22s var(--ease-out);
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(20, 23, 28, .3);
  transition: transform .26s var(--spring);
}
.switch input:checked + .track { background: var(--amber); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px var(--amber-soft); }

/* vista previa de la ficha pública */
.preview {
  background: #f7f8f9;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.preview .pv-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  font-size: .9rem;
}
.preview .pv-row .pv-k { color: var(--muted); flex: none; }
.preview .pv-row b { min-width: 0; text-align: right; overflow-wrap: anywhere; }
.preview .pv-off { opacity: .38; text-decoration: line-through; }

/* ---------- selección múltiple en el listado ---------- */
.pieza-fila { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pieza-fila .pieza-item { flex: 1; margin-bottom: 0; }
.pieza-fila input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex: none;
  accent-color: var(--amber);
  cursor: pointer;
}
.barra-seleccion {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
  animation: rise .3s var(--ease-out);
}
.barra-seleccion .bs-txt { flex: 1; font-size: .9rem; min-width: 120px; }
.barra-seleccion .btn { min-height: 38px; padding: 8px 14px; font-size: .92rem; }

/* ---------- etiqueta de impresión ---------- */
.print-label, .hoja-etiquetas, .print-informe { display: none; }

@media print {
  /* Se saca del flujo todo lo que no es la etiqueta.
     Con visibility:hidden seguía ocupando lugar y salían hojas en blanco. */
  .topbar, main, .modal-back, #toaster { display: none !important; }

  html, body {
    background: #fff !important;
    margin: 0;
    padding: 0;
  }

  /* etiqueta única */
  .print-label {
    display: block;
    width: 62mm;
    padding: 3mm;
    border: 0.6mm solid #000;
    text-align: center;
    background: #fff;
  }
  .print-label .pl-qr { display: flex; justify-content: center; }
  .print-label .pl-qr img, .print-label .pl-qr canvas {
    width: 40mm !important; height: 40mm !important;
  }
  .print-label .pl-code {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 20pt;
    letter-spacing: .12em;
  }
  .print-label .pl-serie { font-size: 9pt; }
  .print-label .pl-taller {
    font-size: 7.5pt;
    margin-top: 0.6mm;
    text-transform: uppercase;
    letter-spacing: .05em;
  }

  /* hoja A4 con varias etiquetas */
  body.modo-hoja .print-label { display: none; }
  body.modo-hoja .hoja-etiquetas {
    display: grid;
    grid-template-columns: repeat(3, 62mm);
    gap: 3mm;
    background: #fff;
  }
  .hoja-etiquetas .he-cell {
    width: 62mm;
    padding: 2.5mm;
    border: 0.5mm solid #000;
    text-align: center;
    background: #fff;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .hoja-etiquetas .he-cell .pl-qr { display: flex; justify-content: center; }
  .hoja-etiquetas .he-cell .pl-qr img,
  .hoja-etiquetas .he-cell .pl-qr canvas {
    width: 34mm !important; height: 34mm !important;
  }
  .hoja-etiquetas .he-cell .pl-code {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 16pt;
    letter-spacing: .1em;
  }
  .hoja-etiquetas .he-cell .pl-serie { font-size: 8pt; }
  .hoja-etiquetas .he-cell .pl-taller {
    font-size: 7pt;
    text-transform: uppercase;
    letter-spacing: .05em;
  }

  /* ---------- ficha impresa para el cliente ----------
     Reproduce en papel lo mismo que muestra el código QR. Se apoya en bordes y
     en el peso de la tipografía, no en fondos de color: muchos navegadores
     imprimen sin gráficos de fondo y el documento tiene que seguir leyéndose.
     El alto lo fija el contenido: una pieza con pocos trabajos ocupa media
     carilla, y una con muchos continúa en la hoja siguiente. */
  body.modo-informe .print-label,
  body.modo-informe .hoja-etiquetas { display: none; }

  /* El margen lateral propio va acá y no en @page, que también rige para las
     etiquetas: un documento pide más aire en los costados que una etiqueta. */
  body.modo-informe .print-informe {
    display: block;
    width: 100%;
    padding: 0 5mm 4mm;
    color: #000;
    background: #fff;
    font-family: 'Barlow', system-ui, sans-serif;
    font-size: 9.5pt;
    line-height: 1.45;
  }

  .print-informe .inf-banda {
    margin: 0 -5mm;
    height: 2.4mm;
    background: repeating-linear-gradient(-45deg,
        var(--amber) 0 3mm, var(--ink) 3mm 6mm);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* encabezado: identidad del taller y código de la pieza */
  .print-informe .inf-cab {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8mm;
    padding: 4mm 0 3.5mm;
    border-bottom: 0.5mm solid #000;
  }
  .print-informe .inf-taller {
    display: flex;
    align-items: flex-start;
    gap: 3.5mm;
    min-width: 0;
  }
  .print-informe .inf-logo {
    width: 16mm;
    height: 16mm;
    object-fit: contain;
    flex: none;
  }
  .print-informe .inf-nombre {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 17pt;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: .02em;
    overflow-wrap: anywhere;
  }
  .print-informe .inf-dato {
    font-size: 8.5pt;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }
  .print-informe .inf-dato .inf-k {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: 7.5pt;
    margin-right: 1.5mm;
  }

  .print-informe .inf-qr-bloque {
    flex: none;
    width: 26mm;
    text-align: center;
  }
  .print-informe .inf-qr img, .print-informe .inf-qr canvas {
    width: 24mm !important;
    height: 24mm !important;
  }
  .print-informe .inf-qr-pie {
    font-size: 6pt;
    line-height: 1.25;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: 0.8mm;
  }

  /* título: código de la pieza y cantidad de reparaciones */
  .print-informe .inf-titulo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6mm;
    padding: 3.5mm 0;
  }
  .print-informe .inf-rotulo {
    font-size: 7.5pt;
    text-transform: uppercase;
    letter-spacing: .14em;
    font-weight: 600;
  }
  .print-informe .inf-codigo {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 24pt;
    line-height: 1.05;
    letter-spacing: .1em;
  }
  .print-informe .inf-cuenta {
    display: flex;
    align-items: center;
    gap: 2.5mm;
    border: 0.4mm solid #000;
    border-radius: 1.5mm;
    padding: 1.8mm 3.5mm;
    flex: none;
  }
  .print-informe .inf-cuenta-num {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 19pt;
    line-height: 1;
  }
  .print-informe .inf-cuenta-lbl {
    font-size: 6.6pt;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: 600;
    line-height: 1.25;
  }

  .print-informe .inf-alerta {
    border: 0.7mm solid #000;
    border-radius: 1.5mm;
    padding: 2mm 3mm;
    margin-bottom: 3.5mm;
    text-align: center;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 11pt;
    text-transform: uppercase;
    letter-spacing: .05em;
  }

  /* datos de la pieza */
  .print-informe .inf-campos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5mm 8mm;
    border-top: 0.2mm solid #000;
    border-bottom: 0.2mm solid #000;
    padding: 3mm 0;
  }
  .print-informe .inf-campo .inf-k {
    display: block;
    font-size: 7pt;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 600;
  }
  .print-informe .inf-campo .inf-v {
    font-weight: 600;
    font-size: 10pt;
    word-break: break-word;
  }

  .print-informe .inf-seccion {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 12pt;
    text-transform: uppercase;
    letter-spacing: .1em;
    margin: 5mm 0 2mm;
  }

  /* historial: una fila por trabajo, con la fecha en columna propia */
  .print-informe .inf-historial {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .print-informe .inf-trabajo {
    display: flex;
    gap: 4mm;
    padding: 2.2mm 0;
    border-top: 0.2mm solid #9a9a9a;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .print-informe .inf-trabajo:first-child { border-top: 0; padding-top: 0; }
  .print-informe .inf-t-fecha {
    flex: none;
    width: 24mm;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 11pt;
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
  }
  .print-informe .inf-t-n {
    display: block;
    font-family: 'Barlow', sans-serif;
    font-weight: 600;
    font-size: 6.6pt;
    text-transform: uppercase;
    letter-spacing: .08em;
  }
  .print-informe .inf-t-cuerpo { flex: 1; min-width: 0; }
  .print-informe .inf-t-trabajo { white-space: pre-wrap; word-break: break-word; }
  .print-informe .inf-t-mec {
    font-size: 8pt;
    margin-top: 0.5mm;
  }
  .print-informe .inf-t-mec .inf-k {
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
    font-size: 7pt;
  }
  .print-informe .inf-vacio { font-size: 9pt; padding: 2mm 0; }

  .print-informe .inf-pie {
    display: flex;
    justify-content: space-between;
    gap: 6mm;
    margin-top: 6mm;
    padding-top: 2mm;
    border-top: 0.2mm solid #000;
    font-size: 7pt;
    text-transform: uppercase;
    letter-spacing: .06em;
  }

  @page { margin: 8mm; }
}

/* ---------- responsive ---------- */
@media (max-width: 480px) {
  .field-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; gap: 0; }
  .tag-code { font-size: 1.7rem; }

  /* En pantallas angostas el margen interior de 24px se come el ancho útil */
  .wrap { padding: 16px 12px 40px; }
  .card { padding: 18px 16px; }
  .tag-head { padding: 16px 16px 6px; }
  .tag-body { padding: 8px 16px 18px; }

  /* Ficha y contador dejan de competir por el ancho: el contador pasa abajo */
  .ring-lbl { max-width: none; }

  /* Las acciones de un cliente bajan a su propia línea y envuelven ahí */
  .cliente-item .ci-acciones { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
