/* ── Mudanza · mesa de dibujo arquitectónico ─────────────────────── */

:root {
  --paper: #ede8db;
  --paper-line: rgba(62, 82, 92, 0.10);
  --paper-line-strong: rgba(62, 82, 92, 0.18);
  --ink: #22303a;
  --ink-soft: #51616d;
  --cream: #f5f1e6;
  --cream-dim: #cfc8b4;
  --accent: #c8502e;
  --accent-soft: rgba(200, 80, 46, 0.14);
  --panel: #22303a;
  --panel-edge: #182129;
  --panel-hi: #2d3e4a;
  --ok: #5b8a72;
  --font-display: "Bricolage Grotesque", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --inv: 1;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; overflow: hidden; }

body {
  display: flex;
  font-family: var(--font-display);
  color: var(--ink);
  background: var(--paper);
}

/* ── Sidebar ─────────────────────────────────────────────────────── */

.sidebar {
  width: 292px;
  flex: 0 0 292px;
  background: var(--panel);
  border-right: 3px solid var(--panel-edge);
  color: var(--cream);
  display: flex;
  flex-direction: column;
  z-index: 20;
  box-shadow: 4px 0 18px rgba(24, 33, 41, 0.25);
}

.brand { padding: 22px 20px 18px; }

.stamp {
  border: 2.5px solid var(--accent);
  border-radius: 6px;
  padding: 12px 14px 10px;
  transform: rotate(-1.2deg);
  background: rgba(200, 80, 46, 0.07);
}

.stamp h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--accent);
  line-height: 1;
}

.stamp p {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--cream-dim);
}

.panel {
  padding: 6px 20px 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-furniture { flex: 1.4; }
.panel-plans { flex: 1; border-top: 1px dashed rgba(245, 241, 230, 0.18); padding-top: 14px; }

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.panel-head h2 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cream-dim);
}

.head-actions { display: flex; gap: 5px; }

.panel-head h2 { margin-right: auto; }

.furn-count {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--cream-dim);
  background: none;
  border: 1px solid rgba(245, 241, 230, 0.2);
  border-radius: 4px;
  padding: 3px 7px;
  margin-right: 6px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.furn-count:hover { border-color: rgba(245, 241, 230, 0.45); color: var(--cream); }
.furn-count.active { background: var(--accent); border-color: var(--accent); color: var(--cream); }

.furn-search {
  width: 100%;
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: 12.5px;
  color: var(--cream);
  background: rgba(24, 33, 41, 0.55);
  border: 1px solid rgba(245, 241, 230, 0.18);
  border-radius: 5px;
  padding: 6px 9px;
}
.furn-search:focus { outline: none; border-color: var(--accent); }
.furn-search::placeholder { color: var(--cream-dim); }

.btn-mini {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--cream);
  background: var(--panel-hi);
  border: 1px solid rgba(245, 241, 230, 0.25);
  border-radius: 4px;
  padding: 4px 9px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-mini:hover { background: var(--accent); border-color: var(--accent); transform: translateY(-1px); }

.furn-list, .plan-list {
  list-style: none;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-hi) transparent;
  /* aire para que el translateX del hover no se recorte contra el scroll container */
  padding: 2px 6px 2px 2px;
  margin: -2px -6px -2px -2px;
}

.furn-card.dragging, .plan-card.dragging {
  opacity: 0.45;
  transform: none;
  filter: none;
  border-style: dashed;
}

.furn-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 11px 5px;
  margin-bottom: 6px;
  background:
    linear-gradient(100deg,
      color-mix(in srgb, var(--fc, var(--accent)) 48%, transparent),
      color-mix(in srgb, var(--fc, var(--accent)) 14%, transparent) 52%,
      transparent 82%),
    var(--panel-hi);
  border: 1px solid rgba(245, 241, 230, 0.12);
  border-radius: 7px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, filter 0.12s;
}
.furn-card:hover { transform: translateX(3px); border-color: rgba(245, 241, 230, 0.4); filter: brightness(1.12); }
.furn-card.disabled { opacity: 0.45; cursor: not-allowed; }
.furn-card.disabled:hover { transform: none; }

/* espejo del plano → listado: hover sobre un mueble colocado ilumina su card */
.furn-card.highlight { transform: translateX(3px); border-color: rgba(245, 241, 230, 0.4); filter: brightness(1.12); }
/* mueble seleccionado en el plano: card marcada con acento */
.furn-card.picked { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* mueble todavía no colocado en el plano activo: color y texto apagados */
.furn-card.unplaced {
  background:
    linear-gradient(100deg,
      color-mix(in srgb, var(--fc, var(--accent)) 16%, transparent),
      color-mix(in srgb, var(--fc, var(--accent)) 5%, transparent) 52%,
      transparent 82%),
    var(--panel-hi);
}
.furn-card.unplaced .furn-name { color: var(--cream-dim); }
.furn-card.unplaced .furn-dims { opacity: 0.6; }

.furn-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.swipe-actions { display: none; }

.furn-main {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 20px;
  min-width: 0;
}
.furn-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.furn-dims {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--cream-dim);
  white-space: nowrap;
}

/* en hover, las acciones ocupan el lugar de las medidas */
.furn-actions { display: none; gap: 2px; }
.furn-card:hover .furn-dims { display: none; }
.furn-card:hover .furn-actions { display: flex; }

/* puntitos de copias colocadas; la fila siempre reserva su altura */
.furn-copies {
  display: flex;
  align-items: center;
  gap: 3.5px;
  height: 5px;
}
.furn-copies i {
  width: 4.5px;
  height: 4.5px;
  border-radius: 50%;
  background: var(--fc, var(--accent));
}

.icon-btn {
  background: none;
  border: none;
  color: var(--cream-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 3px;
  line-height: 1;
}
.icon-btn:hover { color: var(--cream); background: rgba(245, 241, 230, 0.12); }
.icon-btn.danger:hover { color: #ff9575; }

.plan-card {
  margin-bottom: 6px;
  border: 1px dashed rgba(245, 241, 230, 0.22);
  border-radius: 5px;
  font-size: 13px;
  transition: background 0.12s, border-color 0.12s;
}
.plan-card:hover { background: var(--panel-hi); }
.plan-card.active {
  border: 1px solid var(--accent);
  background: rgba(200, 80, 46, 0.14);
}

.plan-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
}
.plan-card .plan-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.plan-card .plan-meta {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--cream-dim);
}
.plan-card .plan-meta.ok { color: #8fc7a8; }

.plan-toggle {
  font-size: 12px;
  opacity: 0.7;
  transition: transform 0.18s;
}
.plan-card.open .plan-toggle { transform: rotate(90deg); }

.plan-details {
  display: none;
  flex-direction: column;
  gap: 9px;
  padding: 9px 10px 12px;
  border-top: 1px dashed rgba(245, 241, 230, 0.15);
}
.plan-card.open .plan-details { display: flex; }

.plan-details label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cream-dim);
}
.plan-details input, .plan-details textarea {
  display: block;
  width: 100%;
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: 12.5px;
  color: var(--cream);
  background: rgba(24, 33, 41, 0.55);
  border: 1px solid rgba(245, 241, 230, 0.18);
  border-radius: 4px;
  padding: 6px 8px;
}
.plan-details textarea { resize: vertical; min-height: 46px; line-height: 1.4; }
.plan-details input:focus, .plan-details textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.plan-scale-row {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--cream-dim);
}

.plan-detail-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-mini.danger:hover { background: #b0486d; border-color: #b0486d; }

.empty-note {
  font-size: 12px;
  line-height: 1.55;
  color: var(--cream-dim);
  border: 1px dashed rgba(245, 241, 230, 0.2);
  border-radius: 5px;
  padding: 12px;
  text-align: center;
}
.empty-note strong { color: var(--cream); }

/* ── Viewport / mesa de dibujo ───────────────────────────────────── */

#viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: default;
  background:
    repeating-linear-gradient(0deg, var(--paper-line-strong) 0 1px, transparent 1px 100px),
    repeating-linear-gradient(90deg, var(--paper-line-strong) 0 1px, transparent 1px 100px),
    repeating-linear-gradient(0deg, var(--paper-line) 0 1px, transparent 1px 20px),
    repeating-linear-gradient(90deg, var(--paper-line) 0 1px, transparent 1px 20px),
    var(--paper);
  touch-action: none;
}
#viewport.panning { cursor: grabbing; }
#viewport.calibrating { cursor: crosshair; }
#viewport.measuring { cursor: crosshair; }

/* midiendo o calibrando, todo lo demás queda estático: sin hover, sin
   cursor propio, sin tooltips — los clicks atraviesan hacia el plano */
#viewport.measuring .item, #viewport.calibrating .item,
#viewport.measuring .measure, #viewport.calibrating .measure,
#viewport.measuring .meas-label, #viewport.calibrating .meas-label {
  pointer-events: none;
}

#world {
  position: absolute;
  top: 0; left: 0;
  transform-origin: 0 0;
}

/* fondo de papel dentro de #world: el multiply del plano mezcla contra esto.
   Color liso: una cuadrícula acá se escalaría con el zoom y hace moiré al arrastrar */
#world.img-multiply { background: var(--paper); }

#planImg {
  display: block;
  user-select: none;
  box-shadow: 0 6px 30px rgba(34, 48, 58, 0.28);
  outline: 1px solid rgba(34, 48, 58, 0.25);
  background: #fff;
  opacity: var(--img-opacity, 1);
  filter: var(--img-invert, invert(0));
  mix-blend-mode: var(--img-blend, normal);
}
#planImg[src=""] { display: none; }

#calibSvg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  overflow: visible;
  pointer-events: none;
}
#calibLine {
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-dasharray: 8 5;
  vector-effect: non-scaling-stroke;
}
#calibA, #calibB {
  fill: var(--accent);
  stroke: var(--cream);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
#calibSvg.hidden { display: none; }

#items { position: absolute; top: 0; left: 0; }
#measures { position: absolute; top: 0; left: 0; }

/* ── Mediciones (📏) ─────────────────────────────────────────────── */

.measure {
  position: absolute;
  height: 22px;
  cursor: grab;
  user-select: none;
  z-index: 2;
}
.measure:active { cursor: grabbing; }
.measure.selected { z-index: 70; }
.measure.preview { pointer-events: none; }

.meas-line {
  position: absolute;
  left: 0; right: 0; top: 50%;
  border-top: 1.5px dashed rgba(62, 82, 92, 0.6);
}
.meas-line::before, .meas-line::after {
  content: "";
  position: absolute;
  top: -6px;
  width: 1.5px; height: 10px;
  background: rgba(62, 82, 92, 0.6);
}
.meas-line::before { left: 0; }
.meas-line::after { right: 0; }

.meas-label {
  position: absolute;
  left: 50%; top: 50%;
  background: var(--cream);
  border: 1px solid rgba(62, 82, 92, 0.4);
  border-radius: 4px;
  padding: 1px 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
}
.meas-label:hover { border-color: var(--accent); color: var(--accent); }
.measure.preview .meas-label { pointer-events: none; }

.measure.anchored .meas-label::before { content: "⚓ "; font-size: 9px; }

.measure.selected .meas-line { border-color: var(--accent); }
.measure.selected .meas-line::before, .measure.selected .meas-line::after { background: var(--accent); }
.measure.selected .meas-label { border-color: var(--accent); color: var(--accent); }
.measure.selected .rot-handle, .measure.selected .del-handle { display: flex; }
/* una medición anclada no rota a mano: su ángulo lo dictan los muebles */
.measure.anchored .rot-handle { display: none; }

.ruler-btn {
  pointer-events: auto;
  font-size: 14px;
  line-height: 1;
  background: var(--cream);
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  width: 30px; height: 28px;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(34, 48, 58, 0.22);
  transition: transform 0.1s, border-color 0.1s;
}
.ruler-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.ruler-btn.armed { background: var(--accent); border-color: var(--accent); }

/* ── Muebles sobre el plano ──────────────────────────────────────── */

.item {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  cursor: grab;
  user-select: none;
  z-index: 1;
}
.item:active { cursor: grabbing; }
/* muebles redondos: el border-radius también recorta el área clickeable */
.item.round, .item.round .item-body { border-radius: 50%; }
/* media luna: lado plano arriba, curva hasta abajo (ancho = diámetro, prof = radio) */
.item.semi, .item.semi .item-body { border-radius: 0 0 50% 50% / 0 0 100% 100%; }
/* el mueble seleccionado va arriba de todo: sus handles no quedan tapados */
.item.selected { z-index: 60; }

.item-body {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 2px;
  border: 1.5px solid var(--ic, var(--accent));
  background: color-mix(in srgb, var(--ic, var(--accent)) 52%, #f3efe4);
  box-shadow: inset 0 0 0 1.5px rgba(245, 241, 230, 0.35);
}

.item-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  pointer-events: none;
}

.item-name {
  font-size: 1em;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  line-height: 1.12;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.item-dims {
  font-family: var(--font-mono);
  font-size: 0.72em;
  color: var(--ink-soft);
  white-space: nowrap;
}
.item-name.initials { letter-spacing: 0.08em; }

.item.selected .item-body {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
}

/* ── Spotlight: hover en la lista resalta el mueble en el plano ──── */

#planImg, .item { transition: filter 0.18s ease, opacity 0.18s ease; }
.item-body { transition: box-shadow 0.18s ease; }

#world.spotlight #planImg { filter: var(--img-invert, invert(0)) brightness(0.55) saturate(0.6); }
#world.spotlight .item:not(.spot) {
  filter: brightness(0.55) saturate(0.5);
  opacity: 0.6;
}
#world.spotlight .measure { opacity: 0.35; }
#world.spotlight .item.spot { z-index: 55; }
#world.spotlight .item.spot .item-body {
  box-shadow:
    inset 0 0 0 1.5px rgba(245, 241, 230, 0.35),
    0 0 0 3px rgba(245, 241, 230, 0.85),
    0 0 26px 10px rgba(245, 241, 230, 0.55);
}

.rot-handle, .del-handle {
  position: absolute;
  display: none;
  align-items: center;
  justify-content: center;
  transform-origin: center;
}
.item.selected .rot-handle, .item.selected .del-handle { display: flex; }
/* con selección múltiple los handles individuales se esconden (R rota el grupo) */
#items.multi .rot-handle, #items.multi .del-handle { display: none; }

#marquee {
  position: absolute;
  border: 1.5px dashed var(--accent);
  background: rgba(200, 80, 46, 0.08);
  z-index: 15;
  pointer-events: none;
}

.rot-handle {
  left: 50%;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--cream);
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  cursor: grab;
  box-shadow: 0 2px 6px rgba(34, 48, 58, 0.3);
}
.rot-handle::before { content: "⟳"; }

.del-handle {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  border: none;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(34, 48, 58, 0.3);
}
.del-handle:hover { background: var(--accent); }

/* ── Topbar flotante ─────────────────────────────────────────────── */

.topbar {
  position: absolute;
  top: 14px; left: 16px; right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 10;
}
.topbar > * { pointer-events: auto; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--cream);
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 2.5px 2.5px 0 rgba(34, 48, 58, 0.22);
}

.chip-name { max-width: 300px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.chip-name:hover { border-color: var(--accent); }

.chip-btn { cursor: pointer; font-family: var(--font-display); transition: transform 0.1s; }
.chip-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--cream); transform: translateY(-1px); }
.chip-btn.armed { background: var(--accent); border-color: var(--accent); color: var(--cream); }

.chip-scale {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ok);
  border-color: var(--ok);
}

/* ── Botón de ayuda (?) con tooltip de Shift ─────────────────────── */

.help-wrap {
  position: relative;
  display: flex;
  margin-left: auto;
}
#btnHelp { font-weight: 800; padding: 7px 13px; }
#btnHelp.armed { background: var(--accent); border-color: var(--accent); color: var(--cream); }

#shiftTip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: var(--ink);
  color: var(--cream);
  border-radius: 6px;
  padding: 13px 16px;
  font-size: 12.5px;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(34, 48, 58, 0.4);
  z-index: 30;
}
#shiftTip b {
  color: #f0a58f;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
#shiftTip b:not(:first-child) { margin-top: 7px; }
#shiftTip span i {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--cream-dim);
  margin-left: 4px;
}

.zoomctl { padding: 3px 4px; gap: 0; }

/* ── Ajustes de imagen (🎚) ──────────────────────────────────────── */

.tools-wrap { position: relative; display: flex; }

/* mismo padding vertical y tipografía que los demás chips → misma altura */
#btnImgTools {
  width: 34px;
  padding: 7px 0;
  justify-content: center;
}
#btnImgTools.armed { background: var(--accent); border-color: var(--accent); color: var(--cream); }

#imgTip {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--ink);
  color: var(--cream);
  border-radius: 6px;
  padding: 13px 16px;
  font-size: 12.5px;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(34, 48, 58, 0.4);
  z-index: 30;
}
#imgTip b {
  color: #f0a58f;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
#imgTip label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cream-dim);
}
#imgOpacity { width: 180px; accent-color: var(--accent); }

.tip-toggle {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  color: var(--cream);
  background: var(--panel-hi);
  border: 1px solid rgba(245, 241, 230, 0.2);
  border-radius: 4px;
  padding: 7px 10px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.tip-toggle:hover { border-color: rgba(245, 241, 230, 0.45); }
.tip-toggle.on { background: var(--accent); border-color: var(--accent); }
.tip-toggle i {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--cream-dim);
  margin-left: 4px;
}
.tip-toggle.on i { color: var(--cream); }
.zoomctl button {
  background: none;
  border: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  width: 30px; height: 28px;
  cursor: pointer;
  border-radius: 3px;
}
.zoomctl button:hover { background: var(--accent-soft); color: var(--accent); }

/* ── Hero / dropzone ─────────────────────────────────────────────── */

#dropHero {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
#dropHero.hidden { display: none; }

.hero-card {
  text-align: center;
  background: var(--cream);
  border: 2px dashed var(--ink-soft);
  border-radius: 10px;
  padding: 44px 56px;
  max-width: 460px;
  box-shadow: 5px 5px 0 rgba(34, 48, 58, 0.15);
  transform: rotate(-0.5deg);
}
#viewport.dragover .hero-card, #viewport.dragover { border-color: var(--accent); }
.hero-icon { font-size: 44px; color: var(--accent); margin-bottom: 8px; }
.hero-card h2 { font-size: 22px; font-weight: 800; margin-bottom: 10px; }
.hero-card p { font-size: 14px; line-height: 1.6; color: var(--ink-soft); margin-bottom: 20px; }

.btn-primary {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  background: var(--accent);
  color: var(--cream);
  border: none;
  border-radius: 5px;
  padding: 10px 22px;
  cursor: pointer;
  box-shadow: 2.5px 2.5px 0 rgba(34, 48, 58, 0.3);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn-primary:hover { transform: translate(-1px, -1px); box-shadow: 3.5px 3.5px 0 rgba(34, 48, 58, 0.3); }
.btn-primary:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(34, 48, 58, 0.3); }

.hero-demo {
  display: block;
  margin: 14px auto 0;
  background: none;
  border: none;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: underline;
  cursor: pointer;
}
.hero-demo:hover { color: var(--accent); }

/* ── Tip de calibración y regla ──────────────────────────────────── */

#calibTip {
  position: absolute;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--cream);
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(34, 48, 58, 0.4);
  z-index: 10;
  max-width: 90%;
}
#calibTip b { color: #f0a58f; }
#calibTip i { opacity: 0.7; }

#scaleRuler {
  position: absolute;
  bottom: 18px; left: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 8;
  pointer-events: none;
}
#scaleRuler i {
  display: block;
  height: 0;
  border-bottom: 3px solid var(--ink);
  position: relative;
}
#scaleRuler i::before, #scaleRuler i::after {
  content: "";
  position: absolute;
  top: -5px;
  width: 2px; height: 11px;
  background: var(--ink);
}
#scaleRuler i::before { left: 0; }
#scaleRuler i::after { right: 0; }
#scaleRuler span {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
}

/* ── Diálogos ────────────────────────────────────────────────────── */

dialog {
  margin: auto;   /* el reset global pisa el centrado nativo del dialog */
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--cream);
  color: var(--ink);
  padding: 26px 28px;
  width: min(400px, 92vw);
  box-shadow: 6px 6px 0 rgba(34, 48, 58, 0.25);
  font-family: var(--font-display);
}
dialog::backdrop { background: rgba(34, 48, 58, 0.45); backdrop-filter: blur(2px); }

dialog h3 { font-size: 19px; font-weight: 800; margin-bottom: 18px; }

.anchor-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin-bottom: 18px;
}
.anchor-text b { color: var(--ink); }

/* ── Instructivo / bienvenida ────────────────────────────────────── */

#helpDialog {
  width: min(700px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: 38px 46px 30px;
}

.help-body h1 {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 16px;
}
.help-lead {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.help-lead b { color: var(--ink); }

.help-body h3 {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 24px 0 12px;
  border-bottom: 1px dashed rgba(34, 48, 58, 0.2);
  padding-bottom: 6px;
}

.help-steps { list-style: none; counter-reset: paso; }
.help-steps li {
  counter-increment: paso;
  position: relative;
  padding-left: 32px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin-bottom: 11px;
}
.help-steps li::before {
  content: counter(paso);
  position: absolute;
  left: 0;
  top: 1px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--cream);
  font-weight: 800;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.help-steps b, .help-tips b { color: var(--ink); }

.help-tips { list-style: none; }
.help-tips li {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin-bottom: 9px;
}

.help-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 26px;
}
.help-luck {
  font-style: italic;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.tip-link {
  background: none;
  border: none;
  padding: 0;
  margin-top: 5px;
  text-align: left;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 600;
  color: #f0a58f;
  cursor: pointer;
}
.tip-link:hover { text-decoration: underline; }

dialog label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

dialog input, dialog select {
  display: block;
  width: 100%;
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 9px 10px;
  border: 1.5px solid var(--ink-soft);
  border-radius: 4px;
  background: #fffdf7;
  color: var(--ink);
}
dialog input:focus, dialog select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.dims-row { display: flex; gap: 12px; }
.dims-row label { flex: 1; }

.shape-toggle { display: flex; gap: 6px; margin-top: 7px; }
.shape-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 4px;
  white-space: nowrap;
  border: 1.5px solid var(--ink-soft);
  border-radius: 4px;
  background: #fffdf7;
  color: var(--ink-soft);
  cursor: pointer;
}
.shape-btn:hover { border-color: var(--ink); color: var(--ink); }
.shape-btn.selected {
  border-color: var(--accent);
  color: var(--ink);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.shape-ico {
  width: 16px; height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}
.shape-ico.round { width: 14px; height: 14px; border-radius: 50%; }
.shape-ico.semi { width: 16px; height: 8px; border-radius: 0 0 50% 50% / 0 0 100% 100%; }

.swatches { display: flex; gap: 7px; margin-top: 7px; flex-wrap: wrap; }
.swatch {
  width: 30px; height: 30px;
  border-radius: 5px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s;
}
.swatch:hover { transform: scale(1.12); }
.swatch.selected { border-color: var(--ink); box-shadow: 0 0 0 2px var(--cream), 0 0 0 3.5px var(--ink); }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.btn-ghost {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  background: none;
  border: 1.5px solid var(--ink-soft);
  color: var(--ink-soft);
  border-radius: 5px;
  padding: 9px 18px;
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }

.hidden { display: none !important; }

/* ── Tooltip de mueble ───────────────────────────────────────────── */

#tooltip {
  position: fixed;
  display: none;
  flex-direction: column;
  gap: 2px;
  background: var(--ink);
  color: var(--cream);
  padding: 7px 12px;
  border-radius: 5px;
  box-shadow: 0 4px 14px rgba(34, 48, 58, 0.35);
  z-index: 90;
  pointer-events: none;
  white-space: nowrap;
}
#tooltip.show { display: flex; }
#tooltip .tt-name { font-size: 13px; font-weight: 600; }
#tooltip .tt-dims { font-family: var(--font-mono); font-size: 11px; color: var(--cream-dim); }

/* ── Toast ───────────────────────────────────────────────────────── */

#toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  opacity: 0;
  visibility: hidden;
  background: var(--ink);
  color: var(--cream);
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(34, 48, 58, 0.4);
  z-index: 100;
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2), opacity 0.22s ease, visibility 0.22s;
  pointer-events: none;
}
#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

/* ── Mobile: barra inferior + sheets ─────────────────────────────── */

#mobileTabs { display: none; }

@media (max-width: 768px) {
  body { height: 100dvh; padding-bottom: calc(54px + env(safe-area-inset-bottom)); }

  /* inputs a 16px: por debajo de eso iOS hace zoom automático al enfocar */
  input, textarea, select {
    font-size: 16px !important;
  }

  #mobileTabs {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(54px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--panel);
    border-top: 3px solid var(--panel-edge);
    z-index: 50;
  }
  #mobileTabs button {
    flex: 1;
    background: none;
    border: none;
    color: var(--cream-dim);
    font-family: var(--font-display);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
  }
  #mobileTabs button.active {
    color: var(--cream);
    background: var(--panel-hi);
    box-shadow: inset 0 3px 0 var(--accent);
  }

  /* la sidebar se convierte en un sheet que sube desde la barra */
  .sidebar {
    position: fixed;
    left: 0; right: 0;
    top: auto;
    bottom: calc(54px + env(safe-area-inset-bottom));
    width: auto;
    flex: none;
    max-height: 62dvh;
    display: none;
    border-right: none;
    border-top: 2px solid var(--panel-edge);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 30px rgba(24, 33, 41, 0.45);
    z-index: 45;
  }
  body.sheet-furniture .sidebar, body.sheet-plans .sidebar { display: flex; }
  body.sheet-furniture .panel-plans { display: none; }
  body.sheet-plans .panel-furniture { display: none; }
  .brand { display: none; }
  .panel { padding-top: 14px; flex: 1; }
  .panel-plans { border-top: none; }

  .topbar { flex-wrap: wrap; }
  .chip-name { max-width: 150px; }
  #shiftTip { white-space: normal; width: min(320px, calc(100vw - 32px)); }
  #toast { bottom: calc(72px + env(safe-area-inset-bottom)); }

  /* swipe-izquierda en cards de muebles: acciones grandes tocables */
  .furn-card { position: relative; overflow: hidden; }
  .furn-body { transition: transform 0.2s ease; }
  .furn-card.swiped .furn-body { transform: translateX(-116px); }

  .furn-card.swiped .swipe-actions {
    display: flex;
    position: absolute;
    top: 0; right: 0; bottom: 0;
  }
  .swipe-actions button {
    width: 58px;
    border: none;
    font-size: 19px;
    color: var(--cream);
    cursor: pointer;
  }
  .swipe-actions [data-act="edit"] { background: #3e7c8f; }
  .swipe-actions [data-act="del"] { background: #b0486d; }

  /* en touch el hover queda "pegado": las medidas se muestran siempre
     y los botoncitos chicos de hover no aparecen nunca */
  .furn-card:hover .furn-dims { display: block; }
  .furn-card:hover .furn-actions { display: none; }
}
