/* =============================================================
   1. Tokens
   Estilo técnico, de programa de CAD (el mismo del panel de SIG Vial):
   caja casi negra, borde de 1 px, esquinas rectas, fuente monoespaciada,
   rótulos en mayúsculas y el amarillo como filo, no como fondo.
   Grises neutros, nunca azulados. El texto no baja de 11 px.
   ============================================================= */
:root {
  color-scheme: dark;
  --bg: #121212;
  --surface: #191919;
  --raised: #222222;
  --field: #0e0e0e;
  --ink: #e0e0e0;
  --muted: #9e9e9e;
  --line: #2a2a2a;
  --line-hi: #3a3a3a;
  --grid: rgb(255 255 255 / .028);
  --accent: #f5c300;
  --accent-ink: #111111;
  --accent-soft: #222222;
  --accent-glow: rgb(245 195 0 / .28);
  --danger: #f44336;
  --ok: #27ae60;
  --glass: #4f9bd9;
  --radius: 2px;
  --gutter: 1rem;
  --mono: "DM Mono", "Roboto Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --sans: var(--mono);
  --serif: var(--mono);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
body {
  font-family: var(--mono);
  font-size: .9rem;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
  /* grilla de fondo, como la de un tablero de dibujo */
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  font-synthesis-weight: none; /* DM Mono llega hasta 500: sin negrita falsa */
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--line-hi); }
img, svg { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; transition: box-shadow .15s, border-color .15s, color .15s, opacity .15s; }
input, select { transition: border-color .15s, box-shadow .15s; }
select option { background: var(--bg); }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
kbd {
  display: inline-grid; place-items: center; min-width: 1.5em; padding: 0 .3em;
  font: 500 .7rem/1.5 var(--mono); color: var(--muted);
  background: var(--field); border: 1px solid var(--line); border-radius: var(--radius);
}

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1140px; margin-inline: auto; padding-inline: var(--gutter); }
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 99;
  padding: .6rem 1rem; background: var(--accent); color: var(--accent-ink);
}
.skip-link:focus { top: 1rem; }
.eyebrow { font: 500 .72rem/1.4 var(--mono); letter-spacing: .22em; text-transform: uppercase; color: var(--accent); margin-bottom: .9rem; }

/* =============================================================
   4. Typography
   ============================================================= */
h1, h2 { font-family: var(--mono); font-weight: 500; line-height: 1.15; letter-spacing: .3px; text-wrap: balance; }
h3 { line-height: 1.25; font-weight: 500; letter-spacing: .3px; }
h1 { font-size: clamp(1.55rem, 4.4vw, 2.4rem); }
h2 { font-size: clamp(1.15rem, 2.6vw, 1.5rem); margin-bottom: .8rem; }
h3 { font-size: .95rem; margin: 1.25rem 0 .4rem; }
p { text-wrap: pretty; }
strong, b { font-weight: 500; color: #f0f0f0; }
.lead { color: var(--muted); font-size: .98rem; margin-top: .7rem; max-width: 62ch; }
.prose p, .prose ul { margin-bottom: .9rem; max-width: 74ch; }
.prose h2 { margin-top: 1.8rem; padding-left: .7rem; border-left: 3px solid var(--accent); }
.prose ul { padding-left: 1.2rem; }
.prose a { color: var(--accent); }

/* =============================================================
   5. Components
   ============================================================= */
.site-header { border-bottom: 1px solid var(--line); background: #1a1a1a; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 52px; }
.logo { display: inline-flex; align-items: center; gap: .5rem; font: 500 1rem/1 var(--mono); letter-spacing: 1.4px; text-transform: uppercase; text-decoration: none; }
.logo svg { width: 24px; height: 24px; color: var(--accent); }
.site-nav { display: flex; align-items: center; gap: 1.2rem; }
.nav-link { display: none; font-size: .76rem; letter-spacing: 1px; text-transform: uppercase; text-decoration: none; color: var(--muted); }
.nav-link:hover { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: .55rem 1rem; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  font-weight: 500; font-size: .76rem; letter-spacing: .8px; text-transform: uppercase; text-decoration: none; white-space: nowrap;
  transition: box-shadow .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:hover:not(:disabled) { box-shadow: 0 0 18px var(--accent-glow); }
.btn:active { opacity: .85; }
.btn svg { width: 18px; height: 18px; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-hi); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 12px rgb(245 195 0 / .12); }
.btn-sm { min-height: 38px; padding: .35rem .8rem; font-size: .72rem; }
.btn-lg { min-height: 50px; padding: .7rem 1.4rem; font-size: .82rem; }

.tool-card {
  display: grid; gap: 1.25rem;
  padding: 1.1rem; margin-top: 1.4rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.tool-form { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; align-content: start; }
.field { display: grid; gap: .25rem; align-content: start; min-width: 0; }
.field.wide, .field-check { grid-column: 1 / -1; }
.field label { font-size: .78rem; font-weight: 500; color: #c8c8c8; }
.field .unit { font-weight: 400; color: var(--muted); }
.field small { font-size: .72rem; color: var(--muted); line-height: 1.35; }
.field input[type="text"], .field select {
  width: 100%; min-height: 44px; padding: .5rem .7rem;
  background: var(--field); border: 1px solid var(--line); border-radius: var(--radius);
}
.field input[type="text"]:focus, .field select:focus { outline: 1px solid var(--accent); outline-offset: 0; border-color: transparent; box-shadow: 0 0 8px rgb(245 195 0 / .08); }
.field-check label { display: flex; align-items: center; gap: .55rem; min-height: 44px; font-weight: 400; }
/* Casillas cuadradas: las nativas son redondeadas y del sistema operativo. */
.field-check input, .ws-layer input {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 16px; height: 16px; background: #0a0a0a; border: 1px solid #444; border-radius: 0;
}
.field-check input:hover, .ws-layer input:hover { border-color: #777; }
.field-check input:checked, .ws-layer input:checked { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px #0a0a0a; }
[aria-invalid="true"] { border-color: var(--danger) !important; }

.tool-result { padding: 1rem; background: #141414; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); align-self: start; }
.result-main { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; }
.stat { display: grid; }
.stat-label { font: 500 .7rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.stat-value { font: 500 clamp(1.8rem, 7vw, 2.4rem)/1.05 var(--mono); color: var(--accent); font-variant-numeric: tabular-nums; }
.stat-unit { font-size: .78rem; color: var(--muted); }
.result-rows { margin-top: 1rem; border-top: 1px solid var(--line); }
.result-rows div { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.result-rows dt { color: var(--muted); font-size: .8rem; }
.result-rows dd { font-weight: 500; font-size: .84rem; text-align: right; font-variant-numeric: tabular-nums; }
.result-section { margin: 1.1rem 0 0; font: 500 .7rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--accent); }
.result-section + .result-rows { margin-top: .3rem; }
.result-notes { margin-top: .75rem; padding-left: 1.1rem; font-size: .74rem; color: var(--muted); }
.result-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.result-error { color: var(--danger); font-weight: 500; }

/* Costo estimado: plegado bajo el resultado, con el total a la vista y precios editables. */
.cost { margin-top: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.cost > summary { display: flex; align-items: center; gap: .75rem; min-height: 48px; padding: .5rem .8rem; cursor: pointer; list-style: none; }
.cost > summary::-webkit-details-marker { display: none; }
.cost > summary::after { content: ""; flex: none; width: 6px; height: 6px; border: solid var(--muted); border-width: 0 1px 1px 0; transform: rotate(45deg); transition: transform .2s var(--ease-out); }
.cost[open] > summary::after { transform: rotate(-135deg); }
.cost > summary:hover .cost-title { color: var(--accent); }
.cost > summary:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
.cost-head { display: grid; gap: .1rem; min-width: 0; }
.cost-title { font: 500 .7rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--ink); white-space: nowrap; }
.cost-flag { font-size: .7rem; color: var(--accent); }
.cost-total { margin-left: auto; font-weight: 500; font-size: 1rem; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cost-body { padding: 0 .8rem .8rem; border-top: 1px solid var(--line); }
.cost-meta { margin-top: .7rem; font-size: .74rem; color: var(--muted); line-height: 1.45; }
.cost-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .3rem .75rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.cost-name { font-size: .8rem; }
.cost-sub { font-weight: 500; font-size: .84rem; text-align: right; font-variant-numeric: tabular-nums; }
.cost-sub.is-empty { font-weight: 400; color: var(--muted); }
.cost-qty { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cost-price { display: flex; align-items: center; justify-content: flex-end; gap: .35rem; min-width: 0; font-size: .74rem; color: var(--muted); }
.cost-price input {
  width: 8.5rem; min-height: 40px; padding: .35rem .55rem; text-align: right; font-variant-numeric: tabular-nums;
  background: var(--field); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius);
}
.cost-price input::placeholder { color: var(--accent); opacity: .75; }
.cost-price input:focus { outline: 1px solid var(--accent); outline-offset: 0; border-color: transparent; }
.cost-per { min-width: 0; white-space: nowrap; }
.cost-work { margin-top: .45rem; font-size: .72rem; color: var(--muted); }
.cost-totals { margin-top: .9rem; }
.cost-grand dt, .cost-grand dd { color: var(--accent); font-size: .92rem; font-weight: 500; }
.cost-missing { margin-top: .6rem; font-size: .76rem; color: var(--accent); }
.cost .btn { margin-top: .75rem; }
/* Celular: el precio pasa a su propia fila, a lo ancho. */
@media (max-width: 480px) {
  .cost-qty, .cost-price { grid-column: 1 / -1; }
  .cost-price input { flex: 1; width: auto; min-width: 0; }
}
@media print {
  .cost-price input { border: 0; padding: 0; width: auto; }
  .cost .btn, .cost-meta { display: none; }
}
.stair { width: 100%; max-height: 180px; margin-top: 1rem; }
.stair path { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: miter; }

.badge { margin-top: .8rem; font-size: .78rem; color: var(--muted); }

.ad-slot {
  display: grid; place-items: center; min-height: 100px; margin: 2.5rem 0;
  border: 1px dashed var(--line-hi); border-radius: var(--radius); background: transparent;
  font: 500 .7rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: #666;
}

.steps { display: grid; gap: .9rem; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: auto 1fr; gap: .8rem; align-items: start; align-content: start; }
.steps li::before {
  content: "0" counter(step); font: 500 .8rem/1.9 var(--mono); color: var(--accent);
  padding-top: .05rem; border-top: 2px solid var(--accent);
}

.faq details { border-bottom: 1px solid var(--line); padding: .8rem 0; }
.faq summary { font-weight: 500; cursor: pointer; }
.faq summary:hover { color: var(--accent); }
.faq details p { margin-top: .5rem; color: var(--muted); max-width: 74ch; }

.cards { display: grid; gap: .8rem; padding: 0; margin-top: 1.2rem; list-style: none; }
.card {
  display: grid; grid-template-columns: auto 1fr; gap: .2rem .9rem; align-items: center;
  height: 100%; padding: 1rem; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-hi); border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: var(--line-hi); border-left-color: var(--accent); box-shadow: 0 0 12px rgb(245 195 0 / .12); }
.card svg { grid-row: span 2; width: 30px; height: 30px; color: var(--accent); stroke-width: 1.2; }
.card strong { font-size: .9rem; letter-spacing: .3px; }
.card span { font-size: .78rem; color: var(--muted); line-height: 1.4; }

.site-footer { margin-top: 3.5rem; padding: 1.5rem 0 2rem; border-top: 1px solid var(--line); font-size: .76rem; color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-bottom: .6rem; text-transform: uppercase; letter-spacing: 1px; }
.site-footer a:hover { color: var(--accent); }
.todo { padding: .1rem .35rem; border: 1px solid var(--accent); color: var(--accent); font-weight: 500; font-size: .72rem; letter-spacing: 1px; }

/* Símbolos del plano: los comparten el lienzo, las miniaturas de la biblioteca y la vista previa de la portada. */
.plan-svg .grid-line { fill: none; stroke: var(--line); }
.plan-svg .room { fill: #1e1e1e; }
.plan-svg .room.sel { fill: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.plan-svg .wall { stroke: var(--ink); stroke-linecap: square; }
.plan-svg .wall.int { stroke: var(--muted); }
.plan-svg .wall-fin { stroke: #555; stroke-linecap: square; } /* revoques: el espesor terminado, debajo del núcleo */
.plan-svg .wall.under { stroke: var(--muted); stroke-linecap: butt; opacity: .28; }
.plan-svg .gap { stroke: var(--bg); }
.plan-svg .door { fill: none; stroke: var(--ink); }
.plan-svg .window { stroke: var(--glass); }
.plan-svg .wall.sel, .plan-svg .door.sel, .plan-svg .window.sel { stroke: var(--accent); }
.plan-svg .item { fill: var(--surface); stroke: #bdbdbd; }
.plan-svg .item.electric { stroke: var(--accent); }
.plan-svg .item.sel { stroke: var(--accent); fill: #2a2610; }
.plan-svg .ghost { opacity: .55; }
.plan-svg .select-box { fill: color-mix(in srgb, var(--accent) 10%, transparent); stroke: var(--accent); stroke-dasharray: 5 4; }
.plan-svg .surface { fill: #161616; stroke: #666; stroke-dasharray: 6 4; }
.plan-svg .surface.sel { stroke: var(--accent); fill: #2a2610; }
.plan-svg .wire { fill: none; stroke: var(--accent); }
.plan-svg .sketch-wall { stroke: var(--accent); stroke-linecap: square; opacity: .85; }
.plan-svg .sketch-window { stroke: var(--glass); }
.plan-svg .sketch-door { fill: none; stroke: var(--ink); }
.plan-svg .roof-outline { fill: none; stroke: var(--glass); }
.plan-svg .section-line { stroke: var(--danger); }
.plan-svg .note { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; }
.plan-svg .note-halo { fill: none; stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round; opacity: .45; }
.plan-svg .note-text { fill: var(--ink); }
.plan-svg .section-tag { fill: var(--danger); font-weight: 500; }
.section-svg { width: 100%; height: auto; margin: .2rem 0 .6rem; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.section-svg .cut { fill: var(--ink); }
.section-svg .slab { fill: var(--muted); }
.section-svg .void { fill: var(--glass); }
.section-svg .ground, .section-svg .level { stroke: var(--muted); stroke-width: 2; }
.section-svg .level { stroke-dasharray: 10 8; }
.section-svg .roofline { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linejoin: miter; }
.section-svg text { fill: var(--muted); font-family: var(--mono); }
.plan-svg .measure-label { fill: var(--accent); font-weight: 500; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; }
.plan-svg .handle { fill: var(--bg); stroke: var(--accent); cursor: move; }
.plan-svg .preview { fill: none; stroke: var(--accent); }
.plan-svg .cursor { fill: var(--accent); }
.plan-svg text { text-anchor: middle; dominant-baseline: middle; pointer-events: none; fill: var(--muted); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.plan-svg .room-label { fill: var(--ink); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.plan-svg .room-area { fill: var(--muted); }
.plan-svg .preview-label { fill: var(--accent); font-weight: 500; text-anchor: start; }
.plan-svg .ruler { fill: var(--bg); opacity: .94; }
.plan-svg .ruler-tick { stroke: #666; }
.plan-svg .ruler-text { text-anchor: start; font-family: var(--mono); }

/* =============================================================
   6. Sections
   ============================================================= */
.hero { padding-top: 2rem; }
.section { margin-top: 3rem; }
.section > h2 { padding-left: .7rem; border-left: 3px solid var(--accent); }

.hero-home { display: grid; gap: 2rem; align-items: center; padding-top: 2.5rem; }
.hero-home h1 { font-size: clamp(1.75rem, 5.4vw, 2.9rem); }
.hero-cta { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.6rem; }
.hero-preview {
  display: block; padding: .6rem; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 4px 16px rgb(0 0 0 / .7);
  transition: border-color .15s, box-shadow .15s;
}
.hero-preview:hover { border-color: var(--line-hi); box-shadow: 0 0 18px rgb(245 195 0 / .12); }
.hero-preview svg { width: 100%; height: auto; background: var(--bg); }
.hero-stats { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.hero-stats span { padding: .2rem .55rem; border: 1px solid var(--line); background: #141414; font-size: .72rem; color: var(--muted); }
.hero-stats b { color: var(--accent); font-variant-numeric: tabular-nums; }

/* Presupuesto de obra (presupuesto.html) */
.pb { margin-top: 1.4rem; }
.pb-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .35rem; scrollbar-width: thin; }
.pb-tabs button { flex: none; white-space: nowrap; background: var(--surface); }
.pb-note { margin: .7rem 0 0; padding: .6rem .8rem; color: var(--ink); background: #141414; border: 1px solid var(--line); border-left: 3px solid var(--ok); border-radius: var(--radius); }
.pb-view { margin-top: .9rem; }
.pb-tip { max-width: 92ch; margin: .2rem 0 .8rem; font-size: .78rem; line-height: 1.55; color: var(--muted); }
.pb-tip strong { color: var(--ink); }
.pb-right { margin-left: auto; max-width: 520px; }
.pb-link { padding: 0; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.pb-head { margin-bottom: .8rem; }
.pb-name { display: grid; gap: .25rem; max-width: 520px; font-size: .78rem; font-weight: 500; color: #c8c8c8; }
.pb input[type="text"], .pb input[type="search"], .pb select { min-height: 40px; padding: .35rem .6rem; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.pb input:focus, .pb select:focus { outline: 1px solid var(--accent); outline-offset: 0; border-color: transparent; }
.pb input::placeholder { color: var(--muted); opacity: .8; }
.pb-empty { padding: 1.4rem 1rem; background: var(--surface); border: 1px dashed var(--line-hi); border-radius: var(--radius); }
.pb-empty h2 { margin-bottom: 1rem; font-size: 1.05rem; }

.pb-lines { display: grid; gap: .5rem; margin-top: .9rem; }
.pb-line { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .5rem .8rem; padding: .7rem .8rem; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-hi); border-radius: var(--radius); }
.pb-line.is-missing { border-left-color: var(--accent); }
.pb-n { font: 500 .72rem/1 var(--mono); color: var(--muted); }
.pb-what { display: grid; gap: .1rem; min-width: 0; }
.pb-what strong { font-size: .86rem; overflow-wrap: anywhere; }
.pb-what small { font-size: .7rem; color: var(--muted); }
.pb-qty { display: flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--muted); }
.pb-qty input { width: 6.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.pb-money { display: grid; gap: .1rem; font-variant-numeric: tabular-nums; }
.pb-rubro .pb-money { justify-items: end; text-align: right; }
.pb-money small { font-size: .66rem; color: var(--muted); }
.pb-money b { font-weight: 500; font-size: .86rem; white-space: nowrap; }
.pb-money .pb-sub { color: var(--accent); font-size: .95rem; }
.pb-acts { display: flex; align-items: center; justify-content: flex-end; gap: .4rem; }
.pb-more { min-height: 36px; padding: .2rem .6rem; font: 500 .7rem/1.2 var(--mono); letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius); }
.pb-more:hover { color: var(--accent); border-color: var(--accent); }
.pb-flag { font-size: .7rem; color: var(--accent); white-space: nowrap; }
.pb-x { width: 36px; height: 36px; flex: none; font-size: 1.1rem; line-height: 1; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius); }
.pb-x:hover { color: var(--danger); border-color: var(--danger); }
.pb-line > .pb-qty, .pb-line > .pb-money, .pb-line > .pb-acts { grid-column: 2 / -1; justify-self: start; }
.pb-line > .pb-acts { justify-self: stretch; }
.pb-detail { grid-column: 1 / -1; display: grid; gap: .6rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.pb-detail .btn { justify-self: start; }
.pb-add { margin: .8rem 0 1.2rem; }

.pb-picker { margin: .8rem 0 1.2rem; padding: .8rem; background: var(--raised); border: 1px solid var(--accent); border-radius: var(--radius); }
.pb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .8rem; }
.pb-bar input[type="search"] { flex: 1 1 14rem; min-width: 0; }
.pb-picklist { max-height: 22rem; overflow-y: auto; padding-right: .3rem; }
.pb-picklist h4, .pb-cat { margin: .9rem 0 .35rem; font: 500 .7rem/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.pb-picklist h4:first-child { margin-top: 0; }
.pb-pick { display: flex; align-items: center; justify-content: space-between; gap: .8rem; width: 100%; min-height: 46px; padding: .4rem .7rem; text-align: left; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.pb-pick + .pb-pick { margin-top: .25rem; }
.pb-pick:hover { border-color: var(--accent); }
.pb-pick span { display: grid; gap: .1rem; min-width: 0; font-size: .82rem; }
.pb-pick small { font-size: .7rem; color: var(--muted); }
.pb-pick b { flex: none; font: 500 .7rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }

.pb-needs, .pb-rubro { margin-top: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.pb-needs > summary, .pb-rubro > summary { display: flex; align-items: center; gap: .7rem; min-height: 48px; padding: .5rem .8rem; cursor: pointer; list-style: none; }
.pb-needs > summary::-webkit-details-marker, .pb-rubro > summary::-webkit-details-marker { display: none; }
.pb-needs > summary { flex-wrap: wrap; font: 500 .78rem/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.pb-needs > summary small { font-size: .72rem; letter-spacing: 0; text-transform: none; color: var(--muted); }
.pb-needs > summary::after, .pb-rubro > summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.pb-needs[open] > summary::after, .pb-rubro[open] > summary::after { content: "▴"; }
.pb-needs > .pb-tip, .pb-needs > .sp-scroll { margin: 0 .8rem .8rem; }
.pb-rubro > summary .pb-what { flex: 1; }
.pb-rubro > summary .pb-money { flex: none; }
.pb-rubro > summary::after { margin-left: 0; }
.pb-rubro[open] { border-color: var(--line-hi); }
.pb-body { display: grid; gap: .8rem; padding: .2rem .8rem .9rem; border-top: 1px solid var(--line); }
.pb-fields { display: grid; gap: .6rem; margin-top: .7rem; }
.pb-fields input, .pb-form input[type="text"], .pb-form select { width: 100%; min-width: 0; }
.pb-fields label, .pb-form label, .pb-newcomp label, .pb-direct label { display: grid; gap: .25rem; font-size: .76rem; font-weight: 500; color: #c8c8c8; }
.pb-newcomp { display: grid; gap: .6rem; align-items: end; padding: .7rem; background: var(--field); border: 1px dashed var(--line-hi); border-radius: var(--radius); }
.pb-newcomp select { width: 100%; }
.pb-direct { display: flex; flex-wrap: wrap; gap: .8rem 1.4rem; }
.pb-form { display: grid; gap: .7rem; margin-bottom: 1rem; padding: .9rem; background: var(--raised); border: 1px solid var(--accent); border-radius: var(--radius); }
.pb-form h3 { font: 500 .78rem/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.pb-form fieldset { display: grid; gap: .3rem; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: var(--radius); }
.pb-form legend { padding: 0 .3rem; font-size: .76rem; color: #c8c8c8; }
.pb-form fieldset label { display: flex; align-items: flex-start; gap: .5rem; font-weight: 400; }
.pb-form input[type="radio"] { margin-top: .2rem; accent-color: var(--accent); }
.pb-chips { display: flex; flex-wrap: wrap; gap: .25rem; }
.pb-chips button { min-height: 38px; padding: .3rem .7rem; font: 500 .7rem/1.2 var(--mono); letter-spacing: .04em; color: var(--muted); background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.pb-chips button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

.pb-table { min-width: 560px; }
.pb-table td:first-child { overflow-wrap: anywhere; }
.pb-table .pb-group td { padding: .45rem .6rem; background: #161616; font: 500 .66rem/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.pb-table tfoot strong { color: var(--accent); }
.pb-kind { display: block; font-size: .68rem; color: var(--muted); }
.pb-none { font-size: .72rem; color: var(--muted); }
.pb-price { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); }
.pb-price input, .pb .sp-table .pb-price input { width: 7.5rem; min-height: 36px; text-align: right; font-variant-numeric: tabular-nums; }
.pb-price input::placeholder { color: var(--accent); opacity: .75; }
.pb-pase { margin-top: 1.4rem; justify-content: flex-end; }
.pb-tools { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.4rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.btn.is-armed { color: var(--danger); border-color: var(--danger); }
.pb-terms { display: grid; gap: .6rem; margin-top: 1rem; }
.pb-terms div { padding: .7rem .8rem; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); }
.pb-terms dt { font: 500 .74rem/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.pb-terms dd { margin-top: .2rem; font-size: .84rem; color: #c8c8c8; }

/* De AutoCAD a render (portada) */
.cad-drop {
  display: grid; justify-items: center; gap: .6rem; margin-top: 1.2rem; padding: 2.2rem 1rem; text-align: center;
  background: var(--surface); border: 1px dashed var(--line-hi); border-radius: var(--radius);
  transition: border-color .15s, background-color .15s;
}
.cad-drop.is-over { border-color: var(--accent); background: var(--raised); }
.cad-drop > svg { width: 40px; height: 40px; color: var(--accent); }
.cad-drop .hero-cta { justify-content: center; margin-top: .6rem; }
.cad-drop .badge { max-width: 62ch; }
.cad-msg { margin-top: .8rem; color: var(--muted); }
.cad-msg:empty { display: none; }
.cad-msg.is-error { padding: .7rem .9rem; color: var(--ink); background: #141414; border: 1px solid var(--line); border-left: 3px solid var(--danger); border-radius: var(--radius); }
.cad-work { display: grid; gap: 1rem; margin-top: 1.2rem; }
.cad-stage { position: relative; height: min(70vh, 460px); overflow: hidden; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.cad-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.cad-stage output { min-width: 2.6rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.cad-side { display: grid; gap: .8rem; align-content: start; min-width: 0; }
.cad-found { font-size: .82rem; color: var(--muted); }
.cad-plan { padding: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.cad-plan svg { display: block; width: 100%; height: auto; max-height: 260px; background: var(--bg); }
.cad-side > label, .cad-dxf > label { display: grid; gap: .25rem; font-size: .78rem; font-weight: 500; color: #c8c8c8; }
.cad-side select { width: 100%; min-height: 40px; padding: .4rem .6rem; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.cad-side select:focus { outline: 1px solid var(--accent); outline-offset: 0; border-color: transparent; }
.cad-dxf { display: grid; gap: .8rem; }
.cad-dxf summary { font-size: .78rem; font-weight: 500; color: #c8c8c8; cursor: pointer; }
.cad-layers { display: grid; gap: .1rem; max-height: 190px; margin-top: .4rem; padding: .4rem .6rem; overflow: auto; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.cad-layers label { display: flex; align-items: center; gap: .5rem; min-height: 30px; font-size: .78rem; }
.cad-layers small { margin-left: auto; color: var(--muted); }
.cad-layers input { accent-color: var(--accent); }
.cad-side .hero-cta { margin-top: .2rem; }
.cad-drop-note { max-width: 56ch; font-size: .84rem; color: var(--muted); }
.cad-slots { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: .4rem; }
.cad-slot {
  display: grid; gap: .15rem; min-width: 11rem; min-height: 56px; padding: .55rem .9rem; text-align: left;
  background: var(--field); border: 1px dashed var(--line-hi); border-radius: var(--radius); cursor: pointer;
}
.cad-slot b { font-size: .86rem; font-weight: 500; }
.cad-slot span { overflow: hidden; max-width: 16rem; font-size: .74rem; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.cad-slot:hover, .cad-slot:focus-visible { border-color: var(--accent); outline: none; }
.cad-slot.is-loaded { border-style: solid; border-color: var(--accent); }
.cad-slot.is-loaded span { color: var(--ink); }
.cad-guide { margin-top: .8rem; font-size: .84rem; }
.cad-guide summary { color: #c8c8c8; cursor: pointer; }
.cad-guide ul { display: grid; gap: .4rem; margin-top: .6rem; padding-left: 1.2rem; color: var(--muted); }
.cad-plan .cad-fence { stroke: var(--accent); stroke-dasharray: 18 12; opacity: .75; fill: none; }
.cad-plan .cad-hit { stroke: transparent; cursor: pointer; pointer-events: stroke; }
.cad-plan .cad-hit:hover { stroke: var(--accent); stroke-opacity: .25; }
.cad-tip { display: flex; gap: .5rem; align-items: baseline; font-size: .76rem; color: var(--muted); }
.cad-key-fence { flex: none; width: 22px; height: 0; border-top: 3px dashed var(--accent); transform: translateY(-.2em); }
.cad-drawings summary { font-size: .78rem; font-weight: 500; color: #c8c8c8; cursor: pointer; }
.cad-drawings[open] > summary { margin-bottom: .5rem; }
.cad-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; }
.cad-tile { display: grid; gap: .3rem; align-content: start; margin: 0; padding: .35rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.cad-tile.is-planta { border-color: var(--accent); }
.cad-tile.is-otro .cad-thumb svg { opacity: .45; }
.cad-thumb { position: relative; display: block; width: 100%; padding: 0; background: var(--bg); border: 0; border-radius: var(--radius); cursor: pointer; }
.cad-thumb svg { display: block; width: 100%; height: 96px; }
.cad-thumb:hover, .cad-thumb:focus-visible { outline: 1px solid var(--accent); outline-offset: 0; }
.cad-ink { fill: none; stroke: var(--muted); stroke-width: .8; vector-effect: non-scaling-stroke; }
.cad-tile.is-planta .cad-ink { stroke: var(--ink); }
.cad-badge { position: absolute; top: 4px; left: 4px; padding: .05rem .35rem; font: 500 .66rem/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.cad-tile.is-planta .cad-badge { color: var(--accent-ink, #111); background: var(--accent); border-color: var(--accent); }
.cad-tile.is-corte .cad-badge, .cad-tile.is-vista .cad-badge, .cad-tile.is-techo .cad-badge { color: var(--ink); }
.cad-tile figcaption { display: grid; gap: .25rem; font-size: .7rem; color: #c8c8c8; }
.cad-tile figcaption small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.cad-side .cad-tile select { min-height: 34px; padding: .2rem .4rem; font-size: .74rem; }
.cad-add { display: flex; flex-wrap: wrap; gap: .4rem; }
.cad-add .btn { flex: 1; }

/* Espacio de trabajo del diseñador */
.ws {
  display: grid; grid-template-columns: minmax(0, 1fr);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.ws-top {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem;
  padding: .4rem .75rem; border-bottom: 1px solid var(--line); background: #1a1a1a;
}
.ws-top .logo { font-size: .88rem; }
.ws-top .logo svg { width: 22px; height: 22px; }
.ws-name { display: grid; flex: 1 1 9rem; min-width: 0; }
.ws-name input { width: 100%; padding: 0 .25rem; font-weight: 500; background: none; border: 1px solid transparent; border-radius: var(--radius); }
.ws-name input:hover, .ws-name input:focus { border-color: var(--line-hi); background: var(--field); outline: none; }
.ws-name small { padding-left: .25rem; font-size: .7rem; color: #777; text-transform: uppercase; letter-spacing: .8px; }
.ws-level { min-height: 38px; max-width: 9.5rem; padding: .3rem .5rem; font-size: .78rem; font-weight: 500; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.ws-group { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); background: var(--field); }
.ws-group output { min-width: 3.2rem; text-align: center; font: 500 .74rem/1 var(--mono); color: var(--muted); }
.ws-views button { min-width: 44px; height: 38px; padding: 0 .7rem; font: 500 .78rem/1 var(--mono); letter-spacing: 1px; color: var(--muted); }
.ws-views button[aria-pressed="true"] { background: var(--raised); color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.ws-3d { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: var(--bg); }
.ws-3d canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.ws-3d p { position: relative; z-index: 1; max-width: 36ch; padding: 1rem; text-align: center; color: var(--muted); }
.v3d-bar { position: absolute; z-index: 2; top: .6rem; left: .6rem; right: .6rem; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; pointer-events: none; }
.v3d-bar > * { pointer-events: auto; }
.v3d-bar button, .v3d-bar label { display: flex; align-items: center; gap: .5rem; height: 38px; padding: 0 .7rem; font: 500 .72rem/1 var(--mono); letter-spacing: 1px; text-transform: uppercase; color: var(--muted); background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.v3d-bar button:hover { color: var(--accent); }
.v3d-bar button[aria-pressed="true"] { background: var(--raised); color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.v3d-bar button:disabled { opacity: .4; pointer-events: none; }
.v3d-bar input[type="range"] { width: 7rem; accent-color: var(--accent); }
.v3d-bar select { height: 100%; padding: 0 .2rem; font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--ink); background: var(--field); border: 0; }
.v3d-pad { position: absolute; z-index: 2; right: .8rem; bottom: .8rem; display: grid; grid-template-columns: repeat(3, 46px); grid-auto-rows: 46px; gap: 4px; touch-action: none; user-select: none; -webkit-user-select: none; }
.v3d-pad button { color: #bdbdbd; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); touch-action: none; }
.v3d-pad button:active { background: var(--raised); color: var(--accent); }
.v3d-hint { position: absolute; z-index: 2; left: .8rem; bottom: .8rem; max-width: calc(100% - 12rem); padding: .4rem .6rem; font: 500 .7rem/1.4 var(--mono); color: var(--muted); background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
@media (any-pointer: coarse) { .v3d-hint:not(.is-busy) { display: none; } }
.ws-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius); color: #bdbdbd; }
.ws-btn:hover { background: var(--raised); color: var(--accent); }
.ws-btn svg { width: 18px; height: 18px; stroke-width: 1.4; }

.ws-side, .ws-panel { min-width: 0; padding: .6rem; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--line) transparent; background: #141414; }
.ws-side { border-bottom: 1px solid var(--line); }
.ws-modes { display: grid; grid-template-columns: 1.4fr 1fr; gap: .3rem; font-size: .76rem; }
.ws-modes .ws-mode { font-size: inherit; overflow: hidden; }
.ws-mode, .ws-row {
  display: flex; align-items: center; gap: .55rem; width: 100%; min-height: 40px; padding: .35rem .6rem;
  border: 1px solid transparent; border-radius: var(--radius); font-size: .8rem; text-align: left; color: #c8c8c8;
}
.ws-mode { min-width: 0; padding-inline: .45rem; gap: .4rem; border-color: var(--line); font-weight: 500; }
.ws-mode svg, .ws-row svg { flex: none; width: 18px; height: 18px; stroke-width: 1.4; }
.ws-mode span, .ws-row span { flex: 1; }
.ws-mode:hover, .ws-row:hover { background: var(--raised); color: var(--ink); }
/* Elegido: el amarillo va como filo de 3 px a la izquierda, no como fondo. */
.ws-mode[aria-pressed="true"], .ws-row[aria-pressed="true"] { background: var(--raised); border-color: var(--line-hi); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.ws-multi { display: none; grid-column: 1 / -1; }
@media (any-pointer: coarse) { .ws-multi { display: flex; } }
.ws-sec { border-top: 1px solid var(--line); margin-top: .6rem; padding-top: .2rem; }
.ws-sec > summary {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .25rem; cursor: pointer; list-style: none;
  font: 500 .7rem/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: #c8c8c8;
}
.ws-sec > summary:hover { color: var(--accent); }
.ws-sec > summary::-webkit-details-marker { display: none; }
.ws-sec > summary::after { content: ""; margin-left: auto; width: 6px; height: 6px; border: solid #666; border-width: 0 1px 1px 0; transform: rotate(45deg); transition: transform .2s var(--ease-out); }
.ws-sec[open] > summary::after { transform: rotate(-135deg); }
.ws-sec > summary b { color: var(--accent); font-weight: 500; }
.ws-tip { padding: 0 .25rem .5rem; font-size: .72rem; color: #888; line-height: 1.6; }
.ws-layer { display: flex; align-items: center; gap: .6rem; min-height: 38px; padding: 0 .25rem; font-size: .8rem; }
.ws-panel .tool-form { padding: .2rem .25rem .6rem; }

.lib-title { margin: .2rem .25rem .4rem; font-size: .72rem; font-weight: 500; letter-spacing: .8px; text-transform: uppercase; color: #888; }
.lib-grid { display: flex; gap: .3rem; overflow-x: auto; padding: 0 .1rem .5rem; }
.lib-item {
  flex: 0 0 100px; display: grid; justify-items: center; gap: .1rem; padding: .3rem .25rem .4rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--field); text-align: center; line-height: 1.2;
}
.lib-item:hover { border-color: var(--line-hi); background: var(--surface); }
.lib-item[aria-pressed="true"] { border-color: var(--accent); background: var(--raised); box-shadow: inset 3px 0 0 var(--accent); }
.lib-item svg { width: 100%; height: auto; }
.lib-item span { font-size: .7rem; font-weight: 500; }
.lib-item small { font: 400 .7rem/1.3 var(--mono); color: #888; }

.checks { display: grid; gap: .45rem; padding: .2rem .25rem .4rem; list-style: none; font-size: .78rem; line-height: 1.45; }
.check { display: grid; grid-template-columns: auto 1fr; gap: .55rem; }
.check-mark { display: grid; place-items: center; width: 18px; height: 18px; margin-top: .1rem; font: 500 .7rem/1 var(--mono); color: #111; background: var(--muted); }
.check.is-ok .check-mark { background: var(--ok); }
.check.is-fail .check-mark { background: var(--danger); }
.check.is-fail .check-state { color: var(--danger); font-weight: 500; }
.check-state { font-weight: 500; }
.check-ref { white-space: nowrap; font: 400 .7rem/1 var(--mono); color: #888; }
[data-checks-count] { margin-left: .2rem; padding: .1rem .4rem; font-size: .7rem; letter-spacing: .04em; color: #111; background: var(--ok); }
[data-checks-count].is-fail { background: var(--danger); }
[data-checks-count]:empty { display: none; }

.lib-group { border-top: 1px solid var(--line); }
.lib-group > summary { padding: .5rem .25rem; font-size: .78rem; font-weight: 500; cursor: pointer; color: #c8c8c8; }
.lib-group > summary:hover { color: var(--accent); }
.lib-group .lib-item svg { height: 54px; }
.lib-group > .ws-tip { padding-bottom: .4rem; }
.lib-own { position: relative; flex: 0 0 100px; display: grid; }
.lib-remove { position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; font-size: 1rem; line-height: 1; color: #888; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.lib-remove:hover { color: var(--danger); border-color: var(--danger); }
@media (any-pointer: coarse) { .lib-remove { width: 32px; height: 32px; } }

.ws-toggle[aria-pressed="true"] { background: var(--raised); color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.ws-menu { position: relative; }
.ws-menu > summary { list-style: none; cursor: pointer; }
.ws-menu > summary::-webkit-details-marker { display: none; }
.ws-menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: grid; min-width: 16.5rem; padding: .25rem;
  background: #111; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 0; box-shadow: 0 4px 16px rgb(0 0 0 / .7);
}
.ws-menu-list button { min-height: 38px; padding: .4rem .7rem; font-size: .8rem; text-align: left; color: #c8c8c8; }
.ws-menu-list button:hover { background: var(--raised); color: var(--accent); }
.ws-ref { display: grid; gap: .5rem; padding: .3rem .6rem .7rem; font-size: .78rem; }
.ws-ref label { display: flex; align-items: center; gap: .5rem; }
.ws-ref input[type="text"] { width: 5rem; min-height: 36px; padding: .25rem .5rem; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
/* Deslizador técnico: riel de 1 px y cursor rectangular, como una regla. */
.ws-ref input[type="range"] { flex: 1; min-width: 0; appearance: none; -webkit-appearance: none; height: 16px; background: transparent; cursor: pointer; }
.ws-ref input[type="range"]::-webkit-slider-runnable-track { height: 1px; background: #444; }
.ws-ref input[type="range"]::-moz-range-track { height: 1px; background: #444; }
.ws-ref input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 7px; height: 15px; margin-top: -7px; background: var(--accent); border: none; border-radius: 0; }
.ws-ref input[type="range"]::-moz-range-thumb { width: 7px; height: 15px; background: var(--accent); border: none; border-radius: 0; }

.ws-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-bottom: 1px solid var(--line); }
.ws-canvas { position: relative; flex: 1; min-height: 0; background: var(--bg); }
.planner-canvas {
  display: block; width: 100%; height: 62vh; min-height: 340px;
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: default;
}
.planner-canvas[data-tool="pan"], .planner-canvas[data-pan] { cursor: grab; }
.planner-canvas[data-tool="wall"], .planner-canvas[data-tool="room"], .planner-canvas[data-tool="opening"], .planner-canvas[data-tool="note"] { cursor: crosshair; }
.ws-empty {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: .5rem;
  padding: 1rem; text-align: center; pointer-events: none;
}
.ws-empty strong { font: 500 clamp(1.1rem, 2.6vw, 1.4rem)/1.25 var(--mono); letter-spacing: .3px; }
.ws-empty p { color: var(--muted); font-size: .84rem; }
.ws-empty .ws-empty-note { max-width: 48ch; margin-top: .4rem; padding: .5rem .8rem; background: #111; border: 1px solid var(--line); border-left: 3px solid var(--accent); color: var(--ink); font-size: .8rem; text-align: left; }
.ws-empty div { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: .6rem; pointer-events: auto; }
.ws-status {
  display: none; position: absolute; left: 28px; bottom: 10px; display: flex; align-items: center; gap: .9rem;
  padding: .3rem .6rem; background: #111; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 0;
  font: 400 .7rem/1.4 var(--mono); color: var(--muted); pointer-events: none;
}
.ws-scale { border: solid var(--ink); border-width: 0 1px 1px; padding: 0 0 1px; text-align: center; white-space: nowrap; }
.planner-hint { padding: .5rem .75rem; font-size: .74rem; color: #888; border-top: 1px solid var(--line); background: #141414; }
/* Barra de propiedades. En pantallas chicas va debajo del lienzo, que ahí tiene alto fijo;
   en las grandes flota sobre él (ver más abajo), para que el plano no cambie de tamaño al aparecer. */
.inspector {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem;
  padding: .5rem .75rem; font-size: .78rem;
  background: #111; border-top: 1px solid var(--line);
}
.inspector strong { color: var(--accent); font-size: .72rem; letter-spacing: 1px; text-transform: uppercase; }
.inspector input[name="name"], .inspector input[name="text"] { width: 11rem; }
.swatches { display: inline-flex; flex-wrap: wrap; gap: .25rem; }
.swatch { --sw: var(--ink); width: 26px; height: 26px; border: 1px solid var(--line-hi); border-radius: var(--radius); background: var(--sw); }
.swatch:not([style]) { background: linear-gradient(135deg, var(--ink) 0 46%, var(--field) 46% 54%, var(--ink) 54%); }
.swatch:hover { border-color: var(--ink); }
.swatch[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (any-pointer: coarse) { .swatch { width: 34px; height: 34px; } }
.compare { width: 100%; margin: .2rem 0 .5rem; border-collapse: collapse; font-size: .76rem; font-variant-numeric: tabular-nums; }
.compare th, .compare td { padding: .35rem .4rem; border-bottom: 1px solid var(--line); text-align: right; font-weight: 400; }
.compare tbody th { text-align: left; color: var(--muted); }
.compare small { color: #777; }
.compare .is-on { color: var(--accent); font-weight: 500; }
.ws-present { display: none; }
.inspector select { min-height: 38px; max-width: 100%; padding: .3rem .5rem; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.inspector input { width: 5.2rem; min-height: 38px; padding: .3rem .5rem; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.inspector input:focus, .inspector select:focus, .ws-ref input[type="text"]:focus, .ws-level:focus { outline: 1px solid var(--accent); outline-offset: 0; box-shadow: 0 0 8px rgb(245 195 0 / .08); }
.inspector .btn:disabled { opacity: .45; cursor: not-allowed; }
.inspector .btn { min-height: 38px; padding: .3rem .7rem; font-size: .72rem; }

/* =============================================================
   7. Responsive
   ============================================================= */
@media (min-width: 540px) {
  :root { --gutter: 1.5rem; }
  .cards { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 720px) {
  .nav-link { display: inline; }
}
@media (min-width: 960px) {
  .hero { padding-top: 3rem; }
  .hero-home { grid-template-columns: 1.05fr 1fr; gap: 3rem; padding-top: 4rem; padding-bottom: 1rem; }
  .cad-work { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
  .pb-line { grid-template-columns: auto minmax(0, 1fr) auto auto auto auto; }
  .pb-line > .pb-qty, .pb-line > .pb-money, .pb-line > .pb-acts { grid-column: auto; justify-self: end; }
  .pb-line > .pb-money { min-width: 8.5rem; justify-items: end; text-align: right; }
  .pb-fields { grid-template-columns: 2fr 1fr 8rem; }
  .pb-newcomp { grid-template-columns: minmax(0, 1fr) 10rem auto; }
  .pb-terms { grid-template-columns: 1fr 1fr; }
  .cad-stage { height: 520px; }
  .tool-card { grid-template-columns: 1.1fr 1fr; gap: 1.75rem; padding: 1.5rem; }
  .cards { grid-template-columns: repeat(3, 1fr); }
  .steps { grid-template-columns: repeat(3, 1fr); gap: 2rem; }
  .steps li { grid-template-columns: 1fr; gap: .4rem; }
  .steps li::before { justify-self: start; }

  /* Diseñador a pantalla completa: barra arriba, herramientas, lienzo y panel */
  .ws {
    grid-template: "top top" auto "side stage" 660px "panel panel" auto / 250px minmax(0, 1fr);
  }
  .ws-top { grid-area: top; flex-wrap: nowrap; min-height: 50px; }
  .ws-name { flex: 0 1 15rem; margin-right: auto; }
  .ws-side { grid-area: side; overflow-y: auto; border-bottom: 0; border-right: 1px solid var(--line); }
  .ws-stage { grid-area: stage; border-bottom: 0; }
  .ws-panel { grid-area: panel; border-top: 1px solid var(--line); }
  .planner-canvas { height: 100%; min-height: 0; position: absolute; inset: 0; }
  .ws-status { display: flex; }
  .inspector {
    position: absolute; z-index: 4; top: 26px; left: 26px; max-width: calc(100% - 38px);
    border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 0; box-shadow: 0 4px 16px rgb(0 0 0 / .7);
  }
  .lib-grid { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
  .lib-item { flex: none; }
}
@media (min-width: 1280px) {
  .ws { grid-template: "top top top" auto "side stage panel" minmax(0, 1fr) / 250px minmax(0, 1fr) 372px; height: 100dvh; min-height: 600px; }
  .ws-panel { overflow-y: auto; border-top: 0; border-left: 1px solid var(--line); }
}

/* En papel: tinta oscura sobre blanco, con los mismos símbolos. */
@media print {
  :root {
    color-scheme: light;
    --bg: #ffffff; --surface: #ffffff; --raised: #f2f2f2; --field: #ffffff;
    --ink: #111111; --muted: #555555; --line: #cccccc; --line-hi: #999999;
    --accent: #111111; --accent-ink: #ffffff; --accent-soft: #f2f2f2; --glass: #2f6fa8;
  }
  body { background: none; }
  strong, b { color: inherit; }
  .plan-svg .room { fill: #f2f2f2; }
  .plan-svg .item.sel, .plan-svg .surface.sel { fill: #f2f2f2; }
  .plan-svg .surface { fill: #fafafa; stroke: #777; }
  .plan-svg .item { stroke: #111; }
  .tool-result, .ws-panel, .ws-side { background: none; }
  .site-header, .site-footer, .ad-slot, .result-actions, .more, .ws-top .ws-btn, .ws-top .logo, .ws-group, .ws-menu, .ws-toggle, .ws-level, .ws-side,
  .ws-status, .ws-empty, .planner-hint, .inspector, .ws-panel details:not(:first-child), .ws-panel summary,
  .steps, .prose, .faq, .hero, .cad, .section > h2 { display: none; }
  .pb-tabs, .pb-tools, .pb-add, .pb-picker, .pb-acts, .pb-note, .pb-tip, .pb-empty, .badge, .section { display: none !important; }
  .pb, .pb * { color: #000 !important; background: none !important; border-color: #999 !important; }
  .pb input { border: 0 !important; padding: 0 !important; min-height: 0 !important; width: auto !important; }
  .pb-line { grid-template-columns: auto minmax(0, 1fr) auto auto auto; break-inside: avoid; }
  .pb-line > .pb-qty, .pb-line > .pb-money { grid-column: auto; }
  .pb-needs { break-before: auto; }
  .ws { display: block; height: auto; border: 0; background: none; }
  .ws-top { background: none; }
  .ws-canvas { height: 420px; }
  .planner-canvas { position: static; height: 420px; }
  .ws-panel { overflow: visible; border: 0; }
}

/* =============================================================
   8. Documentación de obra: panel a pantalla completa con las láminas
   ============================================================= */
html.doc-open { overflow: hidden; }
.doc { position: fixed; inset: 0; z-index: 60; display: grid; grid-template: "bar" auto "form" auto "view" 1fr / minmax(0, 1fr); background: var(--bg); overflow-y: auto; }
.doc-bar { grid-area: bar; position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .5rem .75rem; background: #111; border-bottom: 1px solid var(--line); }
.doc-bar strong { color: var(--accent); font-size: .72rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; }
.doc-bar span { margin-right: auto; font-size: .74rem; color: var(--muted); }
.doc-bar .btn:disabled { opacity: .45; cursor: not-allowed; }
.doc-form { grid-area: form; padding: 0 .75rem .75rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.doc-form .tool-form { padding: .2rem .25rem .6rem; }
.doc-form input[aria-invalid="true"] { border-color: var(--danger); }
.doc-view { grid-area: view; min-width: 0; padding: .75rem; }
.doc-notes { display: grid; gap: .3rem; margin-bottom: .75rem; padding: 0; list-style: none; font-size: .76rem; }
.doc-notes li { padding: .4rem .7rem; background: #111; border: 1px solid var(--line); border-left: 3px solid var(--accent); }
.doc-sheet { margin: 0 auto .9rem; max-width: 1500px; background: #fff; box-shadow: 0 4px 16px rgb(0 0 0 / .7); }
.doc-sheet svg { width: 100%; height: auto; }
@media (min-width: 960px) {
  .doc { grid-template: "bar bar" auto "form view" minmax(0, 1fr) / 340px minmax(0, 1fr); overflow: hidden; }
  .doc-form { overflow-y: auto; border-bottom: 0; border-right: 1px solid var(--line); }
  .doc-view { overflow: auto; }
}
/* Al imprimir desde el panel sale solo la documentación: una lámina por hoja, en tamaño real. */
@media print {
  html.doc-open, html.doc-open body { overflow: visible; background: #fff; }
  html.doc-open body > :not(.doc), html.doc-open .doc-bar, html.doc-open .doc-form, html.doc-open .doc-notes { display: none !important; }
  html.doc-open .doc, html.doc-open .doc-view { position: static; display: block; overflow: visible; padding: 0; background: none; }
  html.doc-open .doc-sheet { margin: 0; max-width: none; box-shadow: none; break-after: page; break-inside: avoid; }
  html.doc-open .doc-sheet:last-child { break-after: auto; }
  html.doc-open .doc-sheet svg { width: auto; max-width: none; }
}

/* =============================================================
   9. Modo presentación: solo el plano, con una barra flotante mínima
   ============================================================= */
html.is-presenting { overflow: hidden; }
.ws.is-presenting { position: fixed; inset: 0; z-index: 50; display: block; height: auto; min-height: 0; border: 0; }
.ws.is-presenting .ws-top, .ws.is-presenting .ws-side, .ws.is-presenting .ws-panel, .ws.is-presenting .planner-hint,
.ws.is-presenting .ws-status, .ws.is-presenting .ws-empty { display: none; }
.ws.is-presenting .ws-stage { height: 100%; border: 0; }
.ws.is-presenting .planner-canvas { position: absolute; inset: 0; height: 100%; min-height: 0; }
.ws.is-presenting .inspector {
  position: absolute; z-index: 7; top: 12px; left: 12px; max-width: calc(100% - 24px);
  border: 1px solid var(--line); border-left: 3px solid var(--accent); box-shadow: 0 4px 16px rgb(0 0 0 / .7);
}
.ws.is-presenting .ws-present {
  position: absolute; z-index: 7; left: 8px; right: 8px; bottom: 14px; width: fit-content; margin-inline: auto;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; padding: 3px;
  background: #111; border: 1px solid var(--line); border-top: 2px solid var(--accent); box-shadow: 0 4px 16px rgb(0 0 0 / .7);
}
.ws-present button { display: flex; align-items: center; gap: .4rem; min-height: 42px; padding: 0 .7rem; font: 500 .74rem/1 var(--mono); color: #c8c8c8; }
.ws-present button svg { width: 18px; height: 18px; stroke-width: 1.4; }
.ws-present button:hover { background: var(--raised); color: var(--ink); }
.ws-present button[aria-pressed="true"] { background: var(--raised); color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.ws-present select { min-height: 42px; padding: 0 .5rem; font: 500 .74rem/1 var(--mono); background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.ws-present .ws-present-exit { color: var(--muted); border-left: 1px solid var(--line); }
@media (max-width: 539px) { .ws-present button span { display: none; } }
@media print { .ws-present { display: none !important; } }
/* Escritorio: el texto "por …" con ancho fijo deja los precios alineados en columna. */
@media (min-width: 481px) { .cost-per { width: 5.6rem; } }

/* Tipos de muro: corte de capas y editor (panel lateral del diseñador). */
.type-editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; min-width: 0; padding: 0 .25rem .25rem; }
.type-pick { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; min-width: 0; }
.type-pick select { flex: 1 1 100%; min-width: 0; min-height: 38px; padding: .3rem .5rem; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.type-pick .btn { flex: none; }
.type-svg { width: 100%; max-width: 320px; height: auto; display: block; }
.type-svg text { font: 9px var(--mono); fill: var(--muted); }
.type-sum { font-size: .72rem; color: var(--muted); line-height: 1.55; }
.type-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: .55rem; }
.type-form label { display: grid; gap: .2rem; font-size: .74rem; color: #c8c8c8; }
.type-form input[type="text"], .type-form select { min-height: 38px; padding: .3rem .5rem; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.type-form input[type="text"]:focus, .type-form select:focus, .type-pick select:focus { outline: 1px solid var(--accent); outline-offset: 0; }
.type-face { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-width: 0; gap: .45rem .6rem; margin: 0; padding: .55rem .6rem .65rem; border: 1px solid var(--line); border-radius: var(--radius); }
.type-face legend { padding: 0 .3rem; font: 500 .66rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.type-face label { grid-template-columns: 1fr; }
.type-face input[type="text"] { width: 100%; min-width: 0; text-align: right; }
.type-face .type-check { grid-column: 1 / -1; display: flex; align-items: center; gap: .5rem; min-height: 32px; }
.type-check input { appearance: none; -webkit-appearance: none; flex: none; width: 16px; height: 16px; background: #0a0a0a; border: 1px solid #444; border-radius: 0; }
.type-check input:checked { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px #0a0a0a; }
@media print { .plan-svg .wall-fin { stroke: #bbb; } }
.type-pick .btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }

/* Fases: existente, a demoler y a construir. En "cómo queda", lo existente va en gris; en "municipal",
   la convención de los planos municipales: existente en el color de siempre, demolición en amarillo y obra nueva en rojo. */
.plan-svg[data-phase="obra"] .wall.ph-old { stroke: #7d7d7d; }
.plan-svg[data-phase="obra"] .ph-old:not(.wall) { stroke: #7d7d7d; }
.plan-svg[data-phase="municipal"] .wall.ph-new, .plan-svg[data-phase="municipal"] .ph-new:not(.wall) { stroke: #e5484d; }
.plan-svg[data-phase="municipal"] .ph-demo { stroke: #f5c300; }
.plan-svg[data-phase="municipal"] .wall.ph-demo { stroke-linecap: butt; opacity: .85; }
.phase-legend {
  position: absolute; right: 12px; bottom: 10px; display: flex; flex-wrap: wrap; gap: .4rem .9rem; padding: .35rem .65rem;
  background: #111; border: 1px solid var(--line); font: 400 .7rem/1.4 var(--mono); color: var(--muted); pointer-events: none;
}
.phase-legend span::before { content: ""; display: inline-block; width: 14px; height: 4px; margin-right: .4rem; vertical-align: middle; background: var(--ink); }
.phase-legend .ph-demo::before { background: repeating-linear-gradient(90deg, #f5c300 0 4px, transparent 4px 7px); }
.phase-legend .ph-new::before { background: #e5484d; }
.phase-legend[hidden] { display: none; }
.phase-view { display: grid; gap: .25rem; padding: 0 .25rem .6rem; font-size: .74rem; color: #c8c8c8; }
.phase-view select { min-height: 38px; padding: .3rem .5rem; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
@media print {
  .plan-svg[data-phase="municipal"] .ph-new { stroke: #c62828 !important; }
  .plan-svg[data-phase="municipal"] .ph-demo { stroke: #c9a000 !important; }
  .phase-legend { display: flex !important; position: static; background: none; }
  .phase-legend[hidden] { display: none !important; }
}

/* Panel de planillas y presupuesto: tabla ancha con encabezado fijo; en el celular se desplaza de costado. */
.sheetpanel { grid-template: "bar" auto "view" minmax(0, 1fr) / minmax(0, 1fr); }
.sheetpanel .doc-bar { flex-wrap: wrap; }
.sp-tabs { display: flex; gap: .25rem; }
.sp-tabs button { min-height: 38px; padding: .3rem .8rem; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; }
.sp-tabs button[aria-selected="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.sp-gap { flex: 1; }
.sp-body { grid-area: view; overflow: auto; padding: .9rem .9rem 2rem; }
.sp-sum { max-width: 90ch; margin-bottom: .8rem; font-size: .78rem; color: var(--muted); line-height: 1.5; }
.sp-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.sp-table { width: 100%; border-collapse: collapse; font-size: .78rem; font-variant-numeric: tabular-nums; }
.sp-table th { position: sticky; top: 0; z-index: 1; padding: .55rem .6rem; background: #1b1b1b; border-bottom: 1px solid var(--line-hi); text-align: left; font: 500 .66rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.sp-table td { padding: .4rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.sp-table td.num { text-align: right; white-space: nowrap; }
.sp-table tr:hover td { background: #171717; }
.sp-table input, .sp-table select { min-height: 34px; padding: .2rem .45rem; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); }
.sp-table input[inputmode="decimal"] { width: 5.5rem; text-align: right; }
.sp-table input:not([inputmode]) { width: 100%; min-width: 9rem; }
.sp-table input:focus, .sp-table select:focus { outline: 1px solid var(--accent); outline-offset: 0; }
.sp-code { display: inline-block; min-width: 2.4rem; padding: .1rem .4rem; border: 1px solid var(--accent); border-radius: 3px; color: var(--accent); text-align: center; font-weight: 500; }
.plan-svg .tag rect { fill: var(--bg); stroke: var(--accent); }
.plan-svg .tag text { fill: var(--accent); font-family: var(--mono); font-weight: 500; }
@media print {
  html.doc-open .sheetpanel .doc-bar { display: none !important; }
  html.doc-open .sheetpanel, html.doc-open .sp-body { position: static; display: block; overflow: visible; padding: 0; background: #fff; color: #111; }
  .sp-sum { color: #333; }
  .sp-scroll { overflow: visible; border: 0; }
  .sp-table { font-size: 9pt; }
  .sp-table th { position: static; background: none; color: #111; border-bottom: 1px solid #111; }
  .sp-table td { border-bottom: 1px solid #bbb; }
  .sp-table input, .sp-table select { border: 0; padding: 0; background: none; color: #111; appearance: none; -webkit-appearance: none; }
  .sp-code { border-color: #111; color: #111; }
  .plan-svg .tag rect { fill: #fff; stroke: #111; }
  .plan-svg .tag text { fill: #111; }
}

/* Presupuesto de obra */
.bg-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin-bottom: .8rem; }
.bg-stat { display: grid; gap: .2rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.bg-stat span { font: 500 .66rem/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.bg-stat strong { font-size: 1.05rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.bg-stat.is-main { border-left: 3px solid var(--accent); }
.bg-stat.is-main strong { font-size: 1.4rem; color: var(--accent); }
.bg-pase { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; margin-bottom: .8rem; font-size: .76rem; color: #c8c8c8; }
.bg-pase label { display: flex; align-items: center; gap: .4rem; }
.bg-pase input { width: 4.5rem; min-height: 36px; padding: .2rem .45rem; text-align: right; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.bg-pase input:focus { outline: 1px solid var(--accent); outline-offset: 0; }
.bg-rubro { margin-top: 1.2rem; }
.bg-rubro h3 { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .4rem; font: 500 .78rem/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.bg-rubro h3 b { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.bg-rubro .ws-tip { padding: 0 0 .4rem; }
.sp-table input[data-price] { width: 8.5rem; }
.sp-table input::placeholder { color: var(--accent); opacity: .75; }
.sp-table tr.is-missing td:first-child { color: var(--accent); }
.sp-table tfoot td { padding: .5rem .6rem; color: var(--muted); font-size: .74rem; background: #161616; }
.bg-final { max-width: 520px; margin: 1.4rem 0 .4rem auto; }
.bg-final div:last-child dt, .bg-final div:last-child dd { color: var(--accent); font-size: .95rem; }
@media print {
  .bg-stat, .sp-table tfoot td { background: none; border-color: #999; color: #111; }
  .bg-stat strong, .bg-stat.is-main strong, .bg-rubro h3, .bg-rubro h3 b { color: #111; }
  .bg-pase input { border: 0; background: none; color: #111; }
  .bg-rubro { break-inside: avoid; }
  [data-bg-reset] { display: none; }
}
.bg-table { table-layout: fixed; min-width: 640px; }
.bg-table th:nth-child(1) { width: 40%; }
.bg-table th:nth-child(2) { width: 12%; }
.bg-table th:nth-child(3) { width: 16%; }
.bg-table th:nth-child(4) { width: 18%; }
.bg-table th:nth-child(5) { width: 14%; }
.bg-table td:first-child { overflow-wrap: anywhere; }
.bg-u { display: none; }
.bg-stat strong { white-space: nowrap; }
/* Celular: la unidad va debajo de la cantidad y la tabla entra sin desplazarse. */
@media (max-width: 600px) {
  .bg-table { min-width: 0; }
  .bg-table .bg-unit { display: none; }
  .bg-u { display: block; color: var(--muted); font-size: .68rem; }
  .bg-table { font-size: .72rem; }
  .bg-table th { white-space: normal; font-size: .6rem; padding: .45rem .35rem; }
  .bg-table th:nth-child(1) { width: 31%; }
  .bg-table th:nth-child(2) { width: 18%; }
  .bg-table th:nth-child(4) { width: 27%; }
  .bg-table th:nth-child(5) { width: 24%; }
  .sp-table input[data-price] { width: 100%; }
  .bg-table td { padding: .4rem .35rem; }
  .bg-table td.num:nth-child(4) { white-space: normal; }
  .bg-stat.is-main strong { font-size: 1.15rem; }
  .bg-top { grid-template-columns: 1fr 1fr; }
  .bg-stat.is-main { grid-column: 1 / -1; }
}
.view-tpl { display: grid; gap: .3rem; padding: 0 .25rem .7rem; font-size: .74rem; color: #c8c8c8; }
.view-tpl > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem; }
.view-tpl button { min-height: 38px; padding: .3rem .4rem; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; }
.view-tpl button:hover { color: var(--ink); border-color: var(--line-hi); }
.view-tpl button[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
