/* ==========================================================================
   RIDE — representación impresa del comprobante electrónico
   Hoja provista por el cliente, acotada bajo .ride-page para que no afecte al
   resto del portafolio (los selectores sueltos table/th/td chocaban con el demo).
   ========================================================================== */

.ride-page {
  --orange: #ff6900;
  --orange-dark: #e95f00;
  --orange-soft: #fff4ec;
  --ink: #20242a;
  --muted: #68707a;
  --line: #d9dde2;
  --panel: #ffffff;
  --page-bg: #eef1f4;

  width: 210mm;
  min-height: 297mm;
  margin: 16px auto;
  padding: 10mm;
  background: #fff;
  box-shadow: 0 16px 48px rgba(22, 28, 35, .14);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  line-height: 1.35;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* El propio .ride-page también, si no el ancho queda en 210mm + 20mm de padding
   = 230mm sobre una hoja de 210mm y la impresión sale reescalada y partida. */
.ride-page,
.ride-page * { box-sizing: border-box; }

.ride-page .top-grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 16px;
  align-items: stretch;
}

.ride-page .brand-column { display: flex; flex-direction: column; gap: 16px; }

.ride-page .brand {
  min-height: 132px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.ride-page .brand-logo {
  width: 122px;
  height: 122px;
  object-fit: cover;
  border-radius: 24px;
  box-shadow: 0 8px 18px rgba(255, 105, 0, .22), inset 0 0 0 1px rgba(255, 255, 255, .8);
}

.ride-page .brand h1 {
  margin: 0;
  font-size: 38px;
  letter-spacing: -1.4px;
  font-weight: 800;
}

.ride-page .brand h1 span { color: #2a2d32; }
.ride-page .brand h1 strong { color: var(--orange); }
.ride-page .brand p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.ride-page .card,
.ride-page .invoice-box,
.ride-page .items-card {
  background: var(--panel);
  border: 1px solid #cfd4d9;
  border-radius: 12px;
}

.ride-page .company-card {
  min-height: 145px;
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 14px;
  align-items: center;
  padding: 18px;
}

.ride-page .section-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ff7d1e, var(--orange));
  border-radius: 50%;
  box-shadow: 0 5px 10px rgba(255, 105, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .65);
}

.ride-page .section-icon svg,
.ride-page .contact-row svg,
.ride-page .ride-footer svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ride-page .section-icon svg { width: 28px; color: #fff; }

.ride-page .data-list { margin: 0; }

.ride-page .data-list > div {
  display: grid;
  /* 190 y no 165: sin la fuente Inter instalada, "Obligado a llevar
     contabilidad:" cae a dos líneas y duplica el alto de la tarjeta. */
  grid-template-columns: 190px 1fr;
  gap: 10px;
  margin: 8px 0;
}

.ride-page .data-list dt { font-weight: 700; }
.ride-page .data-list dd { margin: 0; }

.ride-page .invoice-box {
  padding: 14px 14px 12px;
  overflow: hidden;
}

.ride-page .ruc-row,
.ride-page .invoice-number {
  display: grid;
  grid-template-columns: 100px 1fr;
  align-items: center;
  padding: 3px 10px;
  font-size: 18px;
}

.ride-page .ruc-row span,
.ride-page .invoice-number span { text-align: center; }

.ride-page .invoice-title {
  margin: 6px 0;
  padding: 7px 12px;
  border-radius: 6px;
  background: linear-gradient(180deg, #ff7d1c, var(--orange));
  color: #fff;
  text-align: center;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: .3px;
}

.ride-page .demo-disclaimer {
  margin: 10px 0;
  padding: 7px 9px;
  border: 1px solid rgba(233, 95, 0, .35);
  border-radius: 6px;
  background: var(--orange-soft);
  color: var(--orange-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-align: center;
}

.ride-page .invoice-number { color: var(--orange-dark); }

.ride-page .invoice-meta {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-top: 6px;
  padding: 8px 10px;
}

.ride-page .invoice-meta p { margin: 7px 0; }
.ride-page .invoice-meta strong { font-size: 11px; }
.ride-page .invoice-meta span { font-size: 10px; word-break: break-all; }

.ride-page .two-cols p {
  display: grid;
  grid-template-columns: 105px 1fr;
  align-items: center;
}

.ride-page .access-key { padding: 10px; }
.ride-page .access-key strong { display: block; margin-bottom: 7px; }

.ride-page .access-key small {
  display: block;
  margin-top: 4px;
  text-align: center;
  letter-spacing: .55px;
  font-size: 8px;
}

.ride-page .barcode {
  height: 40px;
  border: 1px solid #d9d9d9;
  background:
    repeating-linear-gradient(
      90deg,
      #111 0 1px,
      transparent 1px 3px,
      #111 3px 5px,
      transparent 5px 7px,
      #111 7px 8px,
      transparent 8px 11px
    );
}

.ride-page .customer-card {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 16px 18px;
}

.ride-page .customer-left {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 14px;
  align-items: center;
  padding-right: 18px;
  border-right: 1px solid var(--line);
}

.ride-page .customer-right {
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 13px;
}

.ride-page .contact-row {
  display: grid;
  grid-template-columns: 28px 90px 1fr;
  gap: 8px;
  align-items: center;
}

.ride-page .contact-row svg { width: 22px; color: var(--orange); }

.ride-page .items-card {
  margin-top: 16px;
  overflow: hidden;
}

.ride-page table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ride-page th, .ride-page td { border-right: 1px solid var(--line); }
.ride-page th:last-child, .ride-page td:last-child { border-right: 0; }

.ride-page th {
  padding: 10px 8px;
  background: linear-gradient(180deg, #ff7c18, var(--orange));
  color: #fff;
  font-size: 12px;
  text-align: center;
}

.ride-page th:nth-child(1) { width: 17%; }
.ride-page th:nth-child(2) { width: 36%; }
.ride-page th:nth-child(3) { width: 9%; }
.ride-page th:nth-child(4) { width: 14%; }
.ride-page th:nth-child(5) { width: 10%; }
.ride-page th:nth-child(6) { width: 14%; }

.ride-page td {
  padding: 12px 10px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
  text-align: center;
}

.ride-page td:nth-child(2) { text-align: left; }
.ride-page td strong { display: block; font-size: 12px; margin-bottom: 3px; }
.ride-page td span { display: block; color: var(--muted); font-size: 10px; }

.ride-page .bottom-grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 16px;
  margin-top: 16px;
}

.ride-page .additional-card,
.ride-page .totals-card { min-height: 170px; padding: 16px; }

.ride-page .additional-card h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  color: var(--orange-dark);
  font-size: 15px;
}

.ride-page .info-badge {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: var(--orange);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 20px;
}

.ride-page .data-list.compact > div { grid-template-columns: 130px 1fr; margin: 12px 0; }

.ride-page .totals-card { display: flex; flex-direction: column; gap: 8px; }

.ride-page .totals-card > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
  font-size: 13px;
}

.ride-page .grand-total {
  margin-top: auto;
  padding: 10px 12px !important;
  border-radius: 6px;
  background: linear-gradient(180deg, #ff7a16, var(--orange));
  color: #fff;
  font-size: 17px !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}

.ride-page .ride-footer {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 3px solid var(--orange);
  display: grid;
  grid-template-columns: 1.5fr .75fr .75fr;
  align-items: center;
  gap: 12px;
  color: #2f343a;
}

.ride-page .footer-note {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
}

.ride-page .ride-footer svg { width: 28px; color: var(--orange); }

.ride-page .footer-link {
  padding-left: 14px;
  border-left: 1px solid var(--line);
  text-align: center;
}

/* 760 y no 850: una A4 mide 794px CSS, así que con 850 tanto la impresión como
   la vista previa a tamaño real caían en el diseño apilado. "screen and" refuerza
   lo mismo para el papel. */
@media screen and (max-width: 760px) {
  .ride-page {
    width: 100%;
    min-height: auto;
    margin: 0;
    padding: 18px;
    box-shadow: none;
  }
  .ride-page .top-grid,
  .ride-page .bottom-grid,
  .ride-page .customer-card { grid-template-columns: 1fr; }
  .ride-page .customer-left { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 16px; }
  .ride-page .customer-right { padding: 16px 0 0; }
  .ride-page .brand { min-height: auto; }
  .ride-page .brand-logo { width: 92px; height: 92px; }
  .ride-page .brand h1 { font-size: 30px; }
  .ride-page .ride-footer { grid-template-columns: 1fr; }
  .ride-page .footer-link { border-left: 0; border-top: 1px solid var(--line); padding: 8px 0 0; }
}

@media print {
  @page { size: A4; margin: 0; }

  html, body { margin: 0; padding: 0; background: #fff; }

  .ride-page {
    width: 210mm;
    /* height auto en vez de min-height 297mm: con min-height cualquier redondeo
       de la impresora empuja una segunda hoja en blanco. */
    min-height: 0;
    height: auto;
    margin: 0;
    padding: 10mm;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
    page-break-after: avoid;
  }
}
