/* ============================================================
   MXP Planos — identidad Max Power (misma que mxpes.com y la
   App de Operaciones): marco oscuro --mp-deep, superficies
   celestes, gradiente eléctrico como firma, cyan SOLO en oscuro.
   ============================================================ */
:root {
  --mp-navy:   #1B3C8C;
  --mp-blue:   #2A5BD7;
  --mp-cyan:   #22E8E0;   /* solo sobre fondos oscuros */
  --mp-lime:   #8CF06A;
  --mp-yellow: #EFE22E;
  --mp-deep:   #071A2E;
  --mp-grad: linear-gradient(96deg,#1B3C8C 0%,#2A5BD7 24%,#22E8E0 58%,#8CF06A 80%,#EFE22E 100%);
  --mp-sky-1: #F6FCFF;
  --mp-sky-2: #E8F3FA;
  --mp-sky-3: #DCEEF7;
  --mp-card:  #FFFFFF;
  --mp-line:  #D6E7F1;
  --mp-ink:   #0B2036;
  --mp-ink-2: #4D6A83;
  --mp-teal-text: #0D7D92;
  --mp-danger: #B3383B;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: system-ui, -apple-system, "Segoe UI Variable", "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  color: var(--mp-ink);
  background: var(--mp-sky-2);
}

#app { display: flex; flex-direction: column; height: 100vh; }

/* ===== Toolbar (marco oscuro con la firma de gradiente) ===== */
/* DOS FILAS (Edgar, 04/09: "las barras donde están todas las herramientas
   no podrían estar ordenadas y diferenciadas… cada vez que quiero buscar un
   tool se me pierde entre tanto, como está Bluebeam"). Arriba el MANDO
   (marca, ajustes, deshacer, archivo); debajo, el muelle superior con las
   barras movibles (ver BARRAS MOVIBLES más abajo). */
#toolbar {
  display: flex; flex-direction: column; align-items: stretch; gap: 0;
  background: var(--mp-deep); color: #E8F3FA;
  padding: 0; flex: none;
  border-bottom: 3px solid;
  border-image: linear-gradient(96deg,#1B3C8C 0%,#2A5BD7 24%,#22E8E0 58%,#8CF06A 80%,#EFE22E 100%) 1;
}
.tbRow { display: flex; align-items: center; gap: 8px; padding: 3px 12px; }
/* la fila 1 es fija: si no cabe, se parte en dos líneas (nunca se corta ni se desliza) */
.tbRow1 { min-height: 46px; flex-wrap: wrap; row-gap: 2px; }
/* ===== BARRAS MOVIBLES (v30.O, estilo Bluebeam) =====
   Tres barras — Mis herramientas, Grupos, Navegar y zoom — que viven en uno
   de cuatro "muelles" (docks): arriba (bajo la fila 1), abajo (sobre la barra
   de estado), izquierda o derecha del lienzo (verticales). El JS las pinta
   según el orden guardado; aquí solo está el aspecto. */
.dock { display: flex; background: var(--mp-deep); color: #E8F3FA; flex: none; }
.dock.horiz { flex-wrap: wrap; align-items: stretch; padding: 0 6px; border-top: 1px solid rgba(255,255,255,.09); }
#dockBottom.horiz { border-top: none; border-top: 3px solid; border-image: linear-gradient(96deg,#1B3C8C 0%,#2A5BD7 24%,#22E8E0 58%,#8CF06A 80%,#EFE22E 100%) 1; }
.dock.vert { flex-direction: column; align-items: center; width: 68px; padding: 6px 0; overflow-y: auto; }
#dockLeft.vert { border-right: 1px solid rgba(255,255,255,.09); }
#dockRight.vert { border-left: 1px solid rgba(255,255,255,.09); }
.dock:empty { display: none; }
/* muelle vertical con más de lo que cabe: flecha pegada abajo mientras haya más */
.dock.vert.mas::after { content: '▾'; position: sticky; bottom: 0; flex: none; width: 100%; height: 20px; margin-top: -20px; text-align: center; font-size: 13px; line-height: 20px; color: var(--mp-cyan); background: linear-gradient(180deg, rgba(7,26,46,0), var(--mp-deep) 70%); pointer-events: none; }
body.touch .dock.vert::-webkit-scrollbar { -webkit-appearance: none; width: 5px; }
/* mientras arrastras una barra, hasta los muelles vacíos se ven, para soltarla ahí */
body.moviendoBarra .dock { display: flex; outline: 2px dashed rgba(34,232,224,.35); outline-offset: -3px; }
body.moviendoBarra .dock.horiz:empty { min-height: 48px; }
body.moviendoBarra .dock.vert:empty { min-width: 68px; }
body.moviendoBarra .dock.drop { outline-color: var(--mp-cyan); background: rgba(34,232,224,.08); }
.barra {
  display: grid; grid-template-columns: 16px minmax(0, 1fr); grid-template-rows: 13px auto;
  align-items: center; column-gap: 3px; padding: 2px 10px 3px 4px; position: relative; flex: none;
}
.dock.horiz .barra + .barra::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 6px; width: 1px; background: rgba(255,255,255,.14); }
.dock.vert .barra { grid-template-columns: auto; grid-template-rows: 14px auto; padding: 2px 4px 8px; justify-items: center; }
.dock.vert .barra + .barra::before { content: ''; position: absolute; top: 0; left: 8px; right: 8px; height: 1px; background: rgba(255,255,255,.14); }
.barra .grip {
  grid-row: 1 / 3; grid-column: 1; align-self: stretch; display: flex; align-items: center; justify-content: center;
  width: 16px; border-radius: 6px; cursor: grab; color: rgba(232,243,250,.35); font-size: 12px; letter-spacing: -3px;
  touch-action: none; -webkit-user-select: none; user-select: none; transition: background .15s, color .15s;
}
.barra .grip:hover { background: rgba(255,255,255,.1); color: #E8F3FA; }
.dock.vert .barra .grip { grid-row: 1; grid-column: 1; width: 52px; height: 14px; letter-spacing: -3px; }
.dock.vert .barra .grip::before { content: '⋯'; font-size: 16px; line-height: 0; }
.dock.vert .barra .grip span { display: none; }
.barra .bLbl { grid-row: 1; grid-column: 2; cursor: grab; touch-action: none; font-size: 8.5px; letter-spacing: .11em; text-transform: uppercase; color: rgba(232,243,250,.45); padding-left: 3px; white-space: nowrap; line-height: 13px; }
.dock.vert .barra .bLbl { display: none; }
.barra .bBtns { grid-row: 2; grid-column: 2; display: flex; align-items: center; gap: 3px; }
/* una barra más ancha que el muelle se parte en filas, nunca se corta */
.dock.horiz .barra { max-width: 100%; min-width: 0; }
.dock.horiz .barra .bBtns { flex-wrap: wrap; row-gap: 3px; }
.dock.vert .barra .bBtns { grid-row: 2; grid-column: 1; flex-direction: column; gap: 4px; }
.dock.abajo .barra { grid-template-rows: auto; padding: 4px 10px 4px 4px; }
.dock.abajo .barra .bLbl { display: none; }
.dock.abajo .barra .grip, .dock.abajo .barra .bBtns { grid-row: 1; }
.barra .sep { width: 1px; height: 30px; background: rgba(255,255,255,.14); margin: 0 5px; }
.dock.vert .barra .sep { width: 30px; height: 1px; margin: 4px 0; }
/* el fantasma del arrastre es un muelle igual al de origen (mismas clases) con la barra clonada dentro */
.dock.fantasma { position: fixed; z-index: 400; pointer-events: none; opacity: .88; padding: 0 !important; border: none !important; outline: none !important; flex-wrap: nowrap; overflow: visible; border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.45); transform: scale(.97); }
.dock.fantasma .barra { max-width: none; }
.brand { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.brand img { height: 30px; width: auto; filter: drop-shadow(0 0 8px rgba(34,232,224,.3)); }
.brand b {
  font-weight: 650; letter-spacing: .5px; font-size: 14.5px; text-transform: lowercase;
  background: var(--mp-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand span { color: #E8F3FA; font-weight: 300; margin-left: 2px; font-size: 14.5px; }

.tgroup { display: flex; align-items: center; gap: 4px; border-left: 1px solid rgba(255,255,255,.14); padding-left: 10px; flex: none; }
/* Los selectores de tipo de pared y tamaño de puerta se quedaban FUERA de la
   pantalla en portátil (medido: x=1496 con ventana de 1290) — invisibles, y
   con ellos el arreglo del tamaño de puerta. Ahora van al frente y pegados. */
/* en iPad el grupo pegajoso tapaba las herramientas al deslizar la barra (auditoría 31/08) */
body.touch #grpAjustes select { max-width: 108px; }
#grpAjustes select { max-width: 150px; }
/* deshacer/rehacer y archivo: cajitas de icono + nombre, parejas con las herramientas */
#grpHist { border-left: none; padding-left: 0; gap: 3px; }
#grpHist button { flex-direction: column !important; min-width: 40px; height: 44px; padding: 3px 8px !important; font-size: 16px !important; }
#grpArchivo { gap: 3px; }
#grpAjustes { gap: 3px; }
#grpAjustes button { flex-direction: column !important; gap: 0 !important; min-width: 46px; height: 44px; padding: 3px 7px !important; font-size: 15px !important; }
#grpAjustes button label { font-size: 9px; margin-top: 2px; }
#grpArchivo button { flex-direction: column !important; gap: 0 !important; min-width: 50px; height: 44px; padding: 3px 7px !important; font-size: 15px !important; }
#grpArchivo button label { font-size: 9px; margin-top: 2px; }
#btnPng { font-weight: 650; font-size: 12.5px !important; letter-spacing: .02em; }
.tgroup.right { margin-left: auto; }

#toolbar button, .dock button, #toolbar label.tbtn {
  background: transparent; color: #E8F3FA; border: 1px solid transparent;
  border-radius: 10px; padding: 5px 10px; cursor: pointer; font-size: 15px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1.15; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
/* TAMAÑO DE LAS BARRAS (E7b, Edgar 15/09: "hacerlas más grandes para que
   quepa todo bien"). Una sola perilla, --tb, escala cajitas, iconos y letra:
   0.85 chicas · 1 normales · 1.25 grandes. Se elige en Organizar barras. */
body { --tb: 1; }
body[data-barras="chicas"] { --tb: 0.85; }
body[data-barras="grandes"] { --tb: 1.25; }
/* cada herramienta es una cajita pareja, con relieve y con aire */
.barra button.tool, .barra button.grpBtn, .barra button.act {
  min-width: calc(52px * var(--tb)); height: calc(46px * var(--tb));
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.025));
  border-color: rgba(255,255,255,.13);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 1px 3px rgba(0,0,0,.3);
}
.barra button.tool:hover, .barra button.grpBtn:hover, .barra button.act:hover {
  background: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,.06));
  border-color: rgba(255,255,255,.25);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 5px 12px rgba(0,0,0,.4);
}
/* botones de acción (no-herramienta) también como cajitas */
#toolbar .tgroup button:not(.tool) {
  background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12);
  flex-direction: row; gap: 6px; font-size: 13px; height: 38px; padding: 4px 12px;
}
/* Barras, Símbolos y Panel son cajitas de icono + nombre como las de
   archivo. Ojo con la especificidad: la regla de .tgroup button gana a un
   id suelto, así que van con el mismo peso o el contenido se sale (medido
   05/09: el botón media 38 px y su contenido 45 — el nombre "Barras"
   quedaba por debajo de la caja). */
#toolbar .tgroup #btnBarras, #toolbar .tgroup #btnPal, #toolbar .tgroup #btnProps {
  flex-direction: column; gap: 0; padding: 2px 9px; height: 44px; min-width: 46px;
  line-height: 1; font-size: 15px;
}
#toolbar .tgroup #btnBarras label, #toolbar .tgroup #btnPal label, #toolbar .tgroup #btnProps label { font-size: 9px; letter-spacing: .3px; line-height: 1.1; margin-top: 2px; }
#toolbar .tgroup #btnBarras svg.ico, #toolbar .tgroup #btnPal svg.ico, #toolbar .tgroup #btnProps svg.ico { width: 16px; height: 16px; }
#toolbar .tgroup button:not(.tool):hover {
  background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.22); transform: translateY(-1px);
}
#toolbar label.tbtn {
  background: var(--mp-grad); background-size: 190% 100%;
  color: #04202A; font-weight: 650;
}
#toolbar label.tbtn:hover { background-position: 60% 0; }
#toolbar button label, .dock button label { font-size: 9.5px; cursor: pointer; opacity: .8; margin-top: 3px; letter-spacing: .3px; }
.dock button label { font-size: calc(9.5px * var(--tb)); }

#toolbar button.active, .dock button.active, #toolbar .tgroup button:not(.tool).active {
  background: rgba(34,232,224,.14); color: var(--mp-cyan);
  border-color: rgba(34,232,224,.5);
  box-shadow: 0 0 0 1px rgba(34,232,224,.25), 0 0 14px rgba(34,232,224,.22);
}
#toolbar button.active label, .dock button.active label { opacity: 1; }
#toolbar select {
  background: rgba(255,255,255,.08); color: #E8F3FA; border: 1px solid rgba(34,232,224,.3);
  border-radius: 8px; padding: 4px 6px; font-size: 12px;
}
#toolbar select option { color: #0B2036; background: #fff; }
#zoomLabel { font-size: 11px; min-width: 40px; text-align: center; opacity: .85; }

/* ── LA FLECHITA ▾, IGUAL EN TODOS LOS BOTONES QUE LA LLEVAN ──
   Edgar, 05/09: "todos los botones hazlos iguales los que tienen flechitas,
   porque unos los hiciste de una manera y otros de otra". Antes había dos:
   el grupo la llevaba pegada al icono y la herramienta en una franja con
   divisor. Ahora las dos van igual: abajo a la derecha, mismo tamaño y
   misma opacidad, sin divisor.
   La diferencia que SÍ queda es de función, no de aspecto: en la herramienta
   esa esquina es la zona que abre los tipos (por eso ocupa todo el alto del
   botón, para que el dedo la encuentre); en el grupo, todo el botón abre el
   menú y la flechita solo avisa. */
.barra button.tool, .barra button.grpBtn { position: relative; }
/* RELLENO SIMÉTRICO SIEMPRE: la flechita flota en la esquina (absoluta) y no
   reserva sitio. Cualquier relleno desigual descentra el nombre — y eso solo
   se notaba en las barras de lado/abajo, donde no manda la regla de #toolbar
   (Edgar, 05/09: "las palabras de unos botones están en el medio y las otras
   no"). */
.barra button.tool:has(.dd) { padding-left: 8px; padding-right: 8px; min-width: calc(66px * var(--tb)); }
.dock.vert .barra button.tool:has(.dd) { padding: 3px 4px; min-width: calc(52px * var(--tb)); height: calc(54px * var(--tb)); }
/* botón de GRUPO: icono de la última herramienta usada + nombre del grupo */
.barra button.grpBtn { min-width: calc(64px * var(--tb)); height: calc(46px * var(--tb)); padding: 3px 8px; overflow: hidden; }
.barra button.grpBtn .gIco { display: flex; align-items: center; justify-content: center; line-height: 1; }
.barra button.grpBtn label { font-size: calc(9px * var(--tb)); opacity: .85; letter-spacing: .02em; text-transform: none; }
.barra button.grpBtn.abierto { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.35); }
.dock.vert .barra button.grpBtn { min-width: calc(52px * var(--tb)); width: calc(52px * var(--tb)); height: calc(54px * var(--tb)); padding: 3px 2px; }
.dock.vert .barra button.grpBtn label, .dock.vert .barra button.tool label, .dock.vert .barra button.act label { font-size: calc(8.5px * var(--tb)); margin-top: 1px; max-width: calc(50px * var(--tb)); overflow: hidden; text-overflow: ellipsis; line-height: 1.1; }
.dock.vert .barra button.tool, .dock.vert .barra button.act { min-width: calc(52px * var(--tb)); width: calc(52px * var(--tb)); height: calc(54px * var(--tb)); padding: 3px 4px; overflow: hidden; }
.dock.vert { width: calc(68px * var(--tb)); }
.dock.vert .barra .grip { width: calc(52px * var(--tb)); }
.dock.vert .barra button.act.zo { height: 40px; }
/* botones de acción dentro de una barra (zoom) */
.barra button.act { min-width: 50px; height: 46px; font-size: 15px; padding: 4px 8px; }
.barra button.act.zo { min-width: 36px; width: 36px; font-size: 16px; padding: 4px; }
.barra #zoomLabel { min-width: 42px; }
.dock.vert .barra #zoomLabel { min-width: 0; font-size: 10px; }
/* la flechita va ARRIBA a la derecha, a la altura del icono (que es estrecho)
   y no al lado del nombre: pegada al texto hacía que el nombre pareciera
   corrido a la izquierda (Edgar, 05/09: "measure rect y cloud no están
   centrados"). El icono y el nombre siguen centrados en todo el botón; la
   zona tocable sigue siendo la franja entera, solo cambia dónde se pinta. */
.barra .tool .dd, .barra button.grpBtn::after {
  position: absolute; right: 0; top: 0; bottom: 0; width: 17px;
  display: flex; align-items: flex-start; justify-content: center; padding: 3px 2px 0 0;
  font-size: 9px; line-height: 1; opacity: .6; border: 0; border-radius: 0 8px 8px 0;
}
.barra button.grpBtn::after { content: '▾'; pointer-events: none; }
.barra .tool .dd:hover { background: rgba(255, 255, 255, .18); opacity: 1; }
#toolMenu {
  position: fixed; z-index: 300; background: #fff; color: var(--mp-ink);
  border: 1px solid var(--mp-line); border-radius: 13px;
  box-shadow: 0 4px 10px rgba(11,32,54,.1), 0 20px 44px -14px rgba(11,32,54,.35);
  min-width: 215px; max-height: 62vh; overflow-y: auto; padding: 5px;
}
#toolMenu .tmHead { font-size: 10px; text-transform: uppercase; letter-spacing: .11em; color: var(--mp-ink-2); padding: 4px 8px 2px; }
#toolMenu .tmItem { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 12.5px; white-space: nowrap; }
#toolMenu .tmItem:hover { background: var(--mp-sky-2); }
#toolMenu .tmItem.cur { background: var(--mp-deep); color: #fff; }
#toolMenu .tmItem { border-radius: 8px; }
#toolMenu .tmItem svg { flex: none; border: 1px solid var(--mp-line); border-radius: 3px; background: var(--mp-card); }
#toolMenu .tmTool { gap: 10px; padding: 7px 8px; }
#toolMenu .tmTool .tIco { width: 26px; text-align: center; font-size: 15px; flex: none; }
#toolMenu .tmTool .tNom { flex: 1; font-weight: 600; }
#toolMenu .tmTool .tKey { font-size: 10px; opacity: .55; border: 1px solid var(--mp-line); border-radius: 4px; padding: 0 4px; min-width: 14px; text-align: center; }
#toolMenu .tmTool .tPin, #toolMenu .tmTool .tSub { width: 30px; align-self: stretch; margin: -7px 0; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex: none; }
#toolMenu .tmTool .tPin { opacity: .35; }
#toolMenu .tmTool .tPin.on { opacity: 1; color: #F2C230; }
#toolMenu .tmTool .tPin:hover, #toolMenu .tmTool .tSub:hover { background: var(--mp-sky-3); opacity: 1; }
#toolMenu .tmTool.cur .tKey { border-color: rgba(255,255,255,.35); }
#toolMenu .tmTool.cur .tPin:hover, #toolMenu .tmTool.cur .tSub:hover { background: rgba(255,255,255,.18); }
#toolMenu .tmPie { font-size: 10.5px; color: var(--mp-ink-2); padding: 6px 8px 3px; border-top: 1px solid var(--mp-line); margin-top: 4px; }
/* ===== panel ⋮ Barras (organizar) ===== */
#barrasPanel {
  position: fixed; z-index: 300; background: var(--mp-card); color: var(--mp-ink);
  border: 1px solid var(--mp-line); border-radius: 16px; width: min(420px, 96vw); max-height: 84vh; overflow-y: auto;
  padding: 12px 14px 14px; box-shadow: 0 4px 10px rgba(11,32,54,.1), 0 24px 60px -18px rgba(11,32,54,.45);
}
#barrasPanel[hidden] { display: none; }
#barrasPanel h4 { margin: 0 0 8px; font-size: 13px; font-weight: 650; letter-spacing: -0.01em; display: flex; align-items: center; justify-content: space-between; }
#barrasPanel h4 .x { cursor: pointer; opacity: .55; font-size: 16px; min-width: 32px; min-height: 32px; border-radius: 8px; border: none; background: transparent; color: var(--mp-ink); display: flex; align-items: center; justify-content: center; }
#barrasPanel h4 .x:hover { opacity: 1; background: var(--mp-sky-2); }
#barrasPanel .bpSec { font-size: 10px; text-transform: uppercase; letter-spacing: .11em; color: var(--mp-ink-2); margin: 12px 0 5px; }
#barrasPanel .bpRow { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 9px; font-size: 12.5px; }
#barrasPanel .bpRow:hover { background: var(--mp-sky-1); }
#barrasPanel .bpRow .nm { flex: 1; font-weight: 600; display: flex; align-items: center; gap: 8px; cursor: pointer; }
#barrasPanel .bpRow .ico { width: 24px; flex: none; display: flex; align-items: center; justify-content: center; }
#barrasPanel .bpRow select { font-size: 12px; padding: 4px 6px; border: 1px solid var(--mp-line); border-radius: 8px; background: #fff; color: var(--mp-ink); }
#barrasPanel .bpRow input[type=checkbox] { width: 17px; height: 17px; flex: none; accent-color: var(--mp-navy); }
#barrasPanel .bpRow button, #barrasPanel .bpBtns button {
  background: linear-gradient(180deg, #FFFFFF 0%, #F2F9FD 100%); color: var(--mp-navy);
  border: 1px solid rgba(27,60,140,.18); border-radius: 8px; padding: 4px 8px; font-size: 12px; cursor: pointer; font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 2px 5px rgba(7,26,46,.08);
}
#barrasPanel .bpRow button:disabled { opacity: .3; cursor: default; }
/* tamaño de las barras (E7b): tres botones, el elegido en azul */
#barrasPanel .bpRow.bpTam button { flex: 1; }
#barrasPanel .bpRow.bpTam button.cur { background: var(--mp-blue); color: #fff; border-color: var(--mp-blue); }
#barrasPanel .bpRow input[type=range] { accent-color: var(--mp-blue); }
#barrasPanel .bpRow button.quitar { color: var(--mp-danger); }
#barrasPanel .bpBtns { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
#barrasPanel .bpBtns button.pri { background: linear-gradient(180deg, #2E62E0 0%, var(--mp-navy) 100%); color: #F4FBFF; border-color: rgba(27,60,140,.55); }
#barrasPanel .bpNota { font-size: 11.5px; color: var(--mp-ink-2); line-height: 1.45; margin: 4px 0 0; }
#barrasPanel .bpSug { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; background: var(--mp-sky-1); border: 1px solid var(--mp-line); border-radius: 10px; padding: 8px 10px; margin-top: 8px; }
#barrasPanel .bpSug b { font-weight: 600; }
.swRow { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.sw { width: 20px; height: 20px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, .25); cursor: pointer; }
.sw.cur { outline: 2px solid var(--mp-blue); outline-offset: 1px; }
/* barra de formato del texto: compacta y pegada al cuadro (Edgar 08/30:
   "que sea pequena, lo mas pegado al texto posible") */
.pbody .txtBar, .txtBar { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin: 4px 0 2px 0; }
.pbody .txtBar > * { flex: none !important; }
.pbody .txtBar select { font-size: 11px !important; padding: 0 2px !important; height: 24px !important;
  width: 74px !important; min-width: 0 !important; border-radius: 5px !important; background: #fff; }
.pbody .txtBar input.n { width: 42px !important; font-size: 11px !important; padding: 0 2px !important;
  height: 24px !important; text-align: center; border-radius: 5px !important; }
.pbody .txtBar button { width: 24px !important; height: 24px !important; padding: 0 !important;
  font-size: 12px !important; line-height: 1 !important; border-radius: 5px !important; }
.pbody .txtBar button.on { background: var(--mp-navy) !important; border-color: var(--mp-navy) !important; color: #F4FBFF !important; }
.pbody .txtBar button:hover { transform: none !important; box-shadow: none !important; }
.txtBar .sep { width: 1px; height: 16px; background: var(--mp-line); margin: 0 1px; }
.pbody .txtBar .sw { width: 14px !important; height: 14px !important; border-radius: 3px; }
.pbody .txtBar .sw.cur { outline: 2px solid var(--mp-blue); outline-offset: 0; }
body.touch .pbody .txtBar button { width: 32px !important; height: 32px !important; font-size: 15px !important; padding: 0 !important; }
body.touch .pbody .txtBar .sw { width: 22px !important; height: 22px !important; }
body.touch .pbody .txtBar select { height: 32px !important; width: 86px !important; font-size: 13px !important; }
body.touch .pbody .txtBar input.n { height: 32px !important; width: 50px !important; font-size: 13px !important; }

/* pestañas de hojas (multi-hoja, estilo Bluebeam sets) */
#sheetTabs { position: absolute; left: 10px; bottom: 10px; z-index: 40; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; max-width: 70%; }
#sheetTabs .stab {
  border: 1.5px solid var(--mp-line); background: #fff; border-radius: 10px; padding: 5px 12px;
  font-size: 11.5px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px;
  box-shadow: 0 2px 8px rgba(11, 32, 54, .14); color: var(--mp-ink);
  transition: transform .12s, box-shadow .15s, border-color .15s;
}
#sheetTabs .stab:hover { transform: translateY(-1px); border-color: var(--mp-blue); }
#sheetTabs .stab.active { background: var(--mp-deep); color: var(--mp-cyan); border-color: var(--mp-deep); }
#sheetTabs .stab .sx { font-weight: 400; opacity: .55; padding: 0 2px; }
#sheetTabs .stab .sx:hover { opacity: 1; color: var(--mp-danger); }
#sheetTabs .stab.add { font-weight: 650; padding: 4px 9px; }

/* ===== Layout ===== */
#main { display: flex; flex: 1; min-height: 0; }

/* ===== Palette ===== */
#palette {
  width: 232px; flex: none; background: var(--mp-sky-1); border-right: 1px solid var(--mp-line);
  display: flex; flex-direction: column; min-height: 0;
}
#symSearch { margin: 8px; padding: 7px 10px; border: 1.5px solid var(--mp-line); border-radius: 10px; font-size: 12px; background: #fff; transition: border-color .15s, box-shadow .15s; }
#symSearch:focus { outline: none; border-color: var(--mp-blue); box-shadow: 0 0 0 3px rgba(42,91,215,.14); }
#catTabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 8px 8px; }
/* pestañas de la paleta: pastilla en relieve; la elegida se enciende con el
   gradiente azul del botón primario (guía §5 "chip de elegir") */
#catTabs .cat {
  border: 1px solid rgba(27,60,140,.18); background: linear-gradient(180deg, #FFFFFF 0%, #F2F9FD 100%);
  color: var(--mp-navy); border-radius: 999px;
  font-size: 11px; font-weight: 600; padding: 5px 11px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 2px 5px rgba(7,26,46,.08);
  transition: background .15s var(--mp-ease, ease), border-color .15s, transform .12s, box-shadow .15s;
}
#catTabs .cat:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 4px 10px rgba(7,26,46,.12), 0 0 10px rgba(34,232,224,.18); }
#catTabs .cat:active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(7,26,46,.18); }
#catTabs .cat.active {
  background: linear-gradient(180deg, #2E62E0 0%, var(--mp-navy) 100%); color: #F4FBFF; border-color: rgba(27,60,140,.55);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), inset 0 -1px 0 rgba(7,26,46,.25), 0 3px 8px rgba(27,60,140,.28);
}
/* grid-auto-rows explicito: sin el, en el iPad la fila se quedaba en la altura
   minima tactil (36 px) y el boton recortaba el dibujo y el nombre del simbolo. */
#symList { flex: 1; overflow-y: auto; padding: 4px 8px 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-content: start; grid-auto-rows: minmax(min-content, max-content); }
.symBtn {
  border: 1px solid rgba(27,60,140,.16); background: linear-gradient(180deg, #FFFFFF 0%, #F7FBFE 100%); border-radius: 12px; cursor: pointer;
  padding: 6px 4px 4px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 2px 5px rgba(7,26,46,.06);
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
}
.symBtn:active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(7,26,46,.14); }
.symBtn:hover { border-color: var(--mp-blue); transform: translateY(-2px); box-shadow: 0 6px 14px rgba(11,32,54,.14); }
.symBtn.active { border-color: var(--mp-blue); background: var(--mp-sky-2); box-shadow: 0 0 0 3px rgba(42,91,215,.15); }
.symBtn { position: relative; }
.symBtn .favstar {
  position: absolute; top: 2px; right: 5px; font-size: 13px; color: #A9C0D2;
  cursor: pointer; line-height: 1; z-index: 2;
}
.symBtn .favstar.on { color: #F2C230; }
.symBtn .favstar:hover { color: #F2C230; }
/* flex: none es obligatorio: sin el, en el iPad el dibujo se encogia a 0 px de
   alto (el boton es un item de rejilla con min-height tactil) y la paleta salia
   con los nombres pero SIN simbolos. Medido 04/09 en Chromium tactil. */
.symBtn svg { width: 56px; height: 42px; flex: none; }
.symBtn .nm { font-size: 9.5px; text-align: center; color: var(--mp-ink-2); line-height: 1.15; }

/* ===== Canvas ===== */
#canvasWrap { flex: 1; min-width: 0; position: relative; }
/* SELECCION DE TEXTO NATIVA: APAGADA EN EL LIENZO (Edgar, 31/08: "cuando toco
   un cuadrado se me seleccionan todas las letras del plano, se me mezclan y
   se me unen, tengo que dar clic afuera"). Reproducido: arrastrar sobre el
   SVG hacia que el navegador seleccionara TODOS los <text> del plano como si
   fueran un parrafo — BEDROOM, KITCHEN, FAMILY ROOM... — porque el texto SVG
   es seleccionable por defecto. Un lienzo de dibujo no es un documento. */
#stage, #canvas, #canvas text, #sheetTabs { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
#canvas.tool-select { cursor: default; }
#canvas.tool-pan { cursor: grab; }
#canvas.panning { cursor: grabbing; }

/* ===== Right panel ===== */
#rightPanel {
  width: 258px; flex: none; background: var(--mp-sky-1); border-left: 1px solid var(--mp-line);
  overflow-y: auto; overflow-x: hidden; min-height: 0;
}
/* EL ASA DEL PANEL (E7b): se agarra el borde izquierdo y se ensancha o
   estrecha (200-460 px). Se guarda con las barras. En el iPad el panel es
   una gaveta y no lleva asa. */
#rpGrip { flex: none; width: 7px; cursor: col-resize; background: transparent; position: relative; z-index: 3; margin-right: -7px; touch-action: none; }
#rpGrip:hover, #rpGrip.on { background: linear-gradient(90deg, transparent, rgba(11,132,255,.35)); }
body.touch #rpGrip { display: none; }
body.rpResize { cursor: col-resize; user-select: none; }
body.rpResize #canvasWrap { pointer-events: none; }
/* lo que va en una fila del panel se ENCOGE antes que salirse: los botones
   recortan su texto con puntos, nunca se cortan por el borde (medido 15/09:
   el "Importar" de DXF se salía 19 px hasta en pantalla de 1290) */
.pbody .row > * { min-width: 0; }
.pbody .row button { flex-shrink: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbody .row label.corto { width: auto; min-width: 30px; }
.pbody .row input[type=text], .pbody .row input:not([type]), .pbody .row select { min-width: 0; }
.panel { border-bottom: 1px solid var(--mp-line); }
/* (auditoría takeoff 03/09) con float:right el 3er botón caía sobre la tabla y no se podía pulsar */
.panel h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; padding: 8px 10px 4px; color: var(--mp-teal-text); font-weight: 650; border-left: 3px solid var(--mp-blue); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.panel h3 button { margin-left: auto; font-size: 10px; padding: 3px 8px; text-transform: none; letter-spacing: 0; }
.pbody { padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.pbody input[type="text"], .pbody input:not([type]), .pbody input[type="number"], .pbody select {
  width: 100%; padding: 6px 9px; border: 1.5px solid var(--mp-line); border-radius: 9px; font-size: 12px;
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
.pbody input:focus, .pbody select:focus { outline: none; border-color: var(--mp-blue); box-shadow: 0 0 0 3px rgba(42,91,215,.14); }
/* "aquí te toca escribir": el campo se señala sin robar el teclado */
.pbody input.pideDato { border-color: var(--mp-blue); box-shadow: 0 0 0 3px rgba(42,91,215,.18); animation: pideDato 1.1s ease-in-out 2; }
@keyframes pideDato { 0%, 100% { box-shadow: 0 0 0 3px rgba(42,91,215,.18); } 50% { box-shadow: 0 0 0 5px rgba(34,232,224,.32); } }
@media (prefers-reduced-motion: reduce) { .pbody input.pideDato { animation: none; } }
#layersBody button, .pbody button { border-radius: 9px !important; transition: background .15s, border-color .15s, transform .12s, box-shadow .15s; }
#layersBody button:hover, .pbody button:hover { border-color: var(--mp-blue) !important; transform: translateY(-1px); box-shadow: 0 3px 8px rgba(11,32,54,.12); }
.pbody .row { display: flex; gap: 6px; align-items: center; }
.pbody .row label { flex: none; width: 74px; font-size: 11px; color: var(--mp-ink-2); }
/* botones del panel: tecla blanca levantada (guía §3 "secundario") */
.pbody button, #layersBody button, .mbtns button, .panel h3 button {
  padding: 5px 9px; border: 1px solid rgba(27,60,140,.18);
  background: linear-gradient(180deg, #FFFFFF 0%, #F2F9FD 100%); border-radius: 9px;
  cursor: pointer; font-size: 12px; color: var(--mp-navy); font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 2px 5px rgba(7,26,46,.08);
}
.pbody button:hover, #layersBody button:hover, .mbtns button:hover, .panel h3 button:hover {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 4px 10px rgba(7,26,46,.12), 0 0 10px rgba(34,232,224,.18);
}
.pbody button:active, #layersBody button:active, .mbtns button:active, .panel h3 button:active {
  transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(7,26,46,.18);
}
.pbody button.danger { color: var(--mp-danger); border-color: rgba(179,56,59,.4); background: linear-gradient(180deg, #FFFFFF 0%, #FDF4F4 100%); }
.muted { color: var(--mp-ink-2); font-size: 12px; }
.small { font-size: 10px; text-transform: none; letter-spacing: 0; }
/* Entrar a la nube: tecla primaria pequeña, al lado del badge */
#pjEntrar { flex: none; margin-left: 6px; padding: 4px 11px; font-size: 11.5px; font-weight: 600; border-radius: 9px; cursor: pointer;
  background: linear-gradient(180deg, #2E62E0 0%, var(--mp-navy) 100%); color: #F4FBFF; border: 1px solid rgba(27,60,140,.55);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), inset 0 -1px 0 rgba(7,26,46,.25), 0 3px 8px rgba(27,60,140,.28); }
#pjEntrar:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 3px 8px rgba(27,60,140,.28), 0 0 12px rgba(34,232,224,.28); }
#pjEntrar:active { transform: translateY(1px); }
#pjEntrar[hidden] { display: none; }
body.touch #pjEntrar { min-height: 40px; padding: 6px 14px; font-size: 14px; }
.lay { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 0; }
.sub { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--mp-ink-2); padding-left: 20px; }
.sub input[type="range"] { flex: 1; }

/* counts table */
#countsBody table { width: 100%; border-collapse: collapse; font-size: 11.5px; font-variant-numeric: tabular-nums; }
#countsBody td { padding: 2px 4px; border-bottom: 1px solid var(--mp-line); }
#countsBody td.n { text-align: right; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
#countsBody tr.cat td { background: var(--mp-sky-3); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .11em; color: var(--mp-teal-text); }

/* Count (fase 5.5): el conteo manual dentro del panel Materiales */
.cntCod { display: inline-block; font-size: 9.5px; font-weight: 600; letter-spacing: .03em; color: var(--mp-teal-text, #0b7285); background: var(--mp-sky-3, #DCEEF7); border-radius: 4px; padding: 0 4px; margin-left: 4px; vertical-align: 1px; white-space: nowrap; }
.cntCod.def { color: var(--mp-ink-2); background: transparent; border: 1px dashed var(--mp-line); }
#toolMenu .tmPie { font-size: 11px; color: var(--mp-ink-2); padding: 6px 8px 2px; max-width: 320px; white-space: normal; line-height: 1.35; }
.cntChip { display: inline-block; width: 11px; height: 11px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .25); margin-right: 6px; vertical-align: -1px; flex: none; }
#countsBody tr.cntFila { cursor: pointer; }
#countsBody tr.cntFila:hover td { background: var(--mp-sky-2); }

/* Rutas de conduit (E5): el takeoff lineal por tipo, dentro de Materiales.
   La subcabecera separa Feeder's Description de Branch Circuits Description,
   que es como vienen las dos hojas del Excel de Edgar. */
#countsBody tr.subcat td { background: var(--mp-sky-2, #EDF6FB); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: .09em; color: var(--mp-ink-2); padding-left: 8px; }
#countsBody tr.rtFila { cursor: pointer; }
#countsBody tr.rtFila:hover td { background: var(--mp-sky-2); }
#toolMenu .tmItem .cntChip { width: 13px; height: 13px; margin-right: 2px; }
body.touch .cntChip { width: 15px; height: 15px; }
/* la marca del conteo no estorba: el toque lo resuelve hitTest, como todo */
#canvas g.cnt { pointer-events: none; }
#canvas g.cnt text { user-select: none; }
svg.tool-count { cursor: crosshair; }
svg.tool-match { cursor: copy; }
svg.tool-trim { cursor: crosshair; }

/* Barra flotante de propiedades (4.5): pegada a lo seleccionado, solo en dedo */
#propFlot {
  position: absolute; z-index: 62; display: flex; align-items: center; gap: 3px;
  background: var(--mp-deep); border: 1px solid rgba(255,255,255,.16); border-radius: 14px;
  padding: 4px; box-shadow: 0 8px 26px rgba(7,26,46,.45);
}
#propFlot[hidden] { display: none !important; }
#propFlot button {
  width: 44px; height: 44px; border-radius: 10px; border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.03));
  color: #E8F3FA; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
#propFlot button:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.28); }
#propFlot button:active { transform: translateY(1px); }
#propFlot button.mal { color: #FF9A9A; border-color: rgba(255,120,120,.35); }
#propFlot svg.ico { width: 21px; height: 21px; }

/* Mi cofre (5.10): botones de las herramientas guardadas */
.barra button.cofreBtn { min-width: 66px; padding-left: 8px; padding-right: 8px; }
.barra button.cofreBtn label { max-width: 78px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock.vert .barra button.cofreBtn { min-width: 52px; width: 52px; padding: 3px 4px; }
.cofIco { display: flex; align-items: center; justify-content: center; height: 20px; line-height: 1; }
.cofIco svg { width: 22px; height: 18px; }
#toolMenu .tmItem.k-off { opacity: .35; pointer-events: none; }


/* ===== iconos de línea (js/icons.js) ===== */
svg.ico { width: 18px; height: 18px; flex: none; display: block; pointer-events: none; }
#toolbar svg.ico, .dock svg.ico { width: 19px; height: 19px; }
.barra button.tool svg.ico { width: calc(21px * var(--tb)); height: calc(21px * var(--tb)); }
.barra .gIco svg.ico { width: calc(19px * var(--tb)); height: calc(19px * var(--tb)); }
#navFijo svg.ico { width: 17px; height: 17px; }
#catTabs .cat svg.ico { width: 15px; height: 15px; }
#toolMenu .tIco svg.ico { width: 19px; height: 19px; margin: 0 auto; }
.pbody button svg.ico, #layersBody button svg.ico, .mbtns button svg.ico, .panel h3 button svg.ico { width: 15px; height: 15px; }
/* los botones con icono + texto los ponen en fila, con aire entre medias */
#catTabs .cat, .pbody button, #layersBody button, .mbtns button, .panel h3 button, #grpArchivo button, #grpAjustes button, #grpHist button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
#grpArchivo button, #grpAjustes button, #grpHist button { flex-direction: column !important; gap: 1px !important; }
body.touch svg.ico { width: 20px; height: 20px; }
body.touch .barra button.tool svg.ico { width: 24px; height: 24px; }
body.touch #catTabs .cat svg.ico { width: 17px; height: 17px; }
body.touch #navFijo svg.ico { width: 21px; height: 21px; }

/* ===== Status bar ===== */
#statusbar {
  height: 36px; flex: none; background: var(--mp-deep); color: #9FC2D8;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: 10px;
  padding: 0 12px; font-size: 11.5px;
  border-top: 1px solid rgba(255,255,255,.09);
}
#statusbar #hint { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; display: flex; align-items: center; gap: 7px; }
/* punto de color en vez de emoji (guía §4): verde bien · ámbar ojo · azul esperando */
#statusbar #hint.ok::before, #statusbar #hint.aviso::before, #statusbar #hint.espera::before {
  content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%;
}
#statusbar #hint.ok::before { background: #3FBF4E; box-shadow: 0 0 7px rgba(63,191,78,.85); }
#statusbar #hint.aviso::before { background: #F2C230; box-shadow: 0 0 7px rgba(242,194,48,.85); }
#statusbar #hint.espera::before { background: var(--mp-cyan); box-shadow: 0 0 7px rgba(34,232,224,.8); animation: latePunto 1.4s ease-in-out infinite; }
@keyframes latePunto { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { #statusbar #hint.espera::before { animation: none; } }
#statusbar #hint.ok { color: #A8E6A0; }
#statusbar #hint.aviso { color: #F6E9A8; }
#statusbar .sbDer { text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#statusbar #verTag { opacity: .55; margin-left: 10px; font-size: 10px; }
/* Select / Pan / zoom: fijos, en el centro, chiquitos como en Revu */
#navFijo { display: flex; align-items: center; gap: 3px; }
#navFijo button {
  min-width: 30px; height: 28px; padding: 0 6px; border-radius: 8px; font-size: 14px; line-height: 1;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.025));
  border: 1px solid rgba(255,255,255,.13); color: #E8F3FA; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 1px 3px rgba(0,0,0,.3);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
#navFijo button:hover { background: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,.06)); border-color: rgba(255,255,255,.25); }
#navFijo button.active { background: rgba(34,232,224,.14); color: var(--mp-cyan); border-color: rgba(34,232,224,.5); box-shadow: 0 0 0 1px rgba(34,232,224,.25), 0 0 10px rgba(34,232,224,.22); }
/* mientras se va sumando a la selección, el puntero lo dice */
body.sumandoSel #canvas { cursor: copy; }
body.sumandoSel #btnSumar { background: rgba(140,240,106,.18); color: var(--mp-lime); border-color: rgba(140,240,106,.55); box-shadow: 0 0 0 1px rgba(140,240,106,.25), 0 0 10px rgba(140,240,106,.25); }
#navFijo .sep { width: 1px; height: 18px; background: rgba(255,255,255,.14); margin: 0 5px; }
#navFijo #zoomLabel { min-width: 40px; text-align: center; font-size: 11px; color: #E8F3FA; opacity: .85; font-variant-numeric: tabular-nums; }

/* ===== Modal Panel Schedule ===== */
.modal { position: fixed; inset: 0; background: rgba(7,26,46,.55); display: flex; align-items: center; justify-content: center; z-index: 60; }
.modal[hidden] { display: none; }
.modalBox { background: var(--mp-card); border: 1px solid var(--mp-line); border-radius: 16px; width: min(1020px, 96vw); max-height: 92vh; overflow-y: auto; padding: 14px 18px 18px; box-shadow: 0 2px 6px rgba(7,26,46,.05), 0 24px 60px -18px rgba(7,26,46,.45); }
.modalHead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modalHead b { font-size: 14px; letter-spacing: -0.01em; font-weight: 650; color: var(--mp-ink); }
.mbtns button { margin-left: 6px; padding: 5px 11px; }
.psHeader { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 10px; font-size: 11.5px; align-items: center; }
.psHeader label { display: flex; align-items: center; gap: 4px; color: var(--mp-ink-2); }
.psHeader input { border: 1px solid var(--mp-line); border-radius: 6px; padding: 3px 5px; font-size: 11.5px; }
.psGrid { overflow-x: auto; }
.psGrid table { width: 100%; border-collapse: collapse; font-size: 11px; }
.psGrid th { background: var(--mp-deep); color: #E8F3FA; padding: 3px 4px; font-size: 9.5px; font-weight: 600; }
.psGrid td { border: 1px solid var(--mp-line); padding: 0; }
.psGrid td.ck { background: var(--mp-sky-3); text-align: center; font-weight: 600; width: 30px; font-size: 10.5px; }
.psGrid input { width: 100%; border: none; font-size: 11px; padding: 3px 4px; background: transparent; box-sizing: border-box; }
.psGrid input.num { text-align: right; }
.psGrid col.desc { width: 26%; }
.psTotals { font-size: 12px; margin: 8px 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.modalBox h4 { margin: 12px 0 6px; font-size: 12px; letter-spacing: .5px; }
.modalBox h4 button.small { font-size: 10.5px; padding: 2px 8px; margin-left: 8px; border: 1px solid var(--mp-line); background: var(--mp-card); color: var(--mp-ink); border-radius: 6px; cursor: pointer; }
.psLoadsT { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.psLoadsT td { border: 1px solid var(--mp-line); padding: 0; }
.psLoadsT input[type=text] { width: 100%; border: none; padding: 3px 5px; font-size: 11.5px; box-sizing: border-box; }
.psLoadsT input.num { width: 90px; text-align: right; border: none; padding: 3px 5px; font-size: 11.5px; }
.psLoadsT td.cb { text-align: center; width: 70px; font-size: 10px; color: var(--mp-ink-2); white-space: nowrap; padding: 0 4px; }
.psLoadsT button.del { border: none; background: none; color: var(--mp-danger); cursor: pointer; font-size: 12px; }
.psCalc { margin-top: 8px; font-size: 12px; line-height: 1.7; background: var(--mp-sky-2); border-radius: 10px; padding: 8px 12px; }
.psCalc b.amp { color: var(--mp-danger); }

/* ===== Print ===== */
@media print {
  /* (auditoria 31/08, GRAVE) html/body llevan height:100% + overflow:hidden
     para la app, y eso tambien regia al imprimir: el SET de hojas salia
     recortado a la PRIMERA pagina. En papel el documento crece lo que haga
     falta. */
  html, body { height: auto !important; overflow: visible !important; }
  /* nada de la app entra en la hoja. Antes solo se escondia #app, y la
     burbuja del chat (que cuelga del body) se IMPRIMIA encima del plano */
  body > * { display: none !important; }
  #printSheet { display: block !important; position: static; }
  /* Ctrl+P sin pasar por el boton: la hoja vacia no se imprime */
  #printSheet:empty { display: none !important; }
  /* la orientación la pone el JS en #printPageCss según la forma del plano */
}
#printSheet { background: #fff; color: #14161a; font-family: Arial, sans-serif; }
#printSheet .sheetFrame { border: 2px solid #14161a; padding: 4px; height: 186mm; display: flex; flex-direction: column; page-break-after: always; }
/* la hoja de pie: una casa mas alta que ancha aprovecha el papel entero */
#printSheet.vert .sheetFrame { height: 262mm; }   /* Letter portrait con 8mm de margen deja 263.4mm: 265 no cabia */
#printSheet .sheetFrame:last-child { page-break-after: auto; }
/* hoja limpia: solo el plano, sin recuadro ni caratula (Edgar 08/30) */
#printSheet .sheetFrame.sinMarco { border: 0; padding: 0; }
#printSheet .sheetFrame.sinMarco .drawArea { border: 0; }
#printSheet .drawArea { flex: 1; border: 1px solid #14161a; position: relative; overflow: hidden; }
#printSheet .drawArea svg { width: 100%; height: 100%; }
#printSheet .titleBlock { display: flex; border: 1px solid #14161a; border-top: none; font-size: 10px; }
#printSheet .tb { padding: 4px 8px; border-right: 1px solid #14161a; }
#printSheet .tb:last-child { border-right: none; }
#printSheet .tb .cap { font-size: 7px; text-transform: uppercase; color: #555; }
#printSheet .tb .val { font-weight: 700; font-size: 11px; min-height: 13px; }
#printSheet .tb.brand { background: #1e2a45; color: #fff; }
#printSheet .tb.brand .bn { font-weight: 800; font-size: 14px; letter-spacing: 1px; color: #f5b82e; }
#printSheet .tb.brand .bs { font-size: 8px; letter-spacing: .8px; }
#printSheet .tb.brand .bl { font-size: 6.5px; margin-top: 3px; line-height: 1.4; opacity: .9; }
#printSheet .tb.sheetno { background: #1e2a45; color: #fff; display: flex; flex-direction: column; justify-content: space-between; }
#printSheet .tb.sheetno .st { font-size: 8px; text-transform: uppercase; letter-spacing: .5px; }
#printSheet .tb.sheetno .sn { font-size: 26px; font-weight: 800; text-align: right; line-height: 1; }
#printSheet .legend { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 4px 8px; border: 1px solid #14161a; border-top: none; font-size: 9px; align-items: center; }
#printSheet .legend .it { display: flex; align-items: center; gap: 4px; }
#printSheet .legend svg { width: 26px; height: 20px; }
/* sello del plano (4.3): estampado sobre el dibujo, arriba a la derecha */
#printSheet .drawArea { position: relative; }
#printSheet .selloPlano {
  position: absolute; top: 6px; right: 8px; z-index: 3;
  border: 2.5px solid #14161a; color: #14161a; border-radius: 4px;
  padding: 3px 12px; font-weight: 800; font-size: 13px; letter-spacing: 2px;
  background: rgba(255,255,255,.82);
}
#printSheet .selloPlano.ojo { border-color: #b3383b; color: #b3383b; }
#printSheet .legend .it { display: flex; align-items: center; gap: 3px; }

/* E-2 print tables */
#printSheet .e2Area { padding: 8px 14px; overflow: hidden; }
#printSheet .e2band { background: #1e2a45; color: #fff; font-weight: 700; letter-spacing: 1.2px; padding: 3px 10px; font-size: 10px; margin: 6px 0 4px; }
#printSheet table.e2 { width: 100%; border-collapse: collapse; font-size: 8.5px; }
#printSheet table.e2 th { background: #1e2a45; color: #fff; padding: 2px 4px; font-size: 7.5px; letter-spacing: .3px; }
#printSheet table.e2 td { border: 1px solid #444; padding: 1.5px 4px; }
#printSheet table.e2 td.ck { background: #eee; text-align: center; font-weight: 700; }
#printSheet table.e2 td.n { text-align: right; }
#printSheet .e2hdr { display: flex; gap: 18px; font-size: 8.5px; padding: 3px 2px; }
#printSheet .e2hdr b { font-size: 9px; }
#printSheet .e2foot { font-size: 8.5px; margin-top: 4px; line-height: 1.6; }
#printSheet .e2foot .amp { font-weight: 800; }

/* portátil estrecho: la fila 1 cabe en una línea hasta 1100 px */
@media (max-width: 1200px) {
  .brand span { display: none; }
  #grpAjustes select { max-width: 118px; }
  #grpArchivo button { min-width: 46px; padding: 3px 5px !important; }
  .tbRow1 { gap: 5px; }
}

/* Mobile / tablet adjustments */
@media (max-width: 900px) {
  #palette { width: 168px; }
  #rightPanel { width: 200px; }
  #toolbar button:not(.grpBtn) label, .dock.horiz button:not(.grpBtn) label { display: none; }
  /* en un muelle vertical SÍ hay ancho para el nombre: o lo llevan todos
     (herramientas y grupos) o no lo lleva ninguno — nunca la mitad */
  .dock.vert .barra button label { display: block; }
}

/* scrollbars finos y modernos */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #B9D2E2; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #8FB6CE; background-clip: content-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   MODO iPAD / TÁCTIL (estilo Bluebeam Revu iPad)
   Se activa solo cuando la pantalla es de dedo (pointer: coarse).
   Paneles = gavetas deslizables; el plano ocupa TODO; botones de dedo.
   ============================================================ */
.touch-only { display: none !important; }
body.touch .touch-only { display: flex !important; }

body.touch, body.touch button, body.touch label {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
/* inputs a 16px: evita que iOS haga zoom al enfocar */
body.touch input, body.touch select, body.touch textarea, #askInput { font-size: 16px !important; }

/* barra: botones de dedo (mín 44pt) */
body.touch .tbRow1 { min-height: 52px; }
body.touch #grpHist button, body.touch #grpArchivo button, body.touch #grpAjustes button { height: 50px; }
body.touch #grpArchivo button, body.touch #grpAjustes button { min-width: 45px; padding: 3px 3px !important; }
body.touch #grpHist button { min-width: 34px; padding: 3px 4px !important; }
body.touch #grpArchivo button label, body.touch #grpAjustes button label { font-size: 8.5px; }
/* en el iPad la fila 1 cabe en una línea: solo el logo, sin el nombre escrito */
body.touch .brand b, body.touch .brand span { display: none; }
body.touch #toolbar .tgroup #btnPal, body.touch #toolbar .tgroup #btnProps, body.touch #toolbar .tgroup #btnBarras { min-width: 46px; height: 50px; padding: 3px; }
body.touch #btnPal label, body.touch #btnProps label, body.touch #btnBarras label { font-size: 9px; }
body.touch .tbRow1 { gap: 3px; padding-left: 8px; padding-right: 8px; }
body.touch .tgroup { padding-left: 4px; gap: 3px; }
body.touch .barra { grid-template-rows: 14px auto; }
body.touch .barra .bLbl { font-size: 9.5px; }
body.touch .barra .grip { width: 32px; }
body.touch .barra button.tool { min-width: 58px; height: 54px; font-size: 18px; }
body.touch .barra button.grpBtn { min-width: 70px; height: 54px; }
body.touch .barra button.grpBtn label { font-size: 10px; }
body.touch .barra button.tool:has(.dd) { padding-left: 8px; padding-right: 8px; min-width: 74px; }
body.touch .barra .tool .dd, body.touch .barra button.grpBtn::after { width: 22px; font-size: 11px; padding-top: 4px; }
body.touch .dock.vert { width: 74px; }
body.touch .dock.vert .barra .grip { width: 58px; height: 28px; }
body.touch .dock.vert .barra button.tool, body.touch .dock.vert .barra button.grpBtn, body.touch .dock.vert .barra button.act { width: 58px; min-width: 58px; height: 58px; }
body.touch .dock.vert .barra button.tool label, body.touch .dock.vert .barra button.grpBtn label, body.touch .dock.vert .barra button.act label { font-size: 9px; max-width: 54px; }
body.touch .dock.vert .barra button.tool:has(.dd) { padding: 3px 4px; min-width: 58px; height: 58px; }
body.touch .dock.vert .barra .tool .dd, body.touch .dock.vert .barra button.grpBtn::after { width: 20px; font-size: 11px; }
body.touch .barra button.act { min-width: 56px; height: 54px; }
body.touch .barra button.act.zo { min-width: 44px; width: 44px; }
body.touch #toolMenu .tmTool { padding: 8px 10px; min-height: 48px; }
body.touch #toolMenu .tmTool .tPin, body.touch #toolMenu .tmTool .tSub { width: 44px; margin: -8px 0; font-size: 18px; }
body.touch #toolMenu .tKey { display: none; }
body.touch #barrasPanel .bpRow { padding: 6px 6px; font-size: 15px; }
body.touch #barrasPanel .bpRow button, body.touch #barrasPanel .bpBtns button { min-width: 44px; min-height: 44px; padding: 8px 12px; font-size: 15px; }
body.touch #barrasPanel .bpRow select { min-height: 44px; font-size: 16px; }
body.touch #barrasPanel .bpRow input[type=checkbox] { width: 26px; height: 26px; }
body.touch #barrasPanel h4 .x { min-width: 44px; min-height: 44px; }
body.touch #toolbar .tgroup button:not(.tool) { height: 46px; font-size: 14px; padding: 4px 14px; }
body.touch #toolbar label.tbtn { height: 46px; }
body.touch #toolbar button label { font-size: 10.5px; }

/* paneles como GAVETAS sobre el plano */
body.touch #palette {
  position: absolute; left: 0; top: 0; bottom: 0; z-index: 70;
  width: min(320px, 85vw);
  transform: translateX(-105%);
  transition: transform .22s ease;
  box-shadow: 8px 0 28px rgba(11, 32, 54, .25);
}
body.touch #palette.open { transform: none; }
body.touch #rightPanel {
  position: absolute; right: 0; top: 0; bottom: 0; z-index: 70;
  width: min(320px, 85vw);
  transform: translateX(105%);
  transition: transform .22s ease;
  box-shadow: -8px 0 28px rgba(11, 32, 54, .25);
}
body.touch #rightPanel.open { transform: none; }
body.touch #btnPal.active, body.touch #btnProps.active {
  background: rgba(34, 232, 224, .14); color: var(--mp-cyan); border-color: rgba(34, 232, 224, .5);
}

/* símbolos y pestañas de dedo */
body.touch .symBtn { padding: 10px 6px 8px; }
body.touch .symBtn svg { width: 68px; height: 52px; }
body.touch .symBtn .nm { font-size: 11px; }
body.touch .symBtn .favstar { font-size: 17px; top: 4px; right: 7px; }
body.touch #catTabs .cat { font-size: 13.5px; padding: 11px 14px; min-height: 44px; }
/* dedo con guantes: 44 px de alto en todo lo que se toca (guía §6) */
body.touch #symSearch { min-height: 44px; font-size: 16px; }
/* la estrella es un blanco de 44 px que NO ocupa sitio: va absoluta sobre la
   esquina del boton (el simbolo esta centrado, no lo tapa) */
body.touch .symBtn .favstar { font-size: 19px; top: 0; right: 0; padding: 0; margin: 0; width: 44px; height: 44px; display: flex; align-items: flex-start; justify-content: flex-end; }
body.touch .symBtn .favstar::before { content: ''; position: absolute; inset: 0; }
body.touch #btnPal, body.touch #btnProps { min-height: 44px; }
body.touch .pbody button, body.touch #layersBody button, body.touch .mbtns button, body.touch .panel h3 button { min-height: 44px !important; padding: 8px 12px !important; }
body.touch .pbody input, body.touch .pbody select { min-height: 44px; }
body.touch .pbody .row label { font-size: 12.5px; }
body.touch #grpHist button { min-width: 44px; }
body.touch #grpAjustes select { min-height: 44px; }
body.touch .panel h3 { font-size: 12px; padding: 10px 10px 5px; }
body.touch input[type=checkbox], body.touch input[type=radio] { width: 24px; height: 24px; }
body.touch #sheetTabs .stab { font-size: 14px; padding: 9px 16px; }
body.touch #toolMenu .tmItem { padding: 11px 12px; font-size: 15px; }
body.touch .pbody button, body.touch #layersBody button { padding: 9px 10px !important; font-size: 13px !important; }
body.touch #statusbar { height: 52px; font-size: 13px; }
body.touch #navFijo button { min-width: 44px; height: 44px; font-size: 18px; }
body.touch #navFijo .sep { height: 26px; }
body.touch .sw { width: 28px; height: 28px; }
body.touch #main { position: relative; }

/* ═══ AUDITORÍA 08/28 · toques con el dedo en el iPad ═══
   Medido en un iPad Pro 11: btnEst y btnCsv salían de 18 px de alto, y el
   selector de tipo de pared y la paleta de 29. Con el dedo eso se falla.
   En pantalla táctil todo lo que se toca sube a 36 px. */
body.touch button,
body.touch select,
body.touch #catTabs button,
body.touch .cat,
body.touch .tmItem { min-height: 36px; }
body.touch #catTabs button { padding: 8px 12px; font-size: 12.5px; }
body.touch .sub button { padding: 9px 10px !important; font-size: 12px !important; }
body.touch #btnEst, body.touch #btnCsv { padding: 8px 12px !important; font-size: 12px !important; }
body.touch #btnPal, body.touch #stAdd { min-width: 40px; }
/* blancos de dedo: casillas de capas, estrellas de favoritos, × de hojas */
body.touch #layersBody label.lay { min-height: 40px; display: flex; align-items: center; gap: 10px; }
body.touch #layersBody input[type=checkbox] { width: 24px; height: 24px; }
/* blancos sueltos que quedaban por debajo de 44: el + de hoja, el 🆕 de
   proyecto, el borrar-guia y la casilla de nombres del equipo */
body.touch #stAdd, body.touch #pjNuevo, body.touch #btnGuiaDel { min-height: 44px; min-width: 44px; }
body.touch #cbEqName { width: 24px; height: 24px; }
body.touch #rightPanel input[type=text], body.touch #rightPanel input:not([type]), body.touch #rightPanel input[type=number], body.touch #rightPanel input[type=search] { min-height: 44px; }
body.touch #sheetTabs .stab .sx { padding: 6px 8px; font-size: 16px; }

/* ══════════ 💬 CHAT FLOTANTE ══════════
   Pedido de Edgar: poder preguntar sin salir del plano. Va FUERA del lienzo,
   así que arrastrar paredes por debajo sigue funcionando igual. */
#chatBurbuja {
  position: absolute; right: 18px; bottom: 18px; z-index: 45;
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid rgba(27,60,140,.55); background: linear-gradient(180deg,#2E62E0 0%,var(--mp-navy) 100%); color: #F4FBFF;
  font-size: 23px; line-height: 1; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 4px 10px rgba(27,60,140,.28);
}
#chatBurbuja:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 4px 10px rgba(27,60,140,.28), 0 0 12px rgba(34,232,224,.28); }
#chatBurbuja.oculto, #chatFlot.oculto { display: none; }

#chatFlot {
  position: fixed; right: 18px; bottom: 18px; z-index: 61;
  width: 348px; max-width: calc(100vw - 16px);
  height: 440px; max-height: calc(100vh - 24px);
  display: flex; flex-direction: column;
  background: var(--mp-card); border: 1px solid var(--mp-line); border-radius: 14px;
  box-shadow: 0 2px 6px rgba(7,26,46,.05), 0 20px 44px -14px rgba(7,26,46,.35); overflow: hidden;
  resize: both;
}
#chatCab {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 9px; background: var(--mp-sky-2); border-bottom: 1px solid var(--mp-line);
  cursor: move; touch-action: none; user-select: none;
}
#chatTit { font-weight: 600; font-size: 12.5px; flex: 1; color: var(--mp-ink); }
#chatCoste { font-size: 10.5px; color: var(--mp-ink-2); }
#chatCab button {
  border: 1px solid var(--mp-line); background: var(--mp-card); color: var(--mp-ink); border-radius: 7px;
  width: 26px; height: 26px; cursor: pointer; font-size: 13px; line-height: 1; padding: 0;
}
#chatCab button:hover { background: var(--mp-sky-2); border-color: var(--mp-blue); }

#chatCuerpo { flex: 1; overflow-y: auto; padding: 9px; font-size: 12.5px; line-height: 1.5; }
.chatVacio { color: var(--mp-ink-2); font-size: 12px; padding: 6px 2px; }
.chatYo {
  background: var(--mp-sky-2); border: 1px solid var(--mp-line); border-radius: 9px 9px 2px 9px;
  padding: 6px 9px; margin: 6px 0 6px 26px; white-space: pre-wrap;
}
.chatEl { padding: 2px 1px; margin: 6px 0; }
.chatPensando { color: var(--mp-ink-2); font-style: italic; }
.chatErr { color: #b3541e; background: #fff5ec; border: 1px solid #f2d9c2;
  border-radius: 7px; padding: 6px 9px; margin: 6px 0; font-size: 12px; }
.chatEl table { max-width: 100%; }

#chatPie { display: flex; gap: 6px; padding: 7px; border-top: 1px solid var(--mp-line); background: var(--mp-sky-1); }
#chatTxt {
  flex: 1; resize: none; font: inherit; font-size: 12.5px;
  border: 1px solid var(--mp-line); border-radius: 8px; padding: 5px 7px;
}
#chatEnv {
  border: 1px solid rgba(27,60,140,.55); background: linear-gradient(180deg,#2E62E0 0%,var(--mp-navy) 100%); color: #F4FBFF;
  border-radius: 8px; width: 38px; cursor: pointer; font-size: 15px;
}
#chatEnv:hover { box-shadow: 0 0 12px rgba(34,232,224,.28); }

/* con el dedo: más grande y sin que la burbuja tape los botones de abajo */
body.touch #chatBurbuja { width: 58px; height: 58px; font-size: 25px; bottom: 22px; }
body.touch #chatCab button { width: 34px; height: 34px; }
body.touch #chatEnv { width: 46px; }
body.touch #chatTxt { font-size: 15px; }   /* 16px o menos hace zoom en iOS */
@media (max-width: 520px) {
  #chatFlot { width: calc(100vw - 16px); height: 62vh; }
}
.mxp.sinEqName text.eqName{display:none}

/* ======= LISTA DE MARCAS (Markups List) ======= */
#marcasBox {
  position: fixed; left: 250px; top: 78px; z-index: 61;
  width: 580px; max-width: calc(100vw - 16px);
  height: 440px; max-height: calc(100vh - 90px);
  display: flex; flex-direction: column;
  background: var(--mp-card); border: 1px solid var(--mp-line); border-radius: 14px;
  box-shadow: 0 2px 6px rgba(7,26,46,.05), 0 20px 44px -14px rgba(7,26,46,.35); overflow: hidden; resize: both;
}
#marcasBox.oculto { display: none; }
#marcasCab {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  background: var(--mp-sky-2); border-bottom: 1px solid var(--mp-line);
  cursor: move; touch-action: none; user-select: none;
}
#marcasTit { font-weight: 600; font-size: 12.5px; flex: 1; letter-spacing: .11em; color: var(--mp-ink); }
#marcasCab button { border: 1px solid var(--mp-line); background: var(--mp-card); color: var(--mp-ink); border-radius: 7px; width: 26px; height: 26px; cursor: pointer; font-size: 13px; line-height: 1; padding: 0; }
#marcasCab button:hover { background: var(--mp-sky-2); border-color: var(--mp-blue); }
/* "Marcar la lista": el botón que convierte el filtro en una selección. Es el
   único de la cabecera con texto, así que no cabe en los 26×26 de los demás. */
#marcasCab #marcasMarcar {
  width: auto; min-height: 28px; padding: 3px 10px; gap: 6px; font-size: 11.5px; white-space: nowrap;
  display: inline-flex; align-items: center; font-weight: 600; color: var(--mp-navy);
  background: linear-gradient(180deg, #FFFFFF 0%, #F2F9FD 100%); border-color: rgba(27,60,140,.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 2px 5px rgba(7,26,46,.08);
}
#marcasCab #marcasMarcar[disabled] { opacity: .45; cursor: default; box-shadow: none; }
body.touch #marcasCab #marcasMarcar { min-height: 44px; font-size: 13px; padding: 6px 12px; }
#marcasFiltro { display: flex; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--mp-line); }
#marcasFiltro input { flex: 1; min-width: 0; }
#marcasCuerpo { flex: 1; overflow: auto; }
#marcasTabla { width: 100%; border-collapse: collapse; font-size: 12px; }
#marcasTabla th { position: sticky; top: 0; background: var(--mp-sky-2); text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--mp-line); font-size: 11px; letter-spacing: .11em; text-transform: uppercase; color: var(--mp-ink-2); cursor: pointer; }
#marcasTabla td { padding: 4px 8px; border-bottom: 1px solid var(--mp-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
#marcasTabla tr.fila { cursor: pointer; }
#marcasTabla tr.fila:hover { background: var(--mp-sky-2); }
#marcasTabla tr.fila.cur { background: var(--mp-sky-3); }
#marcasTabla td.n { text-align: right; font-variant-numeric: tabular-nums; min-width: 92px; padding-right: 14px; }
#marcasTabla th:last-child { text-align: right; padding-right: 14px; }
#marcasTabla td.k { color: var(--mp-ink-2); font-size: 11px; }
/* Buscar iguales en el plano → Count (5.9) */
#visualBox {
  position: fixed; right: 276px; top: 78px; z-index: 61; width: 300px; max-width: calc(100vw - 16px);
  background: var(--mp-card); border: 1px solid var(--mp-line); border-radius: 14px;
  box-shadow: 0 2px 6px rgba(7,26,46,.05), 0 20px 44px -14px rgba(7,26,46,.35); overflow: hidden;
}
#visualBox.oculto { display: none; }
#visualCab { display: flex; align-items: center; gap: 8px; padding: 7px 9px; background: var(--mp-sky-2); border-bottom: 1px solid var(--mp-line); cursor: move; touch-action: none; user-select: none; }
#visualTit { font-weight: 600; font-size: 12px; flex: 1; letter-spacing: .1em; color: var(--mp-ink); }
#visualCab button { border: 1px solid var(--mp-line); background: var(--mp-card); color: var(--mp-ink); border-radius: 7px; width: 26px; height: 26px; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; }
#visualCuerpo { padding: 8px 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
#visualCuerpo .bMuted { color: var(--mp-ink-2); line-height: 1.5; }
#visualCuerpo .vN { font-size: 13px; }
#visualCuerpo .row { display: flex; gap: 6px; align-items: center; }
#visualCuerpo .row label { flex: none; width: 76px; font-size: 11px; color: var(--mp-ink-2); }
#visualCuerpo select, #visualCuerpo button { padding: 5px 9px; border: 1px solid rgba(27,60,140,.18); border-radius: 9px; background: linear-gradient(180deg, #FFFFFF 0%, #F2F9FD 100%); color: var(--mp-navy); font-size: 12px; font-weight: 600; cursor: pointer; }
#visualCuerpo button[disabled] { opacity: .45; cursor: default; }
/* La lista de revisión de la búsqueda visual: uno por fila, del que más se
   parece al que menos. Los de abajo son casi siempre los que sobran. */
.vLista { max-height: 210px; overflow: auto; margin: 6px 0 4px; border: 1px solid var(--mp-line); border-radius: 9px; }
.vFila { display: flex; align-items: center; gap: 8px; padding: 4px 8px; cursor: pointer; font-size: 12px; border-bottom: 1px solid var(--mp-line); }
.vFila:last-child { border-bottom: 0; }
.vFila:hover { background: var(--mp-sky-2); }
.vFila.cur { background: var(--mp-sky-3); }
.vFila.fuera { opacity: .5; }
.vFila.fuera .vTxt { text-decoration: line-through; }
.vPc { flex: none; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--mp-teal-text); min-width: 34px; }
.vTxt { flex: 1; color: var(--mp-ink-2); }
.vX { flex: none; border: 1px solid var(--mp-line); background: var(--mp-card); color: var(--mp-ink-2); border-radius: 6px; width: 24px; height: 24px; cursor: pointer; padding: 0; line-height: 1; }
.vX:hover { border-color: var(--mp-blue); color: var(--mp-blue); }
body.touch .vLista { max-height: 34vh; }
body.touch .vFila { padding: 9px 8px; font-size: 13px; }
body.touch .vX { width: 34px; height: 34px; }
#canvas rect.visual { fill: rgba(10,143,60,.16); stroke: #0a8f3c; stroke-width: 0.8; pointer-events: none; }
#canvas rect.visual.fuera { fill: none; stroke: #B9C4D2; stroke-dasharray: 3 3; }
#canvas rect.visual.cur { stroke: #E06C00; stroke-width: 1.6; fill: rgba(255,140,0,.18); }
#canvas rect.visual.molde { stroke: #0b84ff; stroke-width: 1.4; fill: rgba(11,132,255,.14); }
/* Leer la leyenda (E4): el mismo panel flotante que la búsqueda visual, con
   filas de revisión que llevan el dibujito del ingeniero, el nombre editable
   y la pareja propuesta de la biblioteca. */
#leyBox {
  position: fixed; right: 276px; top: 78px; z-index: 61; width: 360px; max-width: calc(100vw - 16px);
  background: var(--mp-card); border: 1px solid var(--mp-line); border-radius: 14px;
  box-shadow: 0 2px 6px rgba(7,26,46,.05), 0 20px 44px -14px rgba(7,26,46,.35); overflow: hidden;
}
#leyBox.oculto { display: none; }
#leyCab { display: flex; align-items: center; gap: 8px; padding: 7px 9px; background: var(--mp-sky-2); border-bottom: 1px solid var(--mp-line); cursor: move; touch-action: none; user-select: none; }
#leyTit { font-weight: 600; font-size: 12px; flex: 1; letter-spacing: .1em; color: var(--mp-ink); }
#leyCab button { border: 1px solid var(--mp-line); background: var(--mp-card); color: var(--mp-ink); border-radius: 7px; width: 26px; height: 26px; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; }
#leyCuerpo { padding: 8px 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
#leyCuerpo .bMuted { color: var(--mp-ink-2); line-height: 1.5; }
#leyCuerpo .vN { font-size: 13px; }
#leyCuerpo button { padding: 6px 9px; border: 1px solid rgba(27,60,140,.18); border-radius: 9px; background: linear-gradient(180deg, #FFFFFF 0%, #F2F9FD 100%); color: var(--mp-navy); font-size: 12px; font-weight: 600; cursor: pointer; }
#leyCuerpo button[disabled] { opacity: .45; cursor: default; }
.lyLista { max-height: 46vh; overflow: auto; margin: 4px 0; border: 1px solid var(--mp-line); border-radius: 9px; }
.lyFila { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--mp-line); }
.lyFila:last-child { border-bottom: 0; }
.lyFila.fuera { opacity: .5; }
.lyFila input[type=checkbox] { flex: none; margin: 4px 0 0; }
.lyGlifo { flex: none; width: 56px; height: 40px; object-fit: contain; border: 1px solid var(--mp-line); border-radius: 6px; background: #fff; }
.lyGlifo.lyVacio { display: inline-block; }
.lyTxt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lyNom { width: 100%; box-sizing: border-box; font-size: 12px; padding: 3px 6px; border: 1px solid var(--mp-line); border-radius: 6px; }
.lySel { width: 100%; box-sizing: border-box; font-size: 11px; padding: 3px 4px; border: 1px solid var(--mp-line); border-radius: 6px; background: #fff; }
.lyDet { font-size: 10.5px; color: var(--mp-ink-2); line-height: 1.35; }
body.touch #leyBox { right: 8px; top: 76px; width: min(380px, calc(100vw - 16px)); }
body.touch #leyCab button { width: 34px; height: 34px; }
body.touch .lyFila { padding: 9px 8px; }
body.touch .lyNom, body.touch .lySel { font-size: 13px; padding: 6px; }
body.touch #visualBox { right: 8px; top: 76px; width: min(340px, calc(100vw - 16px)); }
body.touch #visualCab button { width: 34px; height: 34px; }
svg.tool-vsearch { cursor: crosshair; }

/* Buscar texto en el PDF del ingeniero (5.8) */
#buscaBox {
  position: fixed; left: 250px; top: 78px; z-index: 61;
  width: 380px; max-width: calc(100vw - 16px);
  height: 340px; max-height: calc(100vh - 90px);
  display: flex; flex-direction: column;
  background: var(--mp-card); border: 1px solid var(--mp-line); border-radius: 14px;
  box-shadow: 0 2px 6px rgba(7,26,46,.05), 0 20px 44px -14px rgba(7,26,46,.35); overflow: hidden; resize: both;
}
#buscaBox.oculto { display: none; }
#buscaCab {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  background: var(--mp-sky-2); border-bottom: 1px solid var(--mp-line);
  cursor: move; touch-action: none; user-select: none;
}
#buscaTit { font-weight: 600; font-size: 12.5px; flex: 1; letter-spacing: .11em; color: var(--mp-ink); }
#buscaCab button { border: 1px solid var(--mp-line); background: var(--mp-card); color: var(--mp-ink); border-radius: 7px; width: 26px; height: 26px; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; }
#buscaCab button:hover { background: var(--mp-sky-2); border-color: var(--mp-blue); }
#buscaFiltro { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--mp-line); }
#buscaFiltro input[type=search] { flex: 1; min-width: 0; padding: 6px 9px; border: 1.5px solid var(--mp-line); border-radius: 9px; font-size: 12px; background: #fff; }
#buscaFiltro input[type=search]:focus { outline: none; border-color: var(--mp-blue); box-shadow: 0 0 0 3px rgba(42,91,215,.14); }
#buscaFiltro .lay { flex: none; font-size: 11px; color: var(--mp-ink-2); white-space: nowrap; }
#buscaLista { flex: 1; overflow: auto; padding: 4px 0; }
#buscaLista .bMuted { color: var(--mp-ink-2); font-size: 12px; padding: 12px 12px; line-height: 1.5; }
#buscaLista .bFila { display: flex; align-items: baseline; gap: 8px; padding: 5px 10px; cursor: pointer; font-size: 12px; border-bottom: 1px solid var(--mp-line); }
#buscaLista .bFila:hover { background: var(--mp-sky-2); }
#buscaLista .bFila.cur { background: var(--mp-sky-3); }
#buscaLista .bHoja { flex: none; font-size: 10px; font-weight: 700; color: var(--mp-teal-text); min-width: 34px; }
#buscaLista .bTxt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#canvas rect.busca { fill: rgba(242,194,48,.32); stroke: #E0A800; stroke-width: 0.6; pointer-events: none; }
#canvas rect.busca.cur { fill: rgba(255,140,0,.42); stroke: #E06C00; stroke-width: 1.2; }
/* ======= BIBLIOTECA DE TAKEOFF (tool sets de Bluebeam) ======= */
#tlibBox {
  position: fixed; left: 250px; top: 78px; z-index: 61;
  width: 440px; max-width: calc(100vw - 16px);
  height: 460px; max-height: calc(100vh - 90px);
  display: flex; flex-direction: column;
  background: var(--mp-card); border: 1px solid var(--mp-line); border-radius: 14px;
  box-shadow: 0 2px 6px rgba(7,26,46,.05), 0 20px 44px -14px rgba(7,26,46,.35); overflow: hidden; resize: both;
}
#tlibBox.oculto { display: none; }
#tlibCab { display: flex; align-items: center; gap: 8px; padding: 7px 9px; background: var(--mp-sky-2); border-bottom: 1px solid var(--mp-line); cursor: move; touch-action: none; user-select: none; }
#tlibTit { font-weight: 600; font-size: 12.5px; flex: 1; letter-spacing: .11em; color: var(--mp-ink); }
#tlibCab button { border: 1px solid var(--mp-line); background: var(--mp-card); color: var(--mp-ink); border-radius: 7px; width: 26px; height: 26px; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; }
#tlibCab button:hover { background: var(--mp-sky-2); border-color: var(--mp-blue); }
#tlibFiltro { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--mp-line); }
#tlibFiltro input[type=search] { flex: 1; min-width: 0; padding: 6px 9px; border: 1.5px solid var(--mp-line); border-radius: 9px; font-size: 12px; background: #fff; }
#tlibFiltro input[type=search]:focus { outline: none; border-color: var(--mp-blue); box-shadow: 0 0 0 3px rgba(42,91,215,.14); }
#tlibFiltro .lay { flex: none; font-size: 11px; color: var(--mp-ink-2); white-space: nowrap; }
#tlibLista { flex: 1; overflow: auto; padding: 2px 0; }
#tlibLista .bMuted { color: var(--mp-ink-2); font-size: 12px; padding: 12px 12px; line-height: 1.5; }
#tlibLista .tlSet { display: flex; align-items: center; gap: 7px; padding: 6px 10px; cursor: pointer; font-size: 12.5px; background: var(--mp-sky-3, #f2f6fb); border-bottom: 1px solid var(--mp-line); user-select: none; position: sticky; top: 0; z-index: 1; }
#tlibLista .tlSet:hover { background: var(--mp-sky-2); }
#tlibLista .tlFlecha { width: 0; height: 0; border-left: 5px solid var(--mp-ink-2); border-top: 4px solid transparent; border-bottom: 4px solid transparent; flex: none; transition: transform .12s; }
#tlibLista .tlSet.on .tlFlecha { transform: rotate(90deg); }
#tlibLista .tlNom { font-weight: 600; color: var(--mp-ink); }
#tlibLista .tlN { flex: 1; font-size: 11px; color: var(--mp-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tlibLista .tlTodo { flex: none; border: 1px solid var(--mp-line); background: var(--mp-card); color: var(--mp-ink); border-radius: 7px; font-size: 11px; padding: 2px 8px; cursor: pointer; }
#tlibLista .tlTodo:hover { border-color: var(--mp-blue); background: var(--mp-sky-2); }
#tlibLista .tlFila { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 14px; cursor: pointer; font-size: 12px; border-bottom: 1px solid var(--mp-line); }
#tlibLista .tlFila:hover { background: var(--mp-sky-2); }
#tlibLista .tlFila input { flex: none; margin: 0; }
#tlibLista .tlFila.ya, #tlibLista .tlFila.largo { color: var(--mp-ink-2); cursor: default; }
/* la fila de una RUTA sí se toca: es un botón, no una casilla (E5) */
#tlibLista .tlFila.tlRuta { cursor: pointer; color: inherit; }
#tlibLista .tlFila.tlRuta .tlRtIco { flex: none; width: 15px; height: 15px; color: var(--mp-teal-text, #0b7285); display: inline-flex; }
#tlibLista .tlFila.tlRuta:hover { background: var(--mp-sky-3); }
#tlibLista .tlFila.ya .cntChip, #tlibLista .tlFila.largo .cntChip { opacity: .45; }
#tlibLista .tlTxt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
#tlibLista .tlSubj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tlibLista .tlDet { font-size: 10.5px; color: var(--mp-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tlibPie { display: flex; align-items: center; gap: 8px; padding: 6px 9px; border-top: 1px solid var(--mp-line); background: var(--mp-sky-2); }
#tlibPie button { border: 1px solid var(--mp-blue); background: var(--mp-blue); color: #fff; border-radius: 8px; padding: 6px 12px; font-size: 12px; cursor: pointer; flex: none; }
#tlibPie button:disabled { opacity: .45; cursor: default; }
body.touch #tlibBox { left: 8px; top: 76px; width: calc(100vw - 16px); height: 62vh; }
body.touch #tlibCab button { width: 34px; height: 34px; }
body.touch #tlibLista .tlFila { padding: 8px 10px 8px 14px; font-size: 13px; }
body.touch #tlibLista .tlFila input { width: 20px; height: 20px; }
body.touch #tlibPie button { padding: 9px 14px; font-size: 13px; }
body.touch #buscaBox { left: 8px; top: 76px; width: calc(100vw - 16px); height: 48vh; }
body.touch #buscaCab button { width: 34px; height: 34px; }
body.touch #marcasBox { left: 8px; top: 76px; width: calc(100vw - 16px); height: 55vh; }
body.touch #marcasCab button { width: 34px; height: 34px; }

/* ======= ENTRADA DINÁMICA (medida tecleada mientras se dibuja) ======= */
#dinBox { position: fixed; z-index: 70; display: none; align-items: center; gap: 6px; padding: 5px 8px;
  background: var(--mp-deep); color: #E8F3FA; border-radius: 9px; box-shadow: 0 4px 16px rgba(7,26,46,.4); font-size: 12px; }
#dinBox.on { display: flex; }
#dinBox span { color: var(--mp-cyan); font-weight: 600; letter-spacing: .3px; }
#dinBox input { width: 150px; border: 1px solid rgba(34,232,224,.35); background: var(--mp-card); color: var(--mp-ink); border-radius: 5px; padding: 3px 6px; font-size: 13px; font-family: inherit; }

/* ✒️ tinta (fase 5.4) */
svg.tool-pen, svg.tool-hi { cursor: crosshair; }
svg.tool-erase { cursor: cell; }
#canvas path.ink { pointer-events: none; }

/* ☁ nube (7.3) y pantalla de proyectos (7.4) */
.nubeBadge { flex: 1; font-size: 11px; color: var(--mp-ink-2); }
.nubeBadge.clic { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 2px; }
.nubeBadge.ok { color: #3B8E1E; }
.nubeBadge.subiendo, .nubeBadge.espera { color: var(--mp-blue); }
.nubeBadge.error { color: var(--mp-danger); font-weight: 600; }
.nubeBadge.sinred { color: #7A6A00; }
table.pmTabla { width: 100%; border-collapse: collapse; font-size: 12px; }
table.pmTabla th { text-align: left; font-size: 10.5px; letter-spacing: .11em; text-transform: uppercase; color: var(--mp-ink-2); border-bottom: 1px solid var(--mp-line); padding: 4px 6px; }
table.pmTabla td { border-bottom: 1px solid var(--mp-line); padding: 6px; vertical-align: top; }
table.pmTabla tr.cur td { background: var(--mp-sky-2); }
td.pmAcc { white-space: nowrap; text-align: right; }
td.pmAcc button { font-size: 11px; padding: 3px 8px; margin-left: 4px; border: 1px solid var(--mp-line); background: var(--mp-card); color: var(--mp-ink); border-radius: 7px; cursor: pointer; }
td.pmAcc button.danger { color: var(--mp-danger); border-color: rgba(179,56,59,.42); }
