/* optiMAX PWA. Lo único llamativo es la plancha: la plantilla dibujada en «tiza» sobre chapa de acero, con sus
   cotas. El resto, papel claro y tinta, para que se lea bien en el celular y al sol. */

@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("fuentes/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("fuentes/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url("fuentes/barlow-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow SC"; font-weight: 500; font-display: swap; src: url("fuentes/barlow-semi-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow SC"; font-weight: 600; font-display: swap; src: url("fuentes/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); }

:root {
  --papel: #edf0f3;
  --hoja: #ffffff;
  --tinta: #1a2129;
  --gris: #5b6675;
  --linea: #d3d9e0;
  --rojo: #e00000;          /* el rojo del logo: compra y PRO */
  --rojo-osc: #b30000;
  --acero: #3c4752;
  --acero-claro: #4a5662;
  --tiza: #f3f5f1;
  --marca: #ff8f80;
  --pliegue: #ffd166;
  --cota: #b8c6d3;
  --foco: #3b82f6;
  --verde-wa: #1a9e4f;
  --tile: #e9edf2;          /* fondo de las imágenes de figura */
  --num: "Barlow SC", "Barlow", system-ui, sans-serif;
  /* formas: campos y botones redondeados, tarjetas más redondas */
  --radio: 10px;
  --radio-g: 14px;
  --borde-ent: #cdd5de;     /* borde de campos y botones */
  --fondo-ent: #f5f7fa;     /* fondo de los campos dentro de una tarjeta */
  /* color del oficio (lo pone app.js en el body: .of-chapa, .of-herreria, .of-carpinteria); sin oficio, la tinta */
  --of: var(--tinta);
  --of-suave: #e3e8ee;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font: 400 16px/1.4 "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------ cabecera */
.cabecera {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.logo { height: 26px; width: auto; display: block; }
.btn-pro {
  background: var(--rojo); color: #fff; border: 0; border-radius: var(--radio);
  font-weight: 600; font-size: 15px; padding: 9px 14px; min-height: 40px;
}
.btn-pro:hover { background: var(--rojo-osc); }

.aviso-ios {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 0 16px 10px; padding: 10px 12px; background: var(--hoja); border: 1px solid var(--linea); border-radius: 8px;
  font-size: 15px;
}
.aviso-ios p { margin: 0; flex: 1; }
.cerrar {
  border: 0; background: transparent; font-size: 26px; line-height: 1; width: 40px; height: 40px;
  margin: -8px -8px -8px 0; color: var(--gris);
}

/* ------------------------------------------------------------ disposición */
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "figuras" "plancha" "chapas" "medidas" "acciones" "verificar";
}
.col-form, .col-vista { display: contents; }
.figuras { grid-area: figuras; }
#pantalla { min-height: 50vh; }
.plancha { grid-area: plancha; }
.chapas { grid-area: chapas; }
.medidas { grid-area: medidas; }
.acciones { grid-area: acciones; }
.verificar { grid-area: verificar; }

@media (min-width: 900px) {
  .cabecera { padding-inline: 28px; }
  .app {
    grid-template-columns: 400px minmax(0, 1fr);
    grid-template-rows: auto auto auto auto 1fr;
    grid-template-areas:
      "figuras plancha"
      "medidas plancha"
      "medidas chapas"
      "medidas acciones"
      "medidas verificar";
    column-gap: 28px;
    padding: 0 28px 28px;
    align-items: start;
  }
  .plancha { position: sticky; top: 12px; height: min(66vh, 640px); border-radius: var(--radio-g); }
  .figuras { padding-inline: 0; }
  .medidas { padding-inline: 0; }
}

/* ------------------------------------------------------------ inicio */
/* un color por oficio: chapa = azul (el del ícono de optiMAX), herrería = ámbar (el de los módulos del programa de
   PC), carpintería = verde */
.of-chapa { --of: #2563eb; --of-suave: #dce7fd; }
.of-herreria { --of: #c96a05; --of-suave: #fbe9d2; }
.of-carpinteria { --of: #15803d; --of-suave: #d8f0df; }
/* foco de los campos con el color del oficio */
:focus-visible { outline-color: var(--of); }

.inicio { max-width: 720px; margin: 0 auto; padding: 4px 16px 8px; }
.portada {
  position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin: 0 -16px 6px; padding: 22px 16px 18px; overflow: hidden; color: var(--tiza);
  background:
    repeating-linear-gradient(90deg, rgb(255 255 255 / .022) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgb(0 0 0 / .05) 0 2px, transparent 2px 17px),
    linear-gradient(180deg, var(--acero-claro), var(--acero));
}
@media (min-width: 752px) { .portada { margin-inline: 0; border-radius: 10px; padding-inline: 22px; } }
.portada-txt { position: relative; z-index: 1; }
.inicio-tit { margin: 0 0 6px; font-size: 28px; line-height: 1.1; font-weight: 700; color: #fff; }
.inicio-sub { margin: 0; font-size: 16px; color: var(--cota); }
.portada-dib { flex: 0 0 auto; width: 150px; height: auto; margin: -6px -4px -8px 0; }
.portada-dib .tz { fill: none; stroke: var(--tiza); stroke-width: 2.2; stroke-linejoin: round; }
.portada-dib .mk { stroke: var(--marca); stroke-width: 2; }
.portada-dib .ct { stroke: var(--cota); stroke-width: 1.4; fill: none; }
@media (max-width: 380px) { .portada-dib { width: 110px; } }

.oficio h2 {
  display: flex; align-items: center; gap: 8px; margin: 20px 0 8px;
  font-size: 16px; font-weight: 700; color: var(--of);
}
.oficio h2::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--of); }
.mods { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mod {
  display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: var(--radio-g);
  background: var(--of-suave); border: 1px solid transparent; border-left: 5px solid var(--of);
  color: var(--tinta); text-decoration: none;
}
a.mod { box-shadow: 0 1px 0 rgb(0 0 0 / .06); }
a.mod:hover { border-color: var(--of); }
a.mod:active { filter: brightness(.97); }
.mod-ico {
  flex: 0 0 56px; height: 56px; border-radius: 12px; display: grid; place-items: center;
  background: var(--of); color: #fff;
}
.mod-ico svg { width: 38px; height: 38px; }
.mod-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mod-nom { font-weight: 700; font-size: 18px; line-height: 1.2; }
.mod-desc { font-size: 15px; color: var(--gris); line-height: 1.3; }
.mod-off .mod-ico { opacity: .5; }
.mod-off .mod-nom { color: #3c4652; }
.mod-txt { flex: 1 1 auto; }
.mod-ir { flex: none; width: 26px; height: 26px; color: var(--of); }
.pronto {
  align-self: flex-start; margin-top: 6px; padding: 2px 10px; border-radius: 12px;
  font-size: 13px; font-weight: 700; color: var(--of); background: #fff;
}

/* ------------------------------------------------------------ ubicación (← Inicio) */
.migas { display: flex; align-items: center; gap: 10px; padding: 0 16px 8px; font-size: 15px; }
.migas .volver {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; margin-left: -4px;
  border: 1px solid var(--linea); border-radius: 20px; background: var(--hoja); color: var(--tinta);
  font-weight: 600; text-decoration: none;
}
.migas-mod { color: var(--of); font-weight: 600; }
@media (min-width: 900px) { .migas { padding-inline: 28px; } }

/* ------------------------------------------------------------ figura elegida y grilla de figuras */
.figuras { padding: 2px 16px 4px; }
@media (min-width: 900px) { .figuras { padding-inline: 0; } }
.fig-actual {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 6px 12px 6px 6px; text-align: left;
  background: var(--hoja); border: 1px solid var(--linea); border-left: 5px solid var(--of); border-radius: var(--radio-g);
  box-shadow: 0 1px 2px rgb(16 24 40 / .06);
}
.fig-actual img { width: 88px; height: 66px; border-radius: var(--radio); background: var(--tile); flex: none; }
.fig-actual-txt { display: flex; flex-direction: column; gap: 2px; }
.fig-actual-nom { font-weight: 700; font-size: 18px; line-height: 1.2; }
.fig-cambiar { font-size: 15px; color: var(--of); font-weight: 600; }
.grilla-figs {
  list-style: none; margin: 8px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px 8px;
}
.fig {
  position: relative; width: 100%; padding: 0 0 6px; border: 0; background: transparent;
  display: flex; flex-direction: column; align-items: stretch; gap: 5px;
  border-bottom: 3px solid transparent; font-size: 14px; line-height: 1.15; text-align: left; color: var(--tinta);
}
.fig img { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: var(--radio); background: var(--tile); display: block; }
.fig.elegida { border-bottom-color: var(--of); font-weight: 600; }
.fig.elegida img { box-shadow: 0 0 0 2px var(--of); }
.fig-bloq { color: var(--gris); }
.fig-bloq img { opacity: .75; }
.fig .tag { position: absolute; top: 6px; right: 6px; }
@media (min-width: 600px) { .hoja-pro.hoja-figuras { width: 560px; } }

/* ------------------------------------------------------------ la plancha */
.plancha {
  position: relative; height: max(280px, 46vh); overflow: hidden;
  background:
    repeating-linear-gradient(90deg, rgb(255 255 255 / .022) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgb(0 0 0 / .05) 0 2px, transparent 2px 17px),
    linear-gradient(180deg, var(--acero-claro), var(--acero));
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .25), inset 0 1px 0 rgb(255 255 255 / .06);
}
#vista { width: 100%; height: 100%; display: block; touch-action: manipulation; cursor: grab; }
#vista:active { cursor: grabbing; }

/* pantalla completa: la plancha tapa todo y ahí sí toma los gestos */
.plancha.completa {
  position: fixed; inset: 0; z-index: 40; height: auto; border-radius: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.plancha.completa #vista { touch-action: none; }
body.sin-scroll { overflow: hidden; }
#vista .corte { fill: none; stroke: var(--tiza); stroke-width: 1.8; stroke-linejoin: round; }
#vista .marcas { fill: none; stroke: var(--marca); stroke-width: 1.6; }
#vista .plegado { fill: none; stroke: var(--pliegue); stroke-width: 1.4; stroke-dasharray: 7 4; }
#vista .cota { fill: none; stroke: var(--cota); stroke-width: 1.1; }
#vista .aux { fill: none; stroke: var(--cota); stroke-width: .8; opacity: .5; }
#vista text { font-family: var(--num); paint-order: stroke; stroke: var(--acero); stroke-width: 4px; stroke-linejoin: round; }
#vista .txt-cota { fill: var(--cota); font-size: 14px; font-weight: 600; }
#vista .txt-nombre { fill: var(--tiza); font-size: 14px; font-weight: 500; }
#vista .txt-cant { fill: var(--cota); }
.plancha.con-error #vista { opacity: .18; }

.error {
  position: absolute; left: 16px; right: 16px; top: 50%; transform: translateY(-50%);
  max-width: 460px; margin: 0 auto; padding: 12px 14px;
  background: var(--hoja); color: var(--tinta); border-left: 4px solid var(--rojo); border-radius: var(--radio);
  font-size: 15px; box-shadow: 0 6px 20px rgb(0 0 0 / .25);
}
.zoom {
  position: absolute; right: calc(10px + env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 6px;
}
.zoom button {
  width: 40px; height: 40px; border-radius: var(--radio); border: 1px solid rgb(255 255 255 / .16);
  background: rgb(20 26 32 / .55); color: var(--tiza); font-size: 20px; line-height: 1;
}
.zoom .z-ampliar, .z-cerrar { width: auto; padding: 0 14px; font-size: 16px; font-weight: 600; }
.z-cerrar {
  display: none; position: absolute; top: calc(10px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right));
  height: 44px; border-radius: var(--radio); border: 1px solid rgb(255 255 255 / .16);
  background: rgb(20 26 32 / .7); color: var(--tiza);
}
.plancha.completa .z-cerrar { display: block; }
.plancha.completa .z-ampliar { display: none; }
/* con el dedo, en la página solo «Ampliar» (acercar sin poder mover no sirve); con el mouse, todos */
@media (pointer: coarse) {
  .plancha:not(.completa) .z-fino { display: none; }
}
.unidades { position: absolute; left: calc(12px + env(safe-area-inset-left)); bottom: calc(10px + env(safe-area-inset-bottom)); margin: 0; font: 500 13px var(--num); color: var(--cota); }

/* ------------------------------------------------------------ chapas */
.chapas { list-style: none; margin: 0; padding: 4px 16px 0; }
.chapas li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--linea);
}
.ch-nom { font-weight: 600; overflow-wrap: anywhere; }
.ch-cant { font: 600 16px var(--num); justify-self: end; }
.ch-med, .ch-peso { font: 500 15px var(--num); color: var(--gris); }
.ch-peso { justify-self: end; }
.ch-total .ch-nom { font-weight: 400; color: var(--gris); }
.ch-total .ch-peso { color: var(--tinta); font-weight: 600; }
.chapas::after { content: attr(data-nota); display: block; padding: 6px 0 0; font-size: 13px; color: var(--gris); }
@media (min-width: 900px) { .chapas { padding: 10px 0 0; } }

/* ------------------------------------------------------------ medidas */
.medidas { padding: 18px 16px 4px; }
.titulo-figura { margin: 0 0 10px; font-size: 22px; line-height: 1.15; font-weight: 700; }
#form { display: flex; flex-direction: column; }

/* ------------------------------------------------------------ tarjetas (grupos de campos) */
.grupo, #form {
  margin: 0 0 12px; padding: 4px 14px 10px; background: var(--hoja); border-radius: var(--radio-g);
  box-shadow: 0 0 0 1px var(--linea), 0 1px 2px rgb(16 24 40 / .05);
}
#form { padding-top: 6px; }
.grupo > .sub:first-child { margin-top: 10px; }
/* sin raya debajo del último campo a la vista (los escondidos no cuentan) */
.grupo .campo:not(:has(~ .campo:not([hidden]))), #form .campo:not(:has(~ .campo:not([hidden]))) { border-bottom: 0; }
.grupo .entrada, #form .entrada, .grupo .paso, .grupo .p-select { background: var(--fondo-ent); }
.grupo .entrada:focus-within, #form .entrada:focus-within { background: var(--hoja); }
.campo {
  display: grid; grid-template-columns: minmax(0, 1fr) 132px; align-items: center; column-gap: 12px;
  padding: 7px 0; border-bottom: 1px solid var(--linea);
}
.rotulo { font-size: 15px; line-height: 1.2; }
.entrada {
  display: flex; align-items: center; height: 44px; background: var(--hoja);
  border: 1px solid var(--borde-ent); border-radius: var(--radio); overflow: hidden;
}
.entrada:focus-within { border-color: var(--of); box-shadow: 0 0 0 3px var(--of-suave); }
.entrada input {
  flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; padding: 0 4px 0 10px;
  font: 600 18px var(--num); text-align: right; outline: none;
}
.unidad { padding: 0 10px 0 4px; color: var(--gris); font: 500 15px var(--num); }
.campo.mal .entrada { border-color: var(--rojo); box-shadow: 0 0 0 2px rgb(224 0 0 / .15); }
.campo.mal .rotulo { color: var(--rojo-osc); }
.campo-opcion { grid-template-columns: minmax(0, 1fr); row-gap: 6px; }
.segmentos { display: flex; gap: 4px; padding: 3px; border-radius: var(--radio); background: var(--of-suave); }
.segmentos label { flex: 1; position: relative; }
.segmentos input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.segmentos span {
  display: grid; place-items: center; min-height: 38px; padding: 0 8px; font-size: 15px; border-radius: 8px;
}
.segmentos input:checked + span { background: var(--of); color: #fff; font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / .15); }
.segmentos input:focus-visible + span { outline: 3px solid var(--foco); outline-offset: -3px; }
.campo-espesor { margin-top: 10px; border-top: 2px solid var(--linea); }
.campo-espesor .rotulo { font-weight: 600; }

/* ------------------------------------------------------------ acciones PRO */
.acciones { display: flex; gap: 8px; padding: 16px 16px 0; flex-wrap: wrap; }
.btn-bloq {
  flex: 1 1 220px; display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 12px; border: 1.5px solid var(--tinta); border-radius: 24px; background: transparent;
  font-weight: 600; font-size: 15px;
}
.btn-bloq:hover { background: var(--hoja); }
.candado {
  width: 12px; height: 10px; border-radius: 2px; background: currentColor; position: relative; margin-top: 4px;
}
.candado::before {
  content: ""; position: absolute; left: 2px; top: -6px; width: 8px; height: 8px;
  border: 2px solid currentColor; border-bottom: 0; border-radius: 5px 5px 0 0; box-sizing: border-box;
}
.tag { font-size: 12px; font-weight: 700; color: #fff; background: var(--rojo); border-radius: 6px; padding: 1px 6px; }
.verificar { margin: 12px 16px 0; font-size: 14px; color: var(--gris); }
@media (min-width: 900px) { .acciones { padding-inline: 0; } .verificar { margin-inline: 0; } }

/* ------------------------------------------------------------ Barras y tubos */
.app-barras { grid-template-areas: none; }
.b-datos, .b-res { padding: 0 16px; }
.b-res { padding-top: 10px; }
@media (min-width: 900px) {
  .app-barras { grid-template-columns: 400px minmax(0, 1fr); grid-template-rows: auto; }
  .b-datos, .b-res { padding: 0; }
  .b-res { padding-top: 40px; }
}
.sub { margin: 22px 0 6px; font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--of); }
.sub::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--of); }
.fila-tit { display: grid; grid-template-columns: minmax(0, 1fr) 132px 40px; gap: 8px; font-size: 13px; color: var(--gris); padding: 0 2px 4px; }
.piezas { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pieza { display: grid; grid-template-columns: minmax(0, 1fr) 132px 40px; gap: 8px; align-items: center; }
.fila-tit-g, .pieza-g { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 120px 36px; }
.pieza-g .entrada input { padding-left: 6px; }
.paso {
  display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; height: 44px;
  border: 1px solid var(--borde-ent); border-radius: var(--radio); background: var(--hoja); overflow: hidden;
}
.paso button { height: 100%; border: 0; background: var(--of-suave); color: var(--of); font-size: 22px; font-weight: 600; }
.paso button:active { filter: brightness(.94); }
.paso .cant { text-align: center; font: 600 18px var(--num); }
.borrar { width: 40px; height: 44px; border: 0; background: transparent; font-size: 24px; color: var(--gris); }
.piezas-acc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn-sec {
  min-height: 42px; padding: 0 16px; border: 1.5px solid var(--of); border-radius: 21px; background: var(--hoja);
  color: var(--of); font-weight: 600; font-size: 15px;
}
.btn-quieto { border-color: var(--borde-ent); color: var(--gris); }
.btn-prim {
  width: 100%; min-height: 48px; margin-top: 10px; border: 0; border-radius: 24px; background: var(--of); color: #fff;
  font-weight: 700; font-size: 16px;
}
.tilde { display: flex; align-items: center; gap: 8px; padding: 10px 0; font-size: 15px; }
.tilde input { width: 20px; height: 20px; accent-color: var(--of); }
.precio .precio-pro { display: none; width: 100%; margin-top: 6px; }
.precio.bloq .campo, .precio.bloq .tilde { display: none; }
.precio.bloq .precio-pro { display: flex; }
.precio:not(.bloq) .sub .tag { display: none; }
.aviso-demo {
  margin: 0 0 12px; padding: 10px 12px; border-left: 4px solid var(--rojo); background: var(--hoja); border-radius: var(--radio);
  font-size: 15px;
}
.enlace { border: 0; background: none; padding: 0; color: var(--rojo-osc); font-weight: 700; text-decoration: underline; }
.error-txt { margin: 0 0 12px; padding: 10px 12px; border-left: 4px solid var(--rojo); background: var(--hoja); border-radius: var(--radio); font-size: 15px; }
.resumen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dato { background: var(--acero); color: var(--tiza); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; border-top: 3px solid var(--of); }
.dato-v { font: 600 26px/1.05 var(--num); }
.dato-v-chico { font-size: 20px; }
.dato-r { font-size: 13px; line-height: 1.2; color: var(--cota); }
.barras-dib { margin-top: 14px; display: grid; gap: 8px; }
.barra-fila { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 8px; }
.barra-n { font: 600 17px var(--num); text-align: right; }
.barra {
  display: flex; height: 34px; background: var(--acero); border: 2px solid var(--acero); border-radius: 6px; overflow: hidden;
}
.seg {
  flex: none; display: grid; place-items: center; overflow: hidden; white-space: nowrap;
  font: 600 14px var(--num); color: var(--tinta); box-shadow: inset -1px 0 0 rgb(0 0 0 / .35);
}
.seg.chico { font-size: 11px; letter-spacing: -.02em; }
.seg.sobra {
  flex: 1 1 0; min-width: 0; color: var(--gris); font-weight: 500;
  background: repeating-linear-gradient(45deg, #eef1f4 0 5px, #d5dbe2 5px 7px);
}
.lista-corte { margin: 0; padding: 0 0 0 22px; }
.lista-corte li { padding: 6px 0; border-bottom: 1px solid var(--linea); }
.lc-n { font-weight: 700; }
.lc-p { font: 600 16px var(--num); }
.lc-s { display: block; font-size: 14px; color: var(--gris); }
.nota { margin: 6px 0; font-size: 14px; color: var(--gris); }
.tabla { width: 100%; margin-top: 6px; border-collapse: collapse; font: 500 15px var(--num); }
.tabla th { text-align: right; font: 600 13px "Barlow", sans-serif; color: var(--gris); padding: 6px 4px; border-bottom: 1px solid var(--linea); }
.tabla td { text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--linea); }
.tabla th:first-child, .tabla td:first-child { text-align: left; }
.tabla tfoot td { font-weight: 600; }
.hoja textarea {
  width: 100%; padding: 10px; border: 1px solid var(--borde-ent); border-radius: var(--radio); font: 500 17px var(--num); resize: vertical;
}

/* ------------------------------------------------------------ Guillotina */
.g-plancha { margin: 14px 0 0; }
.g-plancha figcaption { font-weight: 700; margin-bottom: 6px; }
.g-plancha svg { width: 100%; height: auto; display: block; border-radius: 6px; }
.g-plancha text { font-family: var(--num); font-weight: 600; fill: var(--tinta); }
.g-corte { stroke: var(--rojo); }
.g-num { fill: var(--rojo); }
.g-num-t { fill: #fff !important; }
.g-cortes { margin-top: 6px; font-size: 15px; }
.g-cortes summary { cursor: pointer; font-weight: 600; color: var(--of); min-height: 36px; display: flex; align-items: center; }
.g-cortes ol { margin: 4px 0 0; padding-left: 0; list-style: none; }
.g-cortes li { padding: 4px 0; border-bottom: 1px solid var(--linea); }

/* ------------------------------------------------------------ Rejas y portones */
.btn-chico { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 17px; }
.sub .btn-chico { margin-left: auto; }
.p-tarjetas { display: grid; gap: 6px; margin-bottom: 4px; }
.p-tipos { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.p-rellenos { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.p-tarjeta {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px 5px;
  border: 2px solid transparent; border-radius: 12px; background: var(--fondo-ent); box-shadow: 0 0 0 1px var(--linea);
  font-size: 13px; line-height: 1.15; text-align: center;
}
.p-tarjeta.elegida { border-color: var(--of); background: var(--of-suave); box-shadow: none; font-weight: 600; }
.p-mini { display: grid; place-items: center; width: 100%; height: 60px; }
.p-mini svg { max-width: 100%; max-height: 60px; width: auto; height: auto; }
.p-tnom .tag { font-size: 10px; padding: 0 3px; vertical-align: 1px; }
.campo-perfil { grid-template-columns: 96px minmax(0, 1fr); }
.p-frente { grid-column: 2; display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.p-frente[hidden] { display: none; }
.p-frente-rot { font-size: 14px; color: var(--gris); }
.p-frente .segmentos { flex: 1; }
.p-frente .segmentos span { min-height: 32px; font: 600 15px var(--num); }
.p-select {
  width: 100%; min-width: 0; height: 44px; padding: 0 8px; border: 1px solid var(--borde-ent); border-radius: var(--radio);
  background: var(--hoja); font: 500 16px "Barlow", sans-serif;
}
/* plegables: tarjeta cerrada con flecha; abierta muestra sus campos */
.p-plegable {
  margin: 0 0 12px; padding: 0 14px; background: var(--hoja); border-radius: var(--radio-g);
  box-shadow: 0 0 0 1px var(--linea), 0 1px 2px rgb(16 24 40 / .05);
}
.p-plegable summary {
  cursor: pointer; min-height: 50px; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px;
  list-style: none; color: var(--of);
}
.p-plegable summary::-webkit-details-marker { display: none; }
.p-plegable summary::after {
  content: ""; margin-left: auto; width: 9px; height: 9px; border: solid var(--of); border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg); transition: transform .15s;
}
.p-plegable[open] summary::after { transform: rotate(-135deg); }
.p-plegable[open] { padding-bottom: 8px; }
.p-plegable .campo:not(:has(~ .campo:not([hidden]))) { border-bottom: 0; }
.p-plegable .entrada { background: var(--fondo-ent); }
.precio.bloq .nota { display: none; }
.p-elev { margin: 14px 0 0; background: var(--hoja); border-radius: var(--radio-g); padding: 8px 8px 4px; box-shadow: 0 0 0 1px var(--linea); }
.p-elev-cab { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.p-luz { flex: 1 1 auto; font: 600 15px var(--num); }
.tilde-chica { padding: 4px 0; }
.p-dibujo { display: flex; justify-content: center; overflow: hidden; touch-action: pan-y; }
.p-dibujo svg, .p-completa-dib svg { display: block; flex: none; }
.p-dibujo [data-m], .p-completa-dib [data-m] { cursor: pointer; }
.p-letra { font-family: var(--num); font-weight: 700; text-anchor: middle; dominant-baseline: central; fill: #1d2833; }
.p-cota { font-family: var(--num); font-weight: 600; fill: #1f7a4d; dominant-baseline: central; }
.p-vano { font-family: var(--num); font-weight: 500; fill: var(--gris); text-anchor: middle; dominant-baseline: central; }
.p-elev figcaption { margin: 2px 0 0; }
.p-aviso { color: var(--rojo-osc); }
.p-lista { list-style: none; margin: 0; padding: 0; }
.p-lista li {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; column-gap: 10px; row-gap: 1px; align-items: center;
  padding: 8px 6px; border-bottom: 1px solid var(--linea); cursor: pointer; border-radius: 4px;
}
.p-lista li.sel { background: #fff3c4; }
.p-chip {
  grid-row: 1 / span 3; width: 34px; height: 30px; border-radius: 4px; display: grid; place-items: center;
  font: 700 15px var(--num); color: #111; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .3);
}
.p-largo { font: 600 19px var(--num); }
.p-largo small { font-size: 13px; color: var(--gris); }
.p-cant { font: 600 18px var(--num); justify-self: end; }
.p-det { grid-column: 2; font-size: 14px; color: var(--tinta); }
.p-croquis { grid-column: 3; grid-row: 2; justify-self: end; }
.p-croquis polygon { fill: #dfe4ea; stroke: var(--tinta); stroke-width: .8; }
.p-uso { grid-column: 2 / span 2; font-size: 13px; color: var(--gris); }
.p-grupo { margin-bottom: 14px; }
.p-perfil { margin: 0 0 6px; font-size: 16px; display: flex; flex-wrap: wrap; column-gap: 8px; }
.p-perfil span { font-weight: 400; color: var(--gris); font-size: 14px; }
.p-grupo .seg { color: #111; cursor: pointer; }
.p-grupo .barras-dib, .p-grupo .barra-fila + .barra-fila { margin-top: 6px; }
.p-datos { margin-top: 10px; font-size: 15px; }
.p-datos p { margin: 4px 0; }
.p-completa { position: fixed; inset: 0; z-index: 40; background: #fff; display: flex; flex-direction: column; }
.p-completa-barra {
  display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
  border-bottom: 1px solid var(--linea); background: var(--papel);
}
.p-completa-barra button { min-width: 44px; height: 44px; border: 1px solid var(--borde-ent); border-radius: var(--radio); background: var(--hoja); font-size: 20px; }
.p-completa-barra .p-c-cerrar { margin-left: auto; padding: 0 14px; font-size: 16px; font-weight: 600; }
.p-completa-dib { flex: 1; overflow: auto; display: flex; -webkit-overflow-scrolling: touch; }
.p-completa-dib svg { margin: auto; }
.perfiles { list-style: none; margin: 4px 0 12px; padding: 0; display: grid; gap: 10px; }
.perfil-ed {
  background: var(--hoja); border: 1px solid var(--linea); border-left: 5px solid var(--of); border-radius: var(--radio-g);
  box-shadow: 0 1px 2px rgb(16 24 40 / .05); overflow: hidden;
}
.perfil-ed.mal { border-left-color: var(--rojo); }
.perfil-ed.abierto { border-color: var(--of); box-shadow: 0 0 0 3px var(--of-suave); }
.pe-cab {
  display: grid; grid-template-columns: minmax(0, 1fr) 24px; align-items: center; column-gap: 8px; width: 100%;
  padding: 11px 12px; border: 0; background: transparent; text-align: left; color: var(--tinta); font: inherit;
}
.perfil-ed.abierto .pe-cab { background: var(--of-suave); }
.pe-tit { font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.pe-res { grid-row: 2; font-size: 14px; color: var(--gris); }
.perfil-ed.mal .pe-res { color: var(--rojo-osc); font-weight: 600; }
.pe-flecha { grid-row: 1 / span 2; grid-column: 2; display: flex; width: 24px; height: 24px; color: var(--of); transition: transform .15s; }
.pe-flecha svg { width: 24px; height: 24px; }
.perfil-ed.abierto .pe-flecha { transform: rotate(180deg); }
.pe-cuerpo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; padding: 12px; }
.pe-cuerpo[hidden] { display: none; }
.pe-c { display: grid; align-content: start; gap: 4px; font-size: 13px; font-weight: 600; color: var(--gris); min-width: 0; }
.pe-ancho, .pe-estado, .pe-borrar, .pe-confirma { grid-column: 1 / -1; }
.pe-c select {
  width: 100%; height: 44px; min-width: 0; border: 1px solid var(--borde-ent); border-radius: var(--radio);
  background: var(--fondo-ent); font: 500 16px "Barlow", sans-serif; padding: 0 8px; color: var(--tinta);
}
.pe-c .entrada { background: var(--fondo-ent); }
.pe-c .entrada:focus-within { background: var(--hoja); }
.pe-c .entrada input { font-size: 17px; text-align: left; padding-left: 12px; }
.pe-c .entrada input::placeholder { color: #a7b0bb; font-weight: 400; font-style: italic; }
.pe-bloq { opacity: .45; }
.hoja .pe-estado { margin: 0; font-size: 14px; color: var(--gris); }
.pe-borrar {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--linea); border-radius: 20px; background: transparent; color: var(--gris); font-size: 14px; font-weight: 600;
}
.pe-borrar svg { width: 18px; height: 18px; flex: none; }
.pe-confirma { padding: 10px 12px; border-radius: var(--radio); background: #fdecec; border: 1px solid #f3b9b9; }
.hoja .pe-confirma p { margin: 0 0 10px; font-size: 15px; }
.pe-confirma-b { display: flex; gap: 8px; justify-content: flex-end; }
.pe-si { min-height: 42px; padding: 0 18px; border: 0; border-radius: 21px; background: var(--rojo-osc); color: #fff; font-weight: 700; font-size: 15px; }
.perfil-mal { color: var(--rojo-osc); font-weight: 600; }
.pe-nuevo { width: 100%; border-style: dashed; }
.pe-nuevo span { font-size: 20px; line-height: 1; }
.pe-pie {
  position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); margin: 6px -18px calc(-18px - env(safe-area-inset-bottom));
  padding: 4px 18px calc(14px + env(safe-area-inset-bottom)); background: var(--hoja); box-shadow: 0 -8px 12px -10px rgb(16 24 40 / .25);
}
.entrada.mal { border-color: var(--rojo); }
@media (min-width: 600px) { .hoja-pro.hoja-perfiles { width: 560px; } }
@media (max-width: 380px) { .p-tipos, .p-rellenos { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ------------------------------------------------------------ imprimir / guardar en PDF (PRO) */
.btn-accion {
  flex: 1 1 220px; display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 12px; border: 0; border-radius: 24px; background: var(--of); color: #fff;
  font-weight: 700; font-size: 16px;
}
.btn-accion:hover { filter: brightness(.92); }
.ico-btn { width: 22px; height: 22px; flex: none; }
.s-opciones { display: grid; gap: 6px; margin: 4px 0 10px; }
.s-op {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 12px;
  border: 1px solid var(--borde-ent); border-radius: 12px; background: var(--hoja); font-size: 15px;
}
.s-op input { width: 20px; height: 20px; flex: none; accent-color: var(--of); }
.s-op:has(input:checked) { border-color: var(--of); background: var(--of-suave); box-shadow: inset 0 0 0 1px var(--of); font-weight: 600; }
.s-desc { font-size: 15px; color: var(--gris); }
.s-ok { font-size: 16px; }
.s-botones { display: flex; gap: 8px; }
.s-botones button { flex: 1; margin-top: 0; }

/* ------------------------------------------------------------ activar la PRO */
.activar { margin-top: 14px; border-top: 1px solid var(--linea); padding-top: 4px; }
.activar summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 700; font-size: 16px; }
.codigo-disp { display: flex; align-items: center; gap: 10px; margin: 2px 0 12px; }
.codigo-disp span { font: 600 22px var(--num); letter-spacing: .04em; }
.activar textarea {
  width: 100%; min-height: 76px; padding: 8px 10px; border: 1px solid var(--borde-ent); border-radius: var(--radio); resize: vertical;
  font: 500 14px ui-monospace, "Cascadia Mono", Consolas, monospace; word-break: break-all;
}
.activar .btn-prim { margin-top: 10px; }
.pro-ok { color: #1f7a4d; font-weight: 600; }
#pro-entrar[aria-disabled="true"] { opacity: .5; pointer-events: none; }
#pro-entrar { margin-top: 6px; background: var(--hoja); color: var(--verde-wa); box-shadow: inset 0 0 0 2px var(--verde-wa); }
#pro-entrar:hover { background: #eaf7ef; }
.pro-espera { font-weight: 600; color: var(--tinta); }
.pro-business { display: block; margin: 10px 0 0; text-align: center; color: var(--verde-wa); font-weight: 600; }
.pro-copiar { margin-top: 8px; }
.pro-copiar summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; font-size: 15px; color: var(--gris); }
.pro-msj {
  margin: 0 0 8px !important; padding: 10px 12px; border-radius: var(--radio); background: var(--fondo-ent);
  font: 600 15px var(--num); user-select: all; word-break: break-word;
}
.aviso-lic { margin: 0; padding: 10px 16px; background: #fff3c4; font-size: 15px; }
.pie-lic { font-weight: 600; color: var(--tinta); }

/* ------------------------------------------------------------ pie */
.pie {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  margin-top: 28px; padding: 16px 16px 24px; border-top: 1px solid var(--linea); font-size: 14px; color: var(--gris);
}
.pie a { color: var(--tinta); font-weight: 600; }
.btn-instalar { border: 1px solid var(--tinta); background: transparent; border-radius: 18px; padding: 6px 14px; font-weight: 600; }
@media (min-width: 900px) { .pie { padding-inline: 28px; } }

/* ------------------------------------------------------------ hoja de compra */
.hoja-pro {
  border: 0; padding: 0; background: transparent; max-width: none; max-height: none;
  width: 100%; margin: auto auto 0; color: var(--tinta);
}
.hoja-pro::backdrop { background: rgb(15 20 26 / .55); }
.hoja {
  position: relative; background: var(--hoja); border-radius: 14px 14px 0 0;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto;
}
.hoja-pro[open] .hoja { animation: subir .22s ease-out; }
@keyframes subir { from { transform: translateY(24px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .hoja-pro[open] .hoja { animation: none; } }
@media (min-width: 600px) {
  .hoja-pro { width: 460px; margin: auto; }
  .hoja { border-radius: var(--radio-g); }
}
.hoja .cerrar { position: absolute; right: 14px; top: 14px; margin: 0; }
.hoja h2 { margin: 0 40px 6px 0; font-size: 24px; font-weight: 700; }
.hoja p { margin: 0 0 12px; }
.pro-figuras-tit { color: var(--gris); font-size: 15px; }
.pro-figuras {
  list-style: none; margin: 0 0 16px; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 8px;
}
.pro-figuras li { display: flex; flex-direction: column; gap: 4px; font-size: 12px; line-height: 1.15; color: var(--gris); }
.pro-figuras img { width: 100%; height: auto; border-radius: 8px; background: var(--tile); }
.btn-whatsapp {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; border-radius: 26px; background: var(--verde-wa); color: #fff;
  font-weight: 700; font-size: 17px; text-decoration: none;
}
.btn-whatsapp svg { width: 24px; height: 24px; fill: currentColor; }
.btn-whatsapp:hover { background: #158a43; }
.enlace-web { display: block; text-align: center; margin-top: 12px; color: var(--tinta); font-weight: 600; }

/* ------------------------------------------------------------ imprimir: es PRO */
@media print {
  body > * { display: none !important; }
  body::after {
    content: "Imprimir la plantilla a escala es de optiMAX PRO. Más información en optimax.lat";
    display: block; padding: 40px; font: 600 18px "Barlow", sans-serif;
  }
}

/* guillotina: material a todo el ancho (el nombre de la plancha es largo) */
.campo-ancho { grid-template-columns: minmax(0, 1fr); row-gap: 6px; }
.campo-ancho .p-select { width: 100%; }
.g-pl-res { margin: 0 0 4px; }

/* ------------------------------------------------------------ trabajos (proyectos) */
.trabajo-barra { margin: 0 0 12px; }
.trabajo-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 8px 12px;
  border: 1px solid var(--linea); border-left: 5px solid var(--of); border-radius: var(--radio-g); background: var(--hoja);
  color: var(--tinta); text-align: left; box-shadow: 0 1px 2px rgb(16 24 40 / .05);
}
.trabajo-btn .t-ico { display: flex; flex: none; width: 26px; height: 26px; color: var(--of); }
.trabajo-btn .t-ico svg { width: 26px; height: 26px; }
.t-txt { display: grid; min-width: 0; flex: 1; }
.t-rot { font-size: 12px; font-weight: 600; color: var(--gris); text-transform: uppercase; letter-spacing: .04em; }
.t-nom { font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-ir { flex: none; font-size: 14px; font-weight: 600; color: var(--of); }
.trabajo-btn .candado { flex: none; }
.t-campo { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--gris); }
.t-campo .entrada input { text-align: left; padding-left: 12px; font-size: 17px; }
.t-acc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.t-acc .btn-sec { flex: 1 1 auto; }
.hoja .t-nota { margin: 8px 0 0; font-size: 13px; }
.t-confirma { margin-top: 12px; padding: 10px 12px; border-radius: var(--radio); background: #fdecec; border: 1px solid #f3b9b9; }
.t-confirma[hidden] { display: none; }
.hoja .t-confirma p { margin: 0 0 10px; font-size: 15px; }
.hoja .t-aviso { margin: 12px 0 0; font-size: 14px; color: var(--gris); }
.t-sub { margin: 18px 0 8px; font-size: 16px; font-weight: 700; color: var(--of); }
.t-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.t-item { display: flex; align-items: stretch; border: 1px solid var(--linea); border-radius: var(--radio); background: var(--hoja); overflow: hidden; }
.t-item.t-actual { border-color: var(--of); box-shadow: 0 0 0 2px var(--of-suave); }
.t-abrir { flex: 1; display: grid; gap: 2px; padding: 10px 12px; border: 0; background: transparent; text-align: left; color: var(--tinta); min-width: 0; }
.t-abrir b { font-size: 16px; overflow-wrap: anywhere; }
.t-abrir span { font-size: 13px; color: var(--gris); }
.t-borrar { flex: none; width: 48px; border: 0; border-left: 1px solid var(--linea); background: transparent; color: var(--gris); }
.t-borrar svg { width: 20px; height: 20px; }
@media (min-width: 600px) { .hoja-pro.hoja-trabajos { width: 520px; } }

/* ------------------------------------------------------------ vista 3D de portones */
.p-3d .p-completa-barra button { padding: 0 14px; font-size: 16px; font-weight: 600; }
.p-3d-lienzo { flex: 1; position: relative; min-height: 0; touch-action: none; background: #eef1f4; }
.p-3d-lienzo canvas { display: block; touch-action: none; }
.p-3d-cargando { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; }
.p-3d-lienzo .error-txt { margin: 24px 16px; }
.p-3d-ayuda {
  position: absolute; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  margin: 0; padding: 6px 12px; border-radius: 16px; background: rgb(255 255 255 / .85); color: var(--gris);
  font-size: 13px; white-space: nowrap; pointer-events: none;
}
.p-3d-entorno {
  position: absolute; left: 50%; bottom: calc(48px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(360px, calc(100% - 24px)); box-shadow: 0 1px 4px rgb(0 0 0 / .18);
}
.p-3d-entorno span { min-height: 40px; }
.p-3d-aviso {
  position: absolute; left: 12px; right: 12px; top: calc(76px + env(safe-area-inset-top)); margin: 0; padding: 8px 12px;
  border-radius: var(--radio); background: #fff4e5; border: 1px solid #f3c98b; color: #7a4a00; font-size: 14px;
}
