/* Estilos de la aplicación que no son de Tailwind.

   Es el segundo bloque <style> de index.html, copiado tal cual. La
   herramienta de extracción de la fase 5 solo recogió el primero —el de
   Tailwind— y este se quedó por el camino: sin él, el informe de «Imprimir»
   aparecía al final de la página en vez de imprimirse solo, y faltaban el
   rayado de la leyenda, los avisos animados y el tablero activo resaltado. */

html { -webkit-text-size-adjust: 100%; }
body { background: #f1f5f9; }
.tabular-nums { font-variant-numeric: tabular-nums; }
.swatch { width: 22px; height: 22px; padding: 0; border: 1px solid #cbd5e1; border-radius: 6px; background: none; cursor: pointer; }
.swatch::-webkit-color-swatch-wrapper { padding: 0; }
.swatch::-webkit-color-swatch { border: none; border-radius: 5px; }
.swatch::-moz-color-swatch { border: none; border-radius: 5px; }
#canvas-wrap { background:
    radial-gradient(circle at 1px 1px, rgba(100,116,139,.13) 1px, transparent 0) 0 0 / 16px 16px, #f8fafc; }
#cv { touch-action: pan-x pan-y; }
#cv.pan { cursor: grab; } #cv.panning { cursor: grabbing; }
.thumb[aria-current="true"] { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.25); }
.toast { transform: translateY(8px); opacity: 0; transition: all .22s ease; }
.toast.show { transform: none; opacity: 1; }
.hatch-w { background: repeating-linear-gradient(135deg, rgba(71,85,105,.35) 0 1px, rgba(148,163,184,.18) 1px 5px); }
.hatch-t { background: repeating-linear-gradient(135deg, rgba(51,65,85,.6) 0 1px, rgba(71,85,105,.3) 1px 4px); }
details > summary { list-style: none; } details > summary::-webkit-details-marker { display: none; }
details[open] .chev { transform: rotate(90deg); }
dialog::backdrop { background: rgba(15,23,42,.55); }
input[type=color] { -webkit-appearance: none; appearance: none; }

/* ---------- Cantos ----------
   El selector es una rejilla de 3 x 3: la pieza en el centro, con el Largo en
   horizontal, y un botón por lado. La raya de cada lado se dibuja con ::after,
   pegada a la pieza, en naranja si lleva canto: el mismo naranja que el plano
   (EDGE_COLOR en render.js y en reports/colors.py). */
.edge-pick { display: grid; grid-template-columns: 24px 64px 24px; grid-template-rows: 17px 34px 17px; flex: none; }
.edge-pick > button { position: relative; margin: 0; padding: 0; border: 0; background: none; cursor: pointer; }
.edge-pick > button:focus-visible { outline: 2px solid rgba(245, 158, 11, .7); outline-offset: 1px; border-radius: 3px; }
.edge-pick .edge-core { grid-area: 2 / 2; border: 1px solid #cbd5e1; border-radius: 3px; background: #f8fafc; }
.edge-pick .edge-core:hover { background: #fff7ed; }
.edge-side { display: flex; font: 600 10.5px/1 Inter, system-ui, sans-serif; color: #94a3b8; }
.edge-side:hover { color: #475569; }
.edge-side[aria-pressed="true"] { color: #c2410c; }
.edge-side::after { content: ""; position: absolute; border-radius: 2px; background: #cbd5e1; transition: background .12s; }
.edge-side:hover::after { background: #94a3b8; }
.edge-side[aria-pressed="true"]::after { background: #ea580c; }
.edge-superior { grid-area: 1 / 2; align-items: flex-start; justify-content: center; }
.edge-inferior { grid-area: 3 / 2; align-items: flex-end; justify-content: center; }
.edge-izquierdo { grid-area: 2 / 1; align-items: center; justify-content: flex-start; }
.edge-derecho { grid-area: 2 / 3; align-items: center; justify-content: flex-end; }
.edge-superior::after { left: 0; right: 0; bottom: 0; height: 4px; }
.edge-inferior::after { left: 0; right: 0; top: 0; height: 4px; }
.edge-izquierdo::after { top: 0; bottom: 0; right: 0; width: 4px; }
.edge-derecho::after { top: 0; bottom: 0; left: 0; width: 4px; }
/* En la tabla de piezas: sin rótulos y más pequeño. */
.edge-pick-sm { grid-template-columns: 7px 24px 7px; grid-template-rows: 6px 14px 6px; }
.edge-pick-sm .edge-superior::after, .edge-pick-sm .edge-inferior::after { height: 3px; }
.edge-pick-sm .edge-izquierdo::after, .edge-pick-sm .edge-derecho::after { width: 3px; }
/* Muestra de la leyenda del visor: una pieza con el canto arriba. */
.lg-edge { background: hsl(38, 72%, 80%); box-shadow: inset 0 3px 0 #ea580c; }

/* ---------- Solo lectura ----------
   La demostración: en /demo/, y en /app/ para su dueño. Lo que lleva
   data-edicion desaparece; las tablas se quedan a la vista, con los campos
   bloqueados (ui.js, bloquearFilas), y se leen como texto, no como campos
   apagados: sin el gris de lo deshabilitado, sin el borde al pasar por encima
   y sin la mano de lo que se puede pulsar. El visor sigue entero. */
#app[data-solo-lectura] [data-edicion] { display: none !important; }
#app[data-solo-lectura] .cell,
#app[data-solo-lectura] .edge-pick { pointer-events: none; }
#app[data-solo-lectura] .chk:disabled,
#app[data-solo-lectura] .swatch:disabled { opacity: 1; cursor: default; }
#app[data-solo-lectura] [data-set]:disabled { background: #f8fafc; opacity: 1; }

/* ---------- Informe imprimible ---------- */
#print-root { display: none; }
.r-page { font-family: Inter, system-ui, sans-serif; color: #0f172a; font-size: 10px; line-height: 1.35; }
.r-page + .r-page { break-before: page; page-break-before: always; }
.r-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; border-bottom: 2px solid #0f172a; padding-bottom: 6px; margin-bottom: 10px; }
.r-head h1 { font-size: 17px; margin: 0; font-weight: 700; }
.r-head h1 small { font-size: 12px; color: #b45309; margin-left: 6px; }
.r-head p { margin: 2px 0 0; color: #64748b; }
.r-brand { font-weight: 700; color: #b45309; white-space: nowrap; }
/* Todos los indicadores en una fila, sean seis o siete (el de canto solo sale si hay). */
.r-kpis { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; margin-bottom: 8px; }
.r-kpi { border: 1px solid #e2e8f0; border-radius: 6px; padding: 5px 8px; }
.r-kpi span { display: block; color: #64748b; font-size: 7.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.r-kpi b { display: block; font-size: 14px; }
.r-kpi i { font-style: normal; color: #64748b; font-size: 8px; }
.r-page h2 { font-size: 11.5px; margin: 10px 0 4px; }
.r-meta { color: #475569; margin: 0 0 6px; }
.r-tbl { width: 100%; border-collapse: collapse; }
.r-tbl th { text-align: left; background: #f1f5f9; font-size: 8px; text-transform: uppercase; letter-spacing: .04em; color: #475569; padding: 3px 5px; border-bottom: 1px solid #cbd5e1; }
.r-tbl td { padding: 2.5px 5px; border-bottom: 1px solid #e2e8f0; }
.r-tbl .n, .r-tbl th.n { text-align: right; font-variant-numeric: tabular-nums; }
.r-tbl tr { break-inside: avoid; }
.r-img { width: 100%; max-height: 128mm; object-fit: contain; display: block; margin: 2px 0 6px; }
.r-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.2); }
.r-edge { display: inline-block; width: 14px; height: 3px; background: #ea580c; vertical-align: middle; margin-right: 5px; }
.r-nw { white-space: nowrap; }
.r-warn { border: 1px solid #fecdd3; background: #fff1f2; color: #9f1239; padding: 6px 8px; border-radius: 6px; margin-top: 8px; }
.r-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.r-sheet { display: grid; grid-template-columns: minmax(0, 1fr) 96mm; gap: 6mm; align-items: start; }
.r-sheet .r-img { max-height: 158mm; }
.r-sm td { padding: 1.6px 4px; font-size: 8.5px; } .r-sm th { padding: 2.5px 4px; }
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  html, body { background: #fff !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  #print-root * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
