:root {
  --block-w: 200mm;   /* 20 cm */
  --block-h: 120mm;   /* 12 cm */
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 10pt/1.2 "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #000; /* texto negro fuerte */
  background: #fff;
}

.app { max-width: 1100px; margin: 16px auto; padding: 12px; }

.controls {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.controls input { padding: 6px 10px; font-size: 10.5pt; }
.controls button, .controls a.button {
  padding: 8px 12px; font-size: 10.5pt; cursor: pointer;
  border: 1px solid #000;
  background: #e8e8e8;
  border-radius: 8px;
  text-decoration: none;
  color: #000;
}
.controls .minor { background: #dfe2f5; }
.controls .danger { background: #ffcccc; }

/* ==== Bloque 200×120 ==== */
.ticket {
  width: var(--block-w);
  height: var(--block-h);
  margin: 0 auto;
  padding: 5mm;
  border: 1.2px solid #000; /* más oscuro */
  background: #f8f8f8; /* leve gris para dar contraste */
  display: flex;
  flex-direction: column;
  gap: 3.5mm;
  overflow: hidden;
}

/* Encabezado + logo */
.head {
  display: flex; align-items: center; gap: 5mm;
  padding-bottom: 2mm;
  border-bottom: 1.2px solid #000; /* línea más oscura */
}
.logo {
  width: 18mm; height: auto; display: block;
}
.brand h1 { font-size: 13pt; margin: 0; line-height: 1.05; color: #000; }
.brand .sub { color: #000; font-weight: 700; margin-top: 1px; font-size: 9.5pt; }
.nroTrabajo { margin-top: 2px; font-size: 10.5pt; font-weight: 800; color: #000; }

/* Filas e inputs */
.row { display: flex; gap: 5mm; align-items: center; }
.row.two > label { flex: 1; }
.row > label { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.row input {
  padding: 5px 8px;
  font-size: 10pt;
  border: 1px solid #000; /* más visible */
  border-radius: 7px;
  background: #fff;
  color: #000;
}

/* RX más compacto */
.rx { display: flex; flex-direction: column; gap: 3mm; }
.rx-row { display: flex; gap: 4mm; flex-wrap: wrap; }
.rx-item { display: flex; flex-direction: column; gap: 2px; width: 95px; }
.rx-item input {
  padding: 5px 7px;
  font-size: 10pt;
  border: 1px solid #000;
  border-radius: 7px;
  background: #fff;
  color: #000;
}

/* Impresión */
@page { size: A4; margin: 8mm; }
@media print {
  .controls { display: none !important; }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ticket { border: 1.2px solid #000; background: #f8f8f8; color: #000; }
}

/* ===== Overlay ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 9999;
  font-size: 14pt;
  font-weight: 600;
  color: #000;
}
.overlay.hidden { display: none; }
.spinner {
  width: 40px; height: 40px;
  border: 4px solid #333; border-top: 4px solid #000;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { 0%{transform:rotate(0)} 100%{transform:rotate(360deg)} }

/* ===== Modal escaneo ===== */
.scan-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: none; align-items: center; justify-content: center; z-index: 10000;
}
.scan-modal.open { display: flex; }
.scan-box {
  background: #000; color: #fff; width: min(640px, 96vw);
  border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px;
}
.scan-head { display: flex; align-items: center; justify-content: space-between; }
.scan-head h3 { margin: 0; font-size: 14pt; }
.scan-close {
  border: 0; background: #333; color: #fff;
  border-radius: 8px; padding: 6px 10px; cursor: pointer;
}
.scan-video { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 10px; }
.scan-hint { font-size: 10pt; color: #bbb; }
