/* ===========================================================
   Cocinas Obramat — Sistema visual (mobile-first, neutro/técnico)
   =========================================================== */
:root {
  /* CocinaLove · Bosque & Love — verde bosque (marca) + coral "Love" (acción) + madera + cream */
  --paper: #f6f2ea;
  --surface: #fffdf8;
  --surface-2: #f3efe6;
  --ink: #1e2420;
  --ink-soft: #54625a;
  --muted: #8d9a90;
  --line: #ebe3d4;
  --line-strong: #d9cfbb;
  /* accent = verde bosque (selección / activo / marca) */
  --accent: #20453a;
  --accent-ink: #163029;
  --accent-soft: #e6efe8;
  /* love = coral (acción principal, corazón) */
  --love: #e0533f;
  --love-deep: #c8412f;
  --love-soft: #fbe7e1;
  /* maderas y latón */
  --roble: #c0894e;
  --nogal: #6b4a2f;
  --brass: #c9a227;
  /* funcionales del plano */
  --fuego: #e0883f;
  --fuego-soft: #f9ead5;
  --agua: #3f7d8f;
  --agua-soft: #e2eef0;
  --verde: #3f8a5f;
  --ok: #3f8a5f;
  --danger: #c0392b;
  --danger-soft: #f7ddd8;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(30, 36, 32, 0.05), 0 6px 20px -8px rgba(30, 36, 32, 0.14);
  --shadow-lg: 0 12px 44px -12px rgba(20, 40, 30, 0.34);
  --sans: "Hanken Grotesk", system-ui, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --maxw: 460px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(120% 60% at 50% 0%, #edf3f8 0%, transparent 60%),
    var(--paper);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

/* Marco de la app — columna móvil centrada */
.viewport {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: stretch;
}
.app {
  width: 100%;
  max-width: var(--maxw);
  min-height: 100vh;
  background: var(--paper);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px var(--line), var(--shadow-lg);
}
@media (min-width: 480px) {
  .viewport { padding: 22px 0; }
  .app { min-height: calc(100vh - 44px); border-radius: 26px; overflow: hidden; }
}

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 11px;
  padding: 15px 16px 14px;
  background: linear-gradient(180deg, var(--accent), var(--accent-ink));
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--roble), var(--brass), var(--roble)) 1;
  color: #fbf7ec;
}
.brand { display: flex; align-items: center; gap: 10px; letter-spacing: -0.02em; }
.brand > div { white-space: nowrap; }
.muro-head b { white-space: nowrap; }
.brand .wordmark { font-family: var(--display); font-weight: 600; font-size: 20px; color: #fbf7ec; line-height: 1; display: flex; align-items: baseline; }
.brand .wordmark .amor { color: #ffd9cf; }
.brand .wordmark .pivot { position: relative; }
.brand .wordmark .pivot .heart { position: absolute; left: 50%; top: -0.52em; transform: translateX(-50%); font-size: 0.5em; color: var(--love); }
.brand .mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: #fbf7ec; color: var(--love); box-shadow: 0 4px 12px -4px rgba(0,0,0,.4);
}
.brand .mark svg { width: 20px; height: 20px; }
.brand small { display: block; font-weight: 600; font-size: 10.5px; color: #aec3b6; letter-spacing: 0; margin-top: 4px; }
.brand small .firma { font-family: var(--display); font-style: italic; color: #e9d7a4; }
.topbar .spacer { flex: 1; }
.iconbtn {
  border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.12); color: #fbf7ec;
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; cursor: pointer;
}
.iconbtn:active { transform: scale(0.95); }
.topbar .badge { background: rgba(201,162,39,.2); color: var(--brass); border: 1px solid rgba(201,162,39,.45); }

/* ---------- Progreso ---------- */
.steps {
  display: flex; gap: 5px; padding: 12px 16px 0;
}
.steps .seg { flex: 1; height: 4px; border-radius: 99px; background: var(--line); overflow: hidden; }
.steps .seg.done { background: var(--accent); }
.steps .seg.cur::after { content: ""; display: block; height: 100%; width: 55%; background: var(--accent); border-radius: 99px; }
.steplabel { padding: 8px 16px 0; font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }

/* ---------- Contenido ---------- */
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.page { padding: 14px 16px 130px; }
.h1 { font-family: var(--display); font-size: 27px; font-weight: 600; letter-spacing: -0.02em; margin: 6px 0 4px; text-wrap: balance; }
.sub { color: var(--ink-soft); font-size: 14.5px; margin: 0 0 18px; text-wrap: pretty; }

/* ---------- Tarjetas / inputs ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin: 0 0 6px 2px; }
.input, .select {
  width: 100%; border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: var(--radius-sm); padding: 13px 13px; font: inherit; font-size: 16px; color: var(--ink);
}
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.mono { font-family: var(--mono); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* segmented control */
.seg-ctrl { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.seg-ctrl button {
  flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 9px; font: inherit;
  font-size: 13.5px; font-weight: 600; color: var(--ink-soft); cursor: pointer;
}
.seg-ctrl button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* opción seleccionable grande */
.opt {
  display: flex; align-items: center; gap: 13px; width: 100%;
  border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 14px; cursor: pointer; text-align: left; margin-bottom: 10px; transition: border-color .12s, background .12s;
}
.opt:active { transform: scale(0.995); }
.opt.on { border-color: var(--accent); background: var(--accent-soft); }
.opt .ic { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--surface-2); border: 1px solid var(--line); }
.opt .tt { flex: 1; }
.opt .tt b { display: block; font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; }
.opt .tt span { display: block; font-size: 12.5px; color: var(--muted); }
.opt .chk { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; display: grid; place-items: center; }
.opt.on .chk { border-color: var(--accent); background: var(--accent); }
.opt.on .chk svg { stroke: #fff; }

/* modelo cards */
.modelos { display: grid; gap: 12px; }
.modelo-card { position: relative; border: 1.5px solid var(--line); border-radius: 18px; overflow: hidden; cursor: pointer; background: var(--surface); }
.modelo-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.modelo-card .swatch { height: 120px; display: grid; place-items: center; position: relative; }
.modelo-card .swatch .tag { position: absolute; top: 12px; left: 12px; font-family: var(--mono); font-size: 11px; padding: 4px 8px; border-radius: 99px; background: rgba(255,255,255,.85); color: var(--ink); font-weight: 600; }
.modelo-card .meta { padding: 13px 15px; display: flex; align-items: center; justify-content: space-between; }
.modelo-card .meta b { font-size: 18px; letter-spacing: -0.02em; }
.modelo-card .meta span { font-size: 12.5px; color: var(--muted); display: block; }

/* Rejilla de acabados (paso Modelo) — muestras con foto real */
.modelo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.mtile { border: 1.5px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); cursor: pointer; padding: 0; text-align: left; font: inherit; color: inherit; transition: border-color .12s, box-shadow .12s; }
.mtile:active { transform: scale(0.99); }
.mtile.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(32, 69, 58, 0.16); }
.mph { height: 104px; position: relative; overflow: hidden; display: block; }
.mph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mph .finchip { position: absolute; left: 8px; bottom: 8px; font-family: var(--mono); font-size: 9px; padding: 3px 8px; border-radius: 99px; background: rgba(0, 0, 0, 0.52); color: #fff; letter-spacing: .02em; }
.mph .mchk { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
.mtt { padding: 10px 12px; }
.mtt b { font-family: var(--display); font-weight: 600; font-size: 15.5px; display: block; letter-spacing: -0.01em; }
.mtt small { display: block; font-size: 11.5px; color: var(--muted); font-family: var(--mono); margin-top: 1px; }

/* toggle electrodoméstico */
.appliance { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; overflow: hidden; }
.appliance .head { display: flex; align-items: center; gap: 12px; padding: 13px 14px; cursor: pointer; }
.appliance .head .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 19px; }
.appliance .head .tt { flex: 1; }
.appliance .head .tt b { font-size: 15px; font-weight: 700; }
.appliance .head .tt span { font-size: 12px; color: var(--muted); }
.appliance .body { padding: 0 14px 14px; border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 11px; }

/* switch */
.switch { width: 46px; height: 28px; border-radius: 99px; background: var(--line-strong); position: relative; flex: none; transition: background .15s; cursor: pointer; }
.switch.on { background: var(--accent); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .15s; }
.switch.on::after { left: 21px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 99px; padding: 8px 13px; font-size: 13px; font-weight: 600; color: var(--ink-soft); cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.sm { padding: 6px 11px; font-size: 12px; }

/* ---------- Barra inferior fija ---------- */
.bottombar {
  position: sticky; bottom: 0; z-index: 25;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(250, 240, 242, 0.88);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex; gap: 10px; align-items: center;
}
.btn {
  flex: 1; border: 0; border-radius: 13px; padding: 15px 18px; font: inherit; font-weight: 700; font-size: 15.5px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--love); color: #fff; box-shadow: 0 8px 20px -7px var(--love); }
.btn.ghost { flex: 0 0 auto; background: var(--surface); color: var(--ink-soft); border: 1px solid var(--line-strong); }
.btn.dark { background: var(--ink); color: #fff; }
.btn:disabled { opacity: .45; pointer-events: none; }
.bottombar .nexthint { font-size: 12px; color: var(--love-deep); text-align: center; font-weight: 600; }
.bottombar .total { flex: 1; }
.bottombar .total small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.bottombar .total b { font-size: 20px; letter-spacing: -0.02em; font-family: var(--mono); }

/* ---------- PLANO ---------- */
.plan-tabs { display: flex; gap: 5px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; }
.plan-tabs button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.plan-tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.muro-block { margin-bottom: 18px; }
.muro-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.muro-head b { font-size: 14px; font-weight: 700; }
.muro-head .len { font-family: var(--mono); font-size: 12px; color: var(--accent-ink); }

/* tira de módulos (alzado) */
.run { position: relative; border-radius: 10px; }
.run-track { display: flex; align-items: stretch; gap: 2px; }
.mod {
  position: relative; border: 1.5px solid var(--line-strong); background: var(--surface);
  border-radius: 4px; min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; overflow: hidden; padding: 2px;
}
.mod:active { transform: scale(0.98); }
.mod .mw { font-family: var(--mono); font-size: 10.5px; color: var(--muted); position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; }
.mod .mlabel { font-size: 10px; font-weight: 700; text-align: center; line-height: 1.05; padding: 0 1px; }
.mod .mi { font-size: 17px; line-height: 1; margin-bottom: 1px; }
.mod.tall { min-height: 96px; background: repeating-linear-gradient(135deg, var(--surface) 0 7px, var(--surface-2) 7px 14px); }
.mod.role-fregadero { background: var(--agua-soft); border-color: var(--agua); }
.mod.role-placa, .mod.role-horno, .mod.role-campana { background: var(--fuego-soft); border-color: var(--fuego); }
.mod.role-hueco, .mod.cat-hueco { background: repeating-linear-gradient(45deg, var(--surface-2) 0 6px, transparent 6px 12px); border-style: dashed; }
.mod.cat-panel { background: repeating-linear-gradient(45deg, var(--line) 0 4px, transparent 4px 8px); border-style: dashed; }
.mod.cat-rinconlado { background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface) 6px 12px); border-style: dashed; color: var(--muted); }
.mod.sel { outline: 3px solid var(--accent); outline-offset: 1px; z-index: 2; }
.mod.over { background: var(--danger-soft) !important; border-color: var(--danger) !important; border-style: dashed; }
.mod.over .mlabel, .mod.over .mw { color: var(--danger); }
.run-wrap { margin-bottom: 2px; }
.wall-limit { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 2px dashed var(--danger); z-index: 3; pointer-events: none; }
.wall-limit span { position: absolute; top: -16px; left: 2px; font-family: var(--mono); font-size: 9px; color: var(--danger); white-space: nowrap; font-weight: 600; }
.len.over { color: var(--danger); font-weight: 700; }
.len.ok { color: var(--ok); }
.mod-add { min-width: 30px; border: 1.5px dashed var(--line-strong); background: transparent; border-radius: 4px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }

.run-ruler { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 4px; }
.run-altos .mod { min-height: 46px; opacity: .96; }
.run-cap { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin: 10px 0 4px; letter-spacing: .03em; text-transform: uppercase; }

/* Chips tocables del plano (editar módulos con el dedo, ≥44px) */
.mod-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.mod-chip { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; min-height: 44px; padding: 6px 11px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 10px; cursor: pointer; font: inherit; text-align: left; }
.mod-chip:active { transform: scale(0.97); }
.mod-chip b { font-size: 12px; font-weight: 700; color: var(--ink); line-height: 1.1; white-space: nowrap; }
.mod-chip span { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.mod-chip.cocc { border-color: #eebe95; background: var(--fuego-soft); }
.mod-chip.agua { border-color: #95b8c1; background: var(--agua-soft); }
.mod-chip.soft { border-style: dashed; background: var(--surface-2); }
.mod-chip.soft b { color: var(--ink-soft); font-weight: 600; }

/* planta top-view — el scroll horizontal lo pone el wrapper de StepPlano (un único scroller);
   con overflow-x aquí también, salían dos barras de scroll apiladas (observación del experto, cert v5) */
.planta { background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 24px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 24px 100%,
    var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 16px; position: relative;
}

/* ---------- Presupuesto ---------- */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.sheet-h { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.sheet-h b { font-size: 14px; }
.sheet-h .sum { font-family: var(--mono); font-size: 14px; font-weight: 700; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); align-items: center; }
.line:last-child { border-bottom: 0; }
.line .nm { font-size: 13.5px; }
.line .nm small { display: block; color: var(--muted); font-size: 11.5px; font-family: var(--mono); }
.line .qp { display: flex; align-items: center; gap: 7px; }
.qty-in { width: 46px; text-align: center; border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 4px; font-family: var(--mono); font-size: 14px; }
.price-in { width: 76px; text-align: right; border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 8px; font-family: var(--mono); font-size: 13px; }
.line .st { font-family: var(--mono); font-size: 13.5px; font-weight: 700; min-width: 70px; text-align: right; }

.grand { display: flex; align-items: center; justify-content: space-between; padding: 16px; background: linear-gradient(180deg, var(--accent), var(--accent-ink)); color: #fbf7ec; border-radius: var(--radius); box-shadow: 0 14px 30px -14px rgba(20,40,30,.5); }
.grand .v { color: #fbf7ec; }
.grand small { font-size: 12px; opacity: .7; display: block; }
.grand .v { font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }

/* warnings */
.warn { display: flex; gap: 9px; padding: 11px 13px; border-radius: 11px; background: var(--fuego-soft); border: 1px solid #f8dcc8; font-size: 12.5px; color: #79371d; margin-bottom: 10px; }
.warn.danger { background: var(--danger-soft); border-color: #f0bcb4; color: #862726; }
.warn.danger b { color: var(--danger); }

/* ---------- Bottom sheet (editor de módulo) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(15,20,35,.42); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .18s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.bsheet {
  position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 100%);
  width: 100%; max-width: var(--maxw); background: var(--surface);
  border-radius: 22px 22px 0 0; z-index: 61; padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg); transition: transform .24s cubic-bezier(.2,.7,.2,1); max-height: 82vh; overflow-y: auto;
}
.bsheet.on { transform: translate(-50%, 0); }
.bsheet .grip { width: 40px; height: 4px; border-radius: 99px; background: var(--line-strong); margin: 6px auto 12px; }
.bsheet h3 { margin: 0 0 2px; font-family: var(--display); font-weight: 600; font-size: 18px; letter-spacing: -0.02em; }
.bsheet .sh-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; font-family: var(--mono); }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 13px; margin-bottom: 8px; cursor: pointer; font: inherit; text-align: left; }
.menu-item .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.menu-item b { font-size: 14px; display: block; }
.menu-item span { font-size: 12px; color: var(--muted); }
.menu-item.danger { color: var(--danger); }

.stepper { display: flex; align-items: center; gap: 0; border: 1px solid var(--line-strong); border-radius: 11px; overflow: hidden; }
.stepper button { width: 48px; height: 46px; border: 0; background: var(--surface-2); font-size: 22px; cursor: pointer; color: var(--ink); }
.stepper .v { flex: 1; text-align: center; font-family: var(--mono); font-size: 17px; font-weight: 700; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); }

/* helper text */
.hint { font-size: 12.5px; color: var(--muted); margin: 4px 2px 0; }
.divlabel { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.divlabel::before, .divlabel::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* summary review row */
.rev { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rev .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); flex: none; }
.rev .tt { flex: 1; }
.rev .tt b { font-size: 14px; display: block; }
.rev .tt span { font-size: 12px; color: var(--muted); }
.rev .ed { font-size: 12px; color: var(--accent); font-weight: 700; cursor: pointer; }

.fade-in { animation: fadeIn .28s ease both; }
@keyframes fadeIn { from { transform: translateY(6px); } to { transform: none; } }

/* ---------- Hoja imprimible ---------- */
.print-doc { display: none; }
/* Exportación a PDF: html2pdf clona la hoja en su propio overlay (fuera de pantalla); la mostramos SOLO ahí */
.html2pdf__overlay .print-doc { display: block !important; width: 794px; background: #fff; color: #111; padding: 16px; }
.html2pdf__overlay .print-doc .planta { background: #fff; border: none; }
.html2pdf__overlay .pd-alzado .run-cap, .html2pdf__overlay .pd-alzado .hint { display: none !important; }
.html2pdf__overlay .pd-alzado .muro-block > div { overflow: visible !important; }
.html2pdf__overlay .pd-alzado svg { max-width: 100%; height: auto; }
.pd-head { display: flex; align-items: center; gap: 16px; border-bottom: 2px solid #20453a; padding-bottom: 10px; margin-bottom: 12px; }
.pd-logo { background: #20453a; color: #fbf7ec; font-family: "Fraunces", Georgia, serif; font-weight: 600; letter-spacing: .3px; padding: 7px 13px; font-size: 18px; border-radius: 4px; }
.pd-logo .heart { color: #e0533f; }
.pd-title { font-weight: 800; font-size: 14px; letter-spacing: .02em; color: #20453a; }
.pd-title small { display: block; font-weight: 600; font-size: 10px; color: #8a8a7a; font-style: italic; letter-spacing: 0; }
.pd-client { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 11px; }
.pd-client td { border: 1px solid #bbb; padding: 5px 8px; }
.pd-client td:nth-child(odd) { background: #f0f0ee; font-weight: 700; width: 14%; font-size: 9.5px; letter-spacing: .03em; }
.pd-plan { border: 1px solid #ccc; padding: 10px; margin-bottom: 14px; text-align: center; }
.pd-plan-title { font-weight: 800; font-size: 9.5px; letter-spacing: .08em; color: #333; text-align: left; margin-bottom: 6px; }
.pd-alzado .muro-head { font-size: 9px; margin-bottom: 4px; }
.pd-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.pd-table th { background: #111; color: #fff; text-align: left; padding: 6px 8px; font-size: 10px; letter-spacing: .04em; }
.pd-table th:last-child, .pd-table td:last-child { text-align: right; }
.pd-table th:nth-child(2), .pd-table td:nth-child(2), .pd-table th:nth-child(3), .pd-table td:nth-child(3) { text-align: right; white-space: nowrap; }
.pd-table td { padding: 4px 8px; border-bottom: 1px solid #e2e2df; }
.pd-table .pd-sec td { background: #e8e8e5; font-weight: 800; font-size: 9.5px; letter-spacing: .05em; padding: 5px 8px; }
.pd-table .pd-sub td { font-weight: 700; border-top: 1px solid #999; }
.pd-table .pd-total td { background: #111; color: #fff; font-weight: 800; font-size: 14px; padding: 9px 8px; }
.pd-foot { font-size: 9px; color: #555; margin-top: 10px; line-height: 1.4; }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  .viewport { display: block; }
  .app { max-width: none; box-shadow: none; border-radius: 0; min-height: 0; }
  .topbar, .steps, .steplabel, .bottombar, .plan-tabs, .warn, .scrim, .bsheet,
  .h1, .sub, .sheet, .grand, .hint, .count, .card, #presupuesto > .h1, #presupuesto > .sub { display: none !important; }
  .scroll { overflow: visible; }
  .page { padding: 0; }
  .print-doc { display: block !important; color: #111; }
  .print-doc .planta { background: #fff; border: none; }
  /* Alzados en el reporte: ocultar botones de edición y encajar en A4 */
  .pd-alzado .run-cap, .pd-alzado .hint { display: none !important; }
  .pd-alzado .muro-block { margin-bottom: 8px; page-break-inside: avoid; }
  .pd-alzado .muro-block > div { overflow: visible !important; }
  .pd-alzado svg { max-width: 100%; height: auto; }
  .pd-plan { page-break-inside: avoid; }
}

/* ---- Visor 3D ---- */
.v3d-overlay { position: fixed; inset: 0; z-index: 9999; background: #f6f2ea; display: flex; flex-direction: column; }
.v3d-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #20453a; color: #f6f2ea; font-family: var(--mono); }
.v3d-close { background: #e0533f; color: #fff; border: none; border-radius: 8px; width: 36px; height: 36px; font-size: 16px; cursor: pointer; }
.v3d-canvas { flex: 1; min-height: 0; touch-action: none; }
.v3d-canvas canvas { display: block; width: 100%; height: 100%; }
.v3d-hint { padding: 8px 14px; text-align: center; font-size: 12px; color: var(--muted); background: #fff; }
.btn-3d { display: inline-flex; align-items: center; gap: 6px; margin: 0 12px 10px; padding: 10px 16px; background: #e0533f; color: #fff; border: none; border-radius: 10px; font-weight: 700; font-size: 14px; cursor: pointer; }
/* El 3D es ahora la imagen de apertura (tras cabecera/cliente y antes de los planos):
   NO forzar salto de página para que comparta la primera página, no una hoja propia. */
.pd-3d { text-align: center; margin-bottom: 14px; page-break-inside: avoid; }
.pd-3d-img { max-width: 100%; max-height: 150mm; border: 1px solid #d9d2c4; border-radius: 6px; }
.pd-3d-cap { font-size: 10px; color: #6b6b6b; margin-top: 6px; }
@media print { .pd-3d { break-inside: avoid; } }
