/* ════════════════════════════════════════════════════════════
   ARMARIOS VIFREN — CONFIGURADOR INTERNO
   Edición lujo editorial · Champán cálido + tipografía editorial
   ════════════════════════════════════════════════════════════ */

:root {
  /* Paleta champán cálido (alineada con la web Vifren) */
  --bg:           #F4ECD7;
  --bg-soft:      #ECE2C8;
  --bg-warm:      #E5DABE;
  --paper:        #FBF6E9;
  --paper-soft:   #F8F1DE;
  --ink:          #1A1611;
  --ink-soft:     #574B3D;
  --ink-mute:     #8C7F6C;
  --ink-faint:    #B8AB94;
  --line:         rgba(26,22,17,0.10);
  --line-soft:    rgba(26,22,17,0.06);
  --line-strong:  rgba(26,22,17,0.20);
  --gold:         #B89968;
  --gold-deep:    #8E7340;
  --terra:        #8C3A28;
  --olive:        #6E6A3F;
  --sage:         #7A8068;
  --green-ok:     #4F6B45;
  --warn:         #B07530;
  --error:        #8C3A28;

  /* Tipografía */
  --serif: 'Cormorant', 'Cormorant Garamond', Georgia, serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Geometría */
  --radius:      14px;
  --radius-sm:   8px;
  --radius-lg:   22px;
  --radius-pill: 999px;

  /* Sombras suaves tipo papel */
  --shadow-1: 0 1px 0 rgba(26,22,17,0.03), 0 2px 6px rgba(26,22,17,0.04);
  --shadow-2: 0 1px 0 rgba(26,22,17,0.04), 0 6px 18px rgba(26,22,17,0.07);
  --shadow-3: 0 2px 0 rgba(26,22,17,0.05), 0 12px 40px rgba(26,22,17,0.10);
  --shadow-modal: 0 -2px 0 rgba(26,22,17,0.06), 0 -20px 60px rgba(26,22,17,0.18);

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top:    env(safe-area-inset-top, 0px);
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: -0.005em;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Textura sutil de papel sobre el fondo (entelado champán) */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    radial-gradient(circle at 20% 25%, rgba(255,255,255,0.18) 0%, transparent 35%),
    radial-gradient(circle at 80% 70%, rgba(184,153,104,0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ── SCREENS ────────────────────────────────────────────────── */
.screen {
  position: fixed; inset: 0;
  display: none;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  z-index: 1;
}
.screen.active { display: flex; }

/* ── TOP BAR ────────────────────────────────────────────────── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 18px;
  padding-top: var(--safe-top);
  height: calc(60px + var(--safe-top));
  background: rgba(244,236,215,0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.top-bar-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--ink);
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 8px;
}
.back-btn {
  background: none; border: none;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 10px 6px 10px 0;
  min-width: 80px;
  display: flex;
  align-items: center;
  gap: 4px;
  text-align: left;
}
.back-btn:active { color: var(--ink); }

.icon-btn {
  background: none; border: none;
  color: var(--ink-soft);
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.icon-btn:active { background: rgba(26,22,17,0.06); }
.icon-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; }

/* ── SCROLL AREA ───────────────────────────────────────────── */
.scroll-area {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 18px;
  padding-bottom: calc(28px + var(--safe-bottom));
}

/* ════════════════════════════════════════════════════════════
   LOGIN
═════════════════════════════════════════════════════════════ */
.login-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 48px;
  padding: 40px 24px calc(40px + var(--safe-bottom));
  background:
    radial-gradient(ellipse at 50% 20%, rgba(184,153,104,0.10) 0%, transparent 60%),
    var(--bg);
}
.login-logo { text-align: center; }
.logo-mark {
  width: 88px; height: 88px;
  border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, var(--ink) 0%, #2A211A 60%, var(--gold-deep) 100%);
  color: var(--bg);
  font-family: var(--serif);
  font-style: italic;
  font-size: 50px;
  font-weight: 400;
  margin: 0 auto 24px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.5) inset,
    0 -1px 0 rgba(0,0,0,0.4) inset,
    0 8px 36px rgba(26,22,17,0.20),
    0 2px 8px rgba(26,22,17,0.10);
  letter-spacing: -0.05em;
}
.login-logo h1 {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--ink);
}
.login-logo h1 span {
  font-style: italic;
  font-weight: 400;
  color: var(--gold-deep);
}
.login-logo p {
  margin-top: 12px;
  font-size: 11.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}

.login-pin {
  display: flex; flex-direction: column;
  align-items: center;
  gap: 24px;
}
.pin-dots {
  display: flex;
  gap: 16px;
  padding: 8px 0;
}
.pin-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-faint);
  background: transparent;
  transition: all 0.18s ease;
}
.pin-dot.filled {
  background: var(--ink);
  border-color: var(--ink);
  transform: scale(1.15);
}
.pin-hint {
  font-size: 13px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  min-height: 18px;
  transition: color 0.2s;
}
.pin-hint.error { color: var(--error); }

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 76px);
  gap: 14px;
}
.pin-btn {
  width: 76px; height: 76px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-1);
  transition: transform 0.08s, background 0.12s;
}
.pin-btn:active { background: var(--bg-soft); transform: scale(0.94); }
.pin-btn.ghost { background: transparent; border-color: transparent; box-shadow: none; pointer-events: none; }
.pin-btn.del { color: var(--ink-mute); }
.pin-btn.del svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.pin-btn.ok {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.pin-btn.ok:active { background: var(--ink-soft); }
.pin-btn.ok svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-7px); }
  40%,80% { transform: translateX(7px); }
}
.shake { animation: shake 0.4s ease; }

/* ════════════════════════════════════════════════════════════
   HOME
═════════════════════════════════════════════════════════════ */
.search-row {
  padding: 14px 18px;
  background: rgba(244,236,215,0.7);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.search-input {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--ink);
  padding: 11px 18px;
  font-size: 14.5px;
  font-family: var(--sans);
  transition: border-color 0.2s, background 0.2s;
  box-shadow: var(--shadow-1);
}
.search-input::placeholder { color: var(--ink-faint); }
.search-input:focus { outline: none; border-color: var(--gold); }

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ── CARPETAS DE USUARIO (nivel superior, solo si hay varios owners) ── */
.owner-section { grid-column: 1 / -1; margin-bottom: 22px; }
.owner-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; margin-bottom: 12px;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer; user-select: none;
  box-shadow: var(--shadow-1);
}
.owner-section.mine .owner-header { background: var(--gold-deep, #8a6f3f); border-color: var(--gold-deep, #8a6f3f); }
.owner-header:hover { filter: brightness(1.08); }
.owner-caret { transition: transform 0.2s; flex-shrink: 0; opacity: 0.85; transform: rotate(-90deg); }
.owner-caret.open { transform: rotate(0deg); }
.owner-icon { font-size: 18px; flex-shrink: 0; }
.owner-name {
  font: 500 17px var(--serif); flex: 1;
  letter-spacing: 0.02em;
  text-transform: capitalize;
}
.owner-count {
  font: 600 12px var(--sans);
  background: rgba(255,255,255,0.18);
  padding: 2px 10px; border-radius: 999px; flex-shrink: 0;
}
.owner-body { padding-left: 16px; border-left: 2px solid rgba(184,153,104,0.20); margin-left: 8px; }
.owner-body.collapsed { display: none; }
@media (pointer: coarse) {
  .owner-header { padding: 14px 18px; }
  .owner-name { font-size: 19px; }
}

/* ── VIVIENDAS (carpetas de proyectos) ───────────────────────── */
.vivienda-section { grid-column: 1 / -1; }   /* ocupa toda la fila del grid */
.vivienda-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin-bottom: 10px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer;
  user-select: none;
}
.vivienda-header:hover { background: rgba(184,153,104,0.06); border-color: var(--gold); }
.vivienda-caret { transition: transform 0.2s; flex-shrink: 0; opacity: 0.6; }
.vivienda-caret.open { transform: rotate(0deg); }
.vivienda-caret { transform: rotate(-90deg); }
.vivienda-caret.open { transform: rotate(0deg); }
.vivienda-icon { font-size: 18px; flex-shrink: 0; }
.vivienda-name { font: 600 16px var(--serif); color: var(--ink); flex: 1; }
.vivienda-count {
  font: 600 12px var(--sans); color: var(--ink-mute);
  background: rgba(184,153,104,0.12); padding: 2px 10px;
  border-radius: 999px; flex-shrink: 0;
}
.vivienda-rename, .vivienda-delete {
  background: transparent; border: 1px solid transparent;
  width: 32px; height: 32px; border-radius: 6px;
  cursor: pointer; font-size: 14px; color: var(--ink-mute);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.vivienda-rename:hover { background: rgba(184,153,104,0.12); color: var(--gold-deep); }
.vivienda-delete:hover { background: rgba(255,100,80,0.12); color: #d44; }
.vivienda-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px; margin-bottom: 18px;
  padding-left: 12px;       /* sangría visual respecto al header de la carpeta */
  border-left: 2px solid rgba(184,153,104,0.15);
  margin-left: 14px;
}
.vivienda-grid.collapsed { display: none; }
.vivienda-sueltos .sueltos-header { cursor: default; opacity: 0.85; }
.vivienda-sueltos .sueltos-header:hover { background: var(--paper); border-color: var(--line); }
@media (pointer: coarse) {
  .vivienda-header { padding: 14px 16px; }
  .vivienda-name { font-size: 18px; }
  .vivienda-rename, .vivienda-delete { width: 40px; height: 40px; font-size: 18px; }
}
.project-card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-1);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.project-card:active { transform: translateY(1px); box-shadow: var(--shadow-1); border-color: var(--gold); }
.project-card-thumb {
  background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg-warm) 100%);
  height: 130px;
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
  overflow: hidden;
}
.project-card-thumb svg { width: 80%; height: 80%; }
.thumb-empty {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-faint);
}
.project-card-info { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.card-tipo-badge {
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--gold-deep); background: rgba(184,153,104,0.12);
  border-radius: var(--radius-pill); padding: 2px 8px;
  display: inline-block; margin-bottom: 4px;
}
.project-card-name {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.15;
}
.project-card-address {
  font-size: 12.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-card-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.project-card-meta span {
  font-size: 10.5px;
  color: var(--ink-soft);
  background: var(--bg-warm);
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
  font-weight: 500;
}
.asana-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--terra);
  background: rgba(140,58,40,0.08);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  width: fit-content;
}
.asana-badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--terra);
}
.card-delete-btn {
  position: absolute;
  top: 10px; right: 10px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(251,246,233,0.95);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
  backdrop-filter: blur(8px);
}
.project-card:hover .card-delete-btn,
.project-card.show-delete .card-delete-btn { opacity: 1; }
.card-delete-btn:active { color: var(--error); }

.card-share-btn {
  position: absolute;
  top: 10px; right: 46px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(251,246,233,0.95);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
  backdrop-filter: blur(8px);
}
.project-card:hover .card-share-btn,
.project-card.show-delete .card-share-btn { opacity: 1; }
.card-share-btn:active { color: var(--ink); }
.card-share-btn svg { stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (pointer: coarse) { .card-share-btn { opacity: 1; } }

.card-owner-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-mute);
  padding: 2px 8px;
  background: rgba(184,153,104,0.10);
  border-radius: 4px;
}
.card-shared-badge {
  display: inline-block;
  margin-top: 6px;
  margin-left: 4px;
  font-size: 10px;
  letter-spacing: 0.10em;
  font-weight: 600;
  color: var(--ink-mute);
  padding: 2px 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
}

/* Card en uso por otro usuario */
.project-card.is-locked { opacity: 0.62; }
.project-card.is-locked:hover { opacity: 0.80; }
.card-lock-badge {
  position: absolute;
  top: 10px; left: 10px;
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: rgba(180,60,40,0.10);
  border: 1px solid rgba(180,60,40,0.35);
  color: #c84438;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  pointer-events: none;
}
.card-lock-badge svg { stroke: currentColor; fill: none; stroke-width: 2; }

/* Modal Lock — icono grande */
.lock-icon-wrap {
  display: flex; justify-content: center;
  margin: 4px 0 8px;
}
.lock-big {
  width: 48px; height: 48px;
  stroke: var(--ink-soft);
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--ink-soft);
  grid-column: 1 / -1;
}
.empty-state .empty-mark {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
}
.empty-state .empty-mark svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 1.4; }
.empty-state h3 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 300;
  margin-bottom: 6px;
  color: var(--ink);
}
.empty-state p {
  font-size: 13.5px;
  color: var(--ink-mute);
}

.fab {
  position: fixed;
  bottom: calc(28px + var(--safe-bottom));
  right: 28px;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.12) inset,
    0 8px 28px rgba(26,22,17,0.30),
    0 2px 6px rgba(26,22,17,0.15);
  transition: transform 0.15s;
  z-index: 10;
}
.fab svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 1.6; fill: none; }
.fab:active { transform: scale(0.92); }

/* ════════════════════════════════════════════════════════════
   FORMS
═════════════════════════════════════════════════════════════ */
.form-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-1);
}
.form-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.form-input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  padding: 13px 14px;
  font-size: 15px;
  font-family: var(--sans);
  width: 100%;
  transition: border-color 0.2s, background 0.2s;
  font-weight: 400;
}
.form-input:focus { outline: none; border-color: var(--gold); background: var(--paper); }
.form-input::placeholder { color: var(--ink-faint); }
textarea.form-input { resize: vertical; min-height: 70px; }
.form-hint {
  font-size: 11.5px;
  color: var(--ink-mute);
  margin-top: 4px;
  line-height: 1.5;
  font-style: italic;
}
.form-row { display: flex; gap: 12px; }
.form-group.half { flex: 1; }
.btn-row { justify-content: flex-end; gap: 10px; margin-top: 4px; }

.opt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.opt-btn {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 500;
  padding: 13px 10px;
  font-family: var(--sans);
  transition: all 0.15s;
  letter-spacing: 0.005em;
}
.opt-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
  font-weight: 500;
}
.opt-btn:active { transform: scale(0.97); }

/* Botones rápidos de patas (Holguras) */
.patas-btn,
.tipo-frente-btn {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  min-width: 38px;
  font-family: var(--sans);
  transition: all 0.15s;
  cursor: pointer;
}
.patas-btn:hover,
.tipo-frente-btn:hover { border-color: var(--ink-soft); }
.patas-btn.active,
.tipo-frente-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.patas-btn:active,
.tipo-frente-btn:active { transform: scale(0.97); }

.asana-link-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  padding: 13px 14px;
  font-size: 14.5px;
  width: 100%;
  font-family: var(--sans);
  transition: all 0.2s;
}
.asana-link-btn.linked {
  background: rgba(140,58,40,0.05);
  border-color: rgba(140,58,40,0.3);
  color: var(--terra);
}
.asana-link-btn:active { background: var(--bg-soft); }
.asana-link-btn .chev { margin-left: auto; color: var(--ink-faint); }

.asana-logo {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, #f5614e, #fc9455);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(245,97,78,0.3);
}
.asana-logo.sm { width: 18px; height: 18px; font-size: 10px; border-radius: 4px; }

/* ── SCREEN FOOTER ─────────────────────────────────────────── */
.screen-footer {
  padding: 16px 18px;
  padding-bottom: calc(16px + var(--safe-bottom));
  background: rgba(244,236,215,0.92);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.screen-footer.two-btn { display: flex; gap: 12px; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn-primary {
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  color: var(--bg);
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 14px 22px;
  font-family: var(--sans);
  transition: opacity 0.15s, transform 0.1s;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.12) inset,
    0 4px 14px rgba(26,22,17,0.18);
}
.btn-primary:active { opacity: 0.92; transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary.full { width: 100%; }
.btn-primary.gold {
  background: linear-gradient(135deg, var(--gold-deep), var(--gold));
  border-color: var(--gold-deep);
}

.btn-secondary {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 500;
  padding: 13px 18px;
  font-family: var(--sans);
  transition: background 0.15s;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-1);
}
.btn-secondary.full { width: 100%; }
.btn-secondary:active { background: var(--bg-soft); }
.btn-secondary.active,
.obs-var-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.btn-danger {
  background: rgba(140,58,40,0.06);
  border: 1px solid rgba(140,58,40,0.30);
  border-radius: var(--radius-sm);
  color: var(--terra);
  font-size: 14.5px;
  font-weight: 500;
  padding: 13px 18px;
  font-family: var(--sans);
  min-height: 50px;
  width: 100%;
}
.btn-danger:active { background: rgba(140,58,40,0.12); }

.btn-small {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
  padding: 8px 14px;
  font-family: var(--sans);
  white-space: nowrap;
  min-height: 36px;
}
.btn-small:active { background: var(--bg-soft); }
.btn-small.accent { color: var(--bg); background: var(--ink); border-color: var(--ink); }

.btn-icon-danger {
  background: none;
  border: none;
  color: var(--ink-faint);
  font-size: 14px;
  padding: 8px;
  border-radius: 6px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
}
.btn-icon-danger:active { color: var(--terra); background: rgba(140,58,40,0.08); }
.btn-icon-danger svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; }

/* ════════════════════════════════════════════════════════════
   MEDICIONES
═════════════════════════════════════════════════════════════ */
.meas-step {
  display: none;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 26px 20px 20px;
  flex-direction: column;
  gap: 20px;
}
.meas-step.active { display: flex; }
.meas-header {
  text-align: center;
  margin-bottom: 4px;
}
.meas-header .eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-deep);
  font-weight: 600;
  margin-bottom: 8px;
}
.meas-header h3 {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 300;
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1.05;
  margin-bottom: 8px;
}
.meas-header p {
  font-size: 14px;
  color: var(--ink-soft);
  font-style: italic;
  font-family: var(--serif);
  font-weight: 400;
}

.steps-row { display: flex; gap: 5px; align-items: center; }
.step-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-faint);
  transition: all 0.25s;
}
.step-dot.active {
  background: var(--ink);
  width: 22px;
  border-radius: 4px;
}
.step-dot.done { background: var(--gold-deep); }

/* SVG diagram for measurements */
.meas-diagram {
  display: flex;
  justify-content: center;
  margin: 6px 0 6px;
}
.meas-diagram svg { width: 100%; max-width: 320px; height: auto; }

.triple-input {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.tri-field {
  display: flex; flex-direction: column; gap: 7px;
}
.tri-field label {
  font-size: 10.5px;
  color: var(--ink-mute);
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.mm-field {
  display: flex;
  align-items: baseline;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.2s;
  box-shadow: var(--shadow-1);
}
.mm-field:focus-within {
  border-color: var(--gold);
  box-shadow: var(--shadow-1), 0 0 0 3px rgba(184,153,104,0.12);
}
.mm-field.lg { max-width: 220px; }
.mm-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
  padding: 14px 6px 12px;
  text-align: center;
  min-width: 0;
  letter-spacing: -0.01em;
}
.mm-input:focus { outline: none; }
.mm-input::placeholder { color: var(--ink-faint); font-weight: 300; }
.mm-field span {
  font-size: 11px;
  color: var(--ink-mute);
  padding-right: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.level-warn {
  background: rgba(176,117,48,0.08);
  border: 1px solid rgba(176,117,48,0.30);
  border-radius: var(--radius-sm);
  color: var(--warn);
  padding: 12px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.level-warn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.5; flex-shrink: 0; }
.level-warn.hidden { display: none; }
.level-warn strong { font-weight: 600; }

.clearance-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cl-field { display: flex; flex-direction: column; gap: 7px; }
.cl-field label {
  font-size: 10.5px; color: var(--ink-mute); font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
}

.effective-dims-box {
  background: var(--paper);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  box-shadow: var(--shadow-1);
}
.effective-dims-box::before {
  content: 'COTAS EFECTIVAS';
  position: absolute;
  top: -8px; left: 18px;
  background: var(--bg);
  padding: 0 8px;
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--gold-deep);
  font-weight: 700;
}
.eff-dims { display: flex; gap: 22px; flex-wrap: wrap; justify-content: space-around; }
.eff-dim { text-align: center; }
.eff-dim .lbl {
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 4px;
  font-weight: 600;
}
.eff-dim .val {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.eff-dim .val .unit { font-size: 14px; color: var(--ink-mute); margin-left: 3px; }

/* Obstacles */
.obstacles-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.obstacle-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-1);
}
.obs-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--gold-deep);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.obs-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.obs-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.obs-type { font-size: 14px; font-weight: 500; color: var(--ink); }
.obs-dims { font-size: 12px; color: var(--ink-soft); }
.obs-notes { font-size: 12px; color: var(--ink-mute); font-style: italic; font-family: var(--serif); }
.obs-delete { background: none; border: none; color: var(--ink-faint); padding: 6px 8px; flex-shrink: 0; }
.obs-delete:active { color: var(--terra); }
.obs-delete svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.6; }

.empty-msg {
  font-size: 13px;
  color: var(--ink-mute);
  text-align: center;
  padding: 16px;
  font-family: var(--serif);
  font-style: italic;
}

.obstacle-form {
  background: var(--paper);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 12px;
  box-shadow: var(--shadow-2);
}
.obstacle-form.hidden { display: none; }

/* ════════════════════════════════════════════════════════════
   DISEÑO
═════════════════════════════════════════════════════════════ */
.preview-strip {
  background: linear-gradient(180deg, var(--paper) 0%, var(--bg-soft) 100%);
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  flex-shrink: 0;
  position: relative;
}
.preview-strip canvas {
  width: 100%;
  height: 180px;
  display: block;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}

.design-tabs {
  display: flex;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  flex-shrink: 0;
}
.dtab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-mute);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 14px 8px;
  font-family: var(--sans);
  transition: color 0.2s, border-color 0.2s;
  text-transform: uppercase;
}
.dtab.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }

.design-body { flex: 1; overflow: hidden; }
.dpanel {
  display: none;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px;
  flex-direction: column;
  gap: 14px;
}
.dpanel.active { display: flex; }

/* Section header */
.sect-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 4px;
}
.sect-head h4 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 400;
  color: var(--ink);
}
.sect-head .sub { font-size: 11px; color: var(--ink-mute); letter-spacing: 0.05em; }

/* Module templates rail */
.templates-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 8px;
  margin: 0 -18px;
  padding-left: 18px; padding-right: 18px;
  scroll-snap-type: x mandatory;
}
.templates-row::-webkit-scrollbar { display: none; }
.tpl-card {
  flex: 0 0 130px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  scroll-snap-align: start;
  box-shadow: var(--shadow-1);
  transition: border-color 0.2s, transform 0.12s;
}
.tpl-card:active { transform: scale(0.97); border-color: var(--gold); }
.tpl-card .tpl-vis {
  height: 70px;
  background: var(--bg);
  border-radius: 4px;
  border: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.tpl-card .tpl-vis svg { width: 90%; height: 90%; }
.tpl-card .tpl-name {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.1;
}
.tpl-card .tpl-desc { font-size: 10.5px; color: var(--ink-mute); line-height: 1.2; }

/* Modules list */
.modules-list { display: flex; flex-direction: column; gap: 10px; }
.module-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-1);
}
.module-card.selected {
  border-color: var(--gold);
  box-shadow: var(--shadow-1), 0 0 0 3px rgba(184,153,104,0.12);
  background: var(--paper-soft);
}
.module-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.module-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.mod-width-wrap {
  display: flex; align-items: baseline; gap: 4px;
}
.module-width-input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 400;
  padding: 6px 10px;
  width: 86px;
  text-align: center;
  font-feature-settings: 'tnum';
}
.module-width-input:focus { outline: none; border-color: var(--gold); }
.module-mm { font-size: 11px; color: var(--ink-mute); font-weight: 500; letter-spacing: 0.05em; }
.module-elems-tag {
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--bg-soft);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  margin-left: auto;
}
.module-name-display {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.module-card-actions { display: flex; gap: 8px; align-items: center; }
.module-elem-summary { font-size: 11px; color: var(--ink-mute); margin-left: 8px; flex: 1; font-style: italic; font-family: var(--serif); }

.modules-total {
  font-size: 12.5px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  text-align: center;
  border: 1px solid var(--line);
  background: var(--paper);
  letter-spacing: 0.02em;
}
.modules-total.ok { color: var(--green-ok); border-color: rgba(79,107,69,0.3); background: rgba(79,107,69,0.05); }
.modules-total.under { color: var(--warn); border-color: rgba(176,117,48,0.3); background: rgba(176,117,48,0.05); }
.modules-total.over { color: var(--error); border-color: rgba(140,58,40,0.3); background: rgba(140,58,40,0.05); }
.modules-total strong { font-family: var(--serif); font-size: 16px; font-weight: 500; }

.module-elements-panel {
  background: var(--paper);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 4px;
  box-shadow: var(--shadow-2);
}
.module-elements-panel.hidden { display: none; }
.mel-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.mel-header h4 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
}

.elements-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.element-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.elem-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.elem-icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.4; }
.elem-info { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.elem-name { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.elem-pos { font-size: 11.5px; color: var(--ink-soft); font-feature-settings: 'tnum'; }
.elem-notes { font-size: 11.5px; color: var(--ink-mute); font-style: italic; font-family: var(--serif); }

.elem-quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.elem-quick-btn {
  flex: 1;
  min-width: 100px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--ink-soft);
  font-weight: 500;
}
.elem-quick-btn:active { background: var(--bg-soft); border-color: var(--gold); }
.elem-quick-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.4; color: var(--ink); }

/* Counter */
.counter {
  display: flex; align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: fit-content;
}
.ctr-btn {
  background: none; border: none;
  color: var(--ink);
  font-size: 22px;
  padding: 6px 16px;
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 300;
  font-family: var(--serif);
}
.ctr-btn:active { background: var(--bg-soft); }
.ctr-val {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  min-width: 48px;
  text-align: center;
  padding: 0 6px;
  color: var(--ink);
}

/* Materials */
.mat-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 10px;
  padding: 4px 0;
}
.mat-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1.5px solid rgba(26,22,17,0.15);
  cursor: pointer;
  position: relative;
  transition: transform 0.12s, box-shadow 0.18s;
  box-shadow: var(--shadow-1);
  background-clip: padding-box;
}
.mat-btn::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset, 0 -1px 0 rgba(0,0,0,0.08) inset;
}
.mat-btn.selected {
  border-color: var(--ink);
  transform: scale(1.08);
  box-shadow: var(--shadow-2), 0 0 0 3px var(--gold);
}
.mat-btn:active { transform: scale(0.96); }
.mat-label {
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 14px;
  font-style: italic;
  color: var(--gold-deep);
  text-align: center;
  width: 100%;
}

/* ════════════════════════════════════════════════════════════
   PREVIEW
═════════════════════════════════════════════════════════════ */
.view-toggle {
  display: flex;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 0;
}
.vtog {
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  font-family: var(--sans);
  transition: background 0.15s, color 0.15s;
}
.vtog.active {
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 1px 4px rgba(26,22,17,0.2);
}

.preview-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--paper) 0%, var(--bg-warm) 100%);
}
.view-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: none;
}
.view-canvas.active { display: block; }

.preview-controls {
  position: absolute;
  bottom: 18px; left: 18px;
  display: flex;
  gap: 10px;
  align-items: center;
  background: rgba(251,246,233,0.94);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 8px 12px 8px 18px;
  box-shadow: var(--shadow-2);
  z-index: 4;
}
.preview-controls .ctrl-label {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
}
.open-slider {
  width: 130px;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--bg-warm);
  border-radius: 2px;
  outline: none;
}
.open-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
  border: 2px solid var(--paper);
  box-shadow: var(--shadow-1);
}
.open-slider::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
  border: 2px solid var(--paper);
}

.zoom-fit-btn {
  position: absolute;
  top: 16px; right: 16px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(251,246,233,0.94);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  z-index: 4;
  box-shadow: var(--shadow-2);
}
.zoom-fit-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.6; }

.preview-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  padding-bottom: calc(14px + var(--safe-bottom));
  background: rgba(244,236,215,0.95);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.proj-summary {
  flex: 1;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.45;
}
.proj-summary strong {
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 500;
  font-size: 14px;
}

/* ════════════════════════════════════════════════════════════
   AJUSTES
═════════════════════════════════════════════════════════════ */
.settings-section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  display: flex; flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-1);
}
.settings-section h3 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--ink);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 4px;
}
.test-result { font-size: 13px; padding: 4px 0; min-height: 20px; font-style: italic; font-family: var(--serif); }
.test-result .ok { color: var(--green-ok); }
.test-result .err { color: var(--terra); }
.app-version {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  text-transform: uppercase;
  padding: 24px 0 8px;
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════════
   MODALES
═════════════════════════════════════════════════════════════ */
.modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
}
.modal.hidden { display: none; }
.modal-bg {
  position: absolute; inset: 0;
  background: rgba(26,22,17,0.45);
  backdrop-filter: blur(6px);
}
.modal-box {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-height: 85vh;
  display: flex; flex-direction: column;
  animation: slideUp 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
  padding-bottom: var(--safe-bottom);
  box-shadow: var(--shadow-modal);
}
.modal-box.modal-sm { max-height: 70vh; }
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.modal-head::before {
  content: '';
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  width: 36px; height: 4px;
  border-radius: 2px;
  background: var(--ink-faint);
  opacity: 0.4;
}
.modal-head h3 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--ink);
}
.modal-close {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.modal-close svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 24px 24px;
  display: flex; flex-direction: column;
  gap: 14px;
}
.modal-section-label {
  font-size: 10px;
  color: var(--ink-mute);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  margin-bottom: 6px;
  padding-top: 6px;
}

/* Asana list */
.asana-list { display: flex; flex-direction: column; gap: 6px; }
.asana-project-item, .asana-task-item {
  display: flex; align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: background 0.15s, border-color 0.15s;
  font-weight: 400;
}
.asana-project-item:active, .asana-task-item:active { background: var(--bg-soft); border-color: var(--gold); }
.asana-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--terra);
  flex-shrink: 0;
}
.asana-task-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.asana-task-dot.pending { background: var(--ink); }
.asana-task-dot.done { background: var(--green-ok); }
.asana-arrow { margin-left: auto; color: var(--ink-faint); }
.asana-loading {
  text-align: center;
  color: var(--ink-mute);
  padding: 28px;
  font-size: 14px;
  font-family: var(--serif);
  font-style: italic;
}
.done-task { opacity: 0.55; }
.back-link {
  background: none; border: none;
  color: var(--gold-deep);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 0;
  margin-bottom: 8px;
  font-family: var(--sans);
  text-align: left;
  display: flex; align-items: center; gap: 4px;
}

/* Element type grid (modal) */
.elem-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.etype-btn {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 12.5px;
  padding: 14px 8px;
  font-family: var(--sans);
  text-align: center;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.etype-btn svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 1.4; }
.etype-btn.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  font-weight: 500;
}

/* ── TOAST ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(34px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  font-size: 13.5px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  z-index: 200;
  white-space: nowrap;
  box-shadow: var(--shadow-3);
  animation: fadeIn 0.25s ease;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.success { background: var(--green-ok); }
.toast.error { background: var(--terra); }
.toast.hidden { display: none; }
@keyframes fadeIn { from { opacity:0; transform: translateX(-50%) translateY(12px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }

/* ── UTILITIES ──────────────────────────────────────────────── */
.hidden { display: none !important; }
.full { width: 100%; }

/* ── LANDSCAPE / iPad ────────────────────────────────────────── */
@media (min-width: 768px) {
  .modal-box { width: min(640px, 100%); margin: auto; border-radius: var(--radius-lg); }
  .modal { align-items: center; justify-content: center; }
  .opt-grid { grid-template-columns: repeat(4, 1fr); }
  .clearance-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (orientation: landscape) and (min-width: 900px) {
  .meas-step { padding: 32px 40px 20px; }
  .meas-header h3 { font-size: 36px; }
  .login-wrap { gap: 56px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

/* ════════════════════════════════════════════════════════════
   ADICIONES v2.0
════════════════════════════════════════════════════════════ */

/* ── SHAPE SELECTOR ─────────────────────────────────────────── */
.shape-selector { display: flex; gap: 10px; }
.shape-btn {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; gap: 7px;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 8px 10px;
  font-size: 12px; font-weight: 500;
  color: var(--ink-soft); font-family: var(--sans);
  transition: all 0.15s;
}
.shape-btn.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.shape-btn:active { transform: scale(0.97); }
.shape-icon { display: flex; align-items: center; justify-content: center; width: 48px; height: 30px; }
.shape-icon svg { width: 100%; height: 100%; }

/* ── TEMPLATES SECTION ──────────────────────────────────────── */
.templates-section { flex-shrink: 0; margin-bottom: 4px; }
.templates-label {
  font-size: 10px; font-weight: 700; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: 0.20em; margin-bottom: 8px;
}
.tpl-icon {
  display: flex; align-items: center; justify-content: center;
  height: 56px;
  background: var(--bg); border-radius: 6px;
  border: 1px solid var(--line-soft);
  margin-bottom: 4px; color: var(--ink-soft);
}
.tpl-icon svg { width: 36px; height: 36px; }
.tpl-card .tpl-name { font-family: var(--serif); font-size: 13px; font-weight: 500; color: var(--ink); line-height: 1.15; }
.tpl-card:active .tpl-icon { background: var(--bg-soft); }

/* ── MODULES SUMMARY ────────────────────────────────────────── */
.modules-summary {
  font-size: 12.5px; padding: 10px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--paper); letter-spacing: 0.01em;
  color: var(--ink-soft); margin-bottom: 4px; flex-shrink: 0;
}
.modules-summary.ok { color: var(--green-ok); border-color: rgba(79,107,69,0.3); background: rgba(79,107,69,0.05); }
.modules-summary.under { color: var(--warn); border-color: rgba(176,117,48,0.3); background: rgba(176,117,48,0.05); }
.modules-summary.over { color: var(--error); border-color: rgba(140,58,40,0.3); background: rgba(140,58,40,0.05); }
.modules-summary strong { font-family: var(--serif); font-size: 15px; font-weight: 500; }

/* ── MODULE CARD (v2) ───────────────────────────────────────── */
.module-badge {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  font-family: var(--serif); font-size: 13px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.module-width-wrap { display: flex; align-items: baseline; gap: 4px; }
.module-width-input {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink); font-family: var(--serif); font-size: 18px; font-weight: 400;
  padding: 5px 8px; width: 76px; text-align: center; font-feature-settings: 'tnum';
}
.module-width-input:focus { outline: none; border-color: var(--gold); }
.module-mm-label { font-size: 10.5px; color: var(--ink-mute); font-weight: 600; letter-spacing: 0.06em; }
.module-name-tag { font-family: var(--serif); font-style: italic; font-size: 12.5px; color: var(--gold-deep); margin-left: 2px; }
.module-header-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.module-move-btn {
  background: none; border: none; color: var(--ink-faint);
  font-size: 18px; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; font-family: var(--serif);
}
.module-move-btn:active { color: var(--ink); background: var(--bg-soft); }
.module-move-btn:disabled { opacity: 0.25; pointer-events: none; }
.module-delete-btn {
  background: none; border: none; color: var(--ink-faint);
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.module-delete-btn svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.module-delete-btn:active { color: var(--terra); background: rgba(140,58,40,0.08); }

/* ── INLINE ELEMENTS LIST ───────────────────────────────────── */
.module-elements-list {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: 8px; border-top: 1px solid var(--line-soft); padding-top: 8px;
}
.element-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 6px; border-radius: var(--radius-sm); transition: background 0.12s;
}
.element-row:active { background: var(--bg-soft); }
.elem-order-btns { display: flex; flex-direction: column; gap: 0; flex-shrink: 0; }
.order-btn {
  background: none; border: none; color: var(--ink-faint);
  font-size: 9px; width: 20px; height: 16px;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.order-btn:active { color: var(--ink); }
.elem-type-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--ink-faint);
}
.elem-type-dot[data-etype="shelf"]       { background: #8A9060; }
.elem-type-dot[data-etype="rail"]        { background: #A09060; }
.elem-type-dot[data-etype="rail-doble"]  { background: #B0A070; }
.elem-type-dot[data-etype="drawer"]      { background: #8A6040; }
.elem-type-dot[data-etype="shoe-rack"]   { background: #607090; }
.elem-type-dot[data-etype="pull-out"]    { background: #5080A0; }
.elem-type-dot[data-etype="pantalonero"] { background: #805090; }
.elem-type-dot[data-etype="corbatero"]   { background: #907050; }
.elem-type-dot[data-etype="espejo"]      { background: #7090A8; }
.elem-type-dot[data-etype="divider"]     { background: #909090; }
.elem-info-inline { flex: 1; display: flex; flex-direction: column; gap: 0; min-width: 0; }
.elem-name-inline { font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.elem-pos-inline { font-size: 11px; color: var(--ink-mute); font-feature-settings: 'tnum'; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.elem-actions { display: flex; gap: 2px; flex-shrink: 0; }
.elem-edit-btn, .elem-delete-btn {
  background: none; border: none; width: 28px; height: 28px;
  border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--ink-faint);
}
.elem-edit-btn svg, .elem-delete-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.elem-edit-btn:active { color: var(--ink); background: var(--bg-soft); }
.elem-delete-btn:active { color: var(--terra); background: rgba(140,58,40,0.08); }
.elem-empty-hint { font-family: var(--serif); font-style: italic; font-size: 13px; color: var(--ink-faint); padding: 8px 4px; text-align: center; }
.add-elem-inline-btn {
  display: flex; align-items: center; gap: 6px;
  background: none; border: 1px dashed var(--line);
  border-radius: var(--radius-sm); color: var(--ink-mute);
  font-size: 12.5px; font-weight: 500; padding: 8px 12px;
  width: 100%; font-family: var(--sans); transition: border-color 0.15s, color 0.15s;
}
.add-elem-inline-btn svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.add-elem-inline-btn:active { border-color: var(--gold); color: var(--ink); background: var(--paper-soft); }

/* ── ADD MODULE CUSTOM BTN ──────────────────────────────────── */
.btn-add-module-custom {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--paper); border: 1.5px dashed var(--line);
  border-radius: var(--radius); color: var(--ink-soft);
  font-size: 14px; font-weight: 500; padding: 16px;
  width: 100%; font-family: var(--sans); transition: all 0.15s; margin-top: 2px;
}
.btn-add-module-custom svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.btn-add-module-custom:active { background: var(--bg-soft); border-color: var(--gold); color: var(--ink); }

/* ── ELEMENT TYPE GRID (modal) ──────────────────────────────── */
.etype-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.etype-grid .etype-btn { font-size: 12px; padding: 10px 8px; gap: 5px; }
.etype-grid .etype-btn svg { width: 32px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.4; }
@media (min-width: 480px) { .etype-grid { grid-template-columns: repeat(5, 1fr); } }

/* ── PREVIEW CONTROLS (bar between area and footer) ─────────── */
.preview-controls {
  position: relative; left: auto; bottom: auto;
  background: rgba(244,236,215,0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 12px 20px; flex-shrink: 0; z-index: 3;
}
.open-ctrl-row {
  display: flex; align-items: center; gap: 12px;
  max-width: 500px; margin: 0 auto;
}
.open-label { font-size: 11px; color: var(--ink-mute); font-weight: 500; white-space: nowrap; letter-spacing: 0.06em; flex-shrink: 0; }
.open-slider { flex: 1; }

/* ── PREVIEW INTERACTIVE EDITOR ─────────────────────────────── */
.preview-editor {
  display: none;
  background: rgba(244,236,215,0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(190,175,140,0.35);
  padding: 10px 0 6px;
}
.preview-editor.visible { display: block; }

.preview-mod-tabs {
  display: flex;
  gap: 6px;
  padding: 0 16px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.preview-mod-tabs::-webkit-scrollbar { display: none; }
.preview-mod-tab {
  flex-shrink: 0;
  padding: 5px 16px;
  border-radius: 20px;
  background: rgba(26,22,17,0.08);
  color: var(--ink-mute);
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  font-family: inherit;
}
.preview-mod-tab.active {
  background: var(--ink);
  color: var(--paper);
}
.preview-mod-tab.applied {
  background: #2C8A4A;
  color: #fff;
}

.preview-tpl-scroll {
  overflow-x: auto;
  scrollbar-width: none;
}
.preview-tpl-scroll::-webkit-scrollbar { display: none; }
.preview-tpl-row {
  display: flex;
  gap: 8px;
  padding: 2px 16px 4px;
  width: max-content;
}
.preview-tpl-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 10px 6px;
  background: var(--paper);
  border: 1.5px solid rgba(190,175,140,0.4);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 60px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  font-family: inherit;
}
.preview-tpl-chip:active { background: var(--ink); color: var(--paper); transform: scale(0.96); }
.preview-tpl-chip svg { width: 22px; height: 22px; }
.tpl-chip-icon { display: flex; }
.preview-tpl-chip span:last-child { font-size: 10px; font-weight: 500; white-space: nowrap; color: var(--ink-mute); }
.preview-tpl-chip:active span:last-child { color: var(--paper); }

/* Drag ghost */
.tpl-drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(26,22,17,0.35);
  white-space: nowrap;
  opacity: 0.92;
  transform: scale(1.05);
}
.tpl-drag-ghost.on-canvas {
  background: #3B7BF5;
  box-shadow: 0 8px 24px rgba(59,123,245,0.4);
}

/* ── ASANA INLINE SVG ───────────────────────────────────────── */
.asana-logo-svg { color: #f5614e; flex-shrink: 0; }
.asana-link-btn .asana-logo-svg { width: 20px; height: 20px; }
.asana-badge::before { display: none; }
.asana-badge { display: inline-flex; align-items: center; gap: 4px; }
.asana-export-btn { display: flex; align-items: center; gap: 8px; white-space: nowrap; flex-shrink: 0; }

/* ── ASANA ITEMS ────────────────────────────────────────────── */
.asana-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 400; color: var(--ink); cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.asana-item:active { background: var(--bg-soft); border-color: var(--gold); }
.asana-item svg { color: var(--terra); flex-shrink: 0; }

/* ── EMPTY STATES ───────────────────────────────────────────── */
.empty-hint { font-family: var(--serif); font-style: italic; font-size: 14px; color: var(--ink-faint); text-align: center; padding: 16px; }
.empty-obstacles { font-family: var(--serif); font-style: italic; font-size: 13.5px; color: var(--ink-faint); padding: 12px 0; }
.empty-state .empty-icon { display: flex; justify-content: center; margin-bottom: 16px; color: var(--ink-faint); }
.empty-state .empty-icon svg { width: 44px; height: 44px; stroke: currentColor; fill: none; stroke-width: 1.4; }

/* ── EFF DIMS ───────────────────────────────────────────────── */
.eff-label { display: block; font-size: 10px; font-weight: 700; color: var(--gold-deep); text-transform: uppercase; letter-spacing: 0.18em; margin-bottom: 10px; }
.eff-dims { display: flex; gap: 20px; flex-wrap: wrap; justify-content: space-around; font-family: var(--serif); font-size: 20px; color: var(--ink); }
.eff-dims span em { font-style: normal; color: var(--ink-mute); font-size: 16px; margin-right: 4px; }

/* ── TEST RESULT COLORS ─────────────────────────────────────── */
.test-result.ok  { color: var(--green-ok); font-style: italic; font-family: var(--serif); }
.test-result.error { color: var(--terra); font-style: italic; font-family: var(--serif); }

/* Always show delete btn on touch devices */
@media (pointer: coarse) { .card-delete-btn { opacity: 1; } }

/* Wider tablet adjustments */
@media (min-width: 768px) {
  .etype-grid { grid-template-columns: repeat(5, 1fr); }
  .shape-btn { padding: 14px 12px 12px; font-size: 13px; }
}


/* ════════════════════════════════════════════════════════════
   EDITOR v3.0 — Layout, panels, canvas, palette
   ════════════════════════════════════════════════════════════ */

/* ── EDITOR TOP BAR ─────────────────────────────────────────── */
.ed-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: 52px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 8px rgba(26,22,17,0.06);
}
.ed-back-btn {
  display: flex; align-items: center; gap: 4px;
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: var(--ink-soft); background: none; border: none;
  padding: 6px 10px; border-radius: var(--radius-sm);
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.ed-back-btn:hover { background: var(--bg-soft); color: var(--ink); }
.ed-project-name {
  flex: 1; font-family: var(--serif); font-size: 17px;
  font-weight: 400; color: var(--ink); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ed-tools { display: flex; align-items: center; gap: 4px; }
.ed-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.ed-tool {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--sans); font-size: 12px; font-weight: 500;
  color: var(--ink-mute); background: transparent; border: none;
  padding: 5px 9px; border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.ed-tool svg { flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ed-tool:hover { background: var(--bg-soft); color: var(--ink); }
.ed-tool.active { color: var(--gold-deep); background: rgba(184,153,104,0.12); }
.ed-tool-accent {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  color: var(--paper); background: var(--ink);
  border: none; padding: 6px 12px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s;
}
.ed-tool-accent svg { stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ed-tool-accent:hover { background: var(--ink-soft); }
.ed-tool-asana {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--sans); font-size: 12px; font-weight: 500;
  color: #fff; background: #f06a35;
  border: none; padding: 6px 10px; border-radius: var(--radius-sm);
  cursor: pointer; transition: opacity 0.15s;
}
.ed-tool-asana:hover { opacity: 0.88; }

/* ── MAIN LAYOUT ─────────────────────────────────────────────── */
#screen-editor {
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
.ed-layout {
  display: flex; flex: 1;
  margin-top: 52px;
  overflow: hidden;
  height: calc(100vh - 52px);
}

/* ── LEFT PANEL ──────────────────────────────────────────────── */
.ed-left {
  width: 230px; min-width: 200px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
  flex-shrink: 0;
}
.ed-left::-webkit-scrollbar { width: 4px; }
.ed-left::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 2px; }

/* ── RIGHT PANEL ─────────────────────────────────────────────── */
.ed-right {
  width: 180px; min-width: 160px;
  background: var(--paper);
  border-left: 1px solid var(--line);
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
  flex-shrink: 0;
  padding-bottom: 16px;
}
.ed-right::-webkit-scrollbar { width: 4px; }
.ed-right::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 2px; }
.ep-right-title {
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--ink-faint); padding: 14px 12px 6px;
}

/* ── CANVAS WRAP ─────────────────────────────────────────────── */
.ed-canvas-wrap {
  flex: 1; position: relative;
  background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; min-width: 0;
}
.ed-canvas {
  position: absolute; inset: 0;
  width: 100% !important; height: 100% !important;
  display: block;
}
.ed-overlay { pointer-events: none; z-index: 10; }

/* placeholder */
.ed-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; color: var(--ink-faint);
  font-family: var(--serif); font-size: 16px; text-align: center;
  pointer-events: none; z-index: 5;
}
.ed-placeholder svg { opacity: 0.3; }
.ed-placeholder p { opacity: 0.55; line-height: 1.6; }
.ed-placeholder.hidden { display: none; }

/* fit button */
.ed-fit-btn {
  position: absolute; bottom: 72px; right: 12px; z-index: 20;
  width: 36px; height: 36px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow-2);
  transition: background 0.15s;
}
.ed-fit-btn svg { stroke: var(--ink-mute); fill: none; stroke-width: 1.8; stroke-linecap: round; }
.ed-fit-btn:hover { background: var(--bg-soft); }

/* door control */
.ed-door-ctrl {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px; box-shadow: var(--shadow-2); z-index: 20;
}
.ed-door-ctrl.hidden { display: none; }
.ed-door-label { font-family: var(--sans); font-size: 11px; color: var(--ink-mute); white-space: nowrap; }
.ed-door-range { width: 120px; accent-color: var(--gold-deep); cursor: pointer; }

/* snap svg */
.ed-snap-svg {
  position: absolute; inset: 0; pointer-events: none; z-index: 15;
  width: 100%; height: 100%;
}

/* ── PANEL BLOCKS ───────────────────────────────────────────── */
.ep-block {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--line-soft);
}
.ep-block:last-child { border-bottom: none; }
.ep-label {
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--ink-faint); margin-bottom: 8px; display: block;
}
.ep-label-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.ep-label-row .ep-label { margin-bottom: 0; }
.ep-btn-sm {
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  color: var(--gold-deep); background: rgba(184,153,104,0.12);
  border: none; padding: 4px 9px; border-radius: 999px;
  cursor: pointer; transition: background 0.15s;
}
.ep-btn-sm:hover { background: rgba(184,153,104,0.22); }

/* ── COLLAPSIBLE SECTIONS ──────────────────────────────────── */
.ep-collapsible .ep-toggle-btn {
  display: flex; align-items: center; gap: 6px;
  width: 100%; background: none; border: none; padding: 0;
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--ink-faint); cursor: pointer; margin-bottom: 0;
}
.ep-collapsible .ep-toggle-btn span:first-child { flex: 1; text-align: left; }
.ep-collapsible .ep-toggle-btn:hover { color: var(--ink-mute); }
.ep-collapsible.open .ep-toggle-btn { margin-bottom: 6px; }
.ep-caret {
  stroke: currentColor; fill: none; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0; margin-left: auto;
  transition: transform 0.22s ease;
}
.ep-collapsible.open .ep-caret { transform: rotate(180deg); }
.ep-collapse-body {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.28s ease, opacity 0.22s ease;
}
.ep-collapsible.open .ep-collapse-body {
  max-height: 900px;
  opacity: 1;
}
/* inline add-division btn inside module toggle header */
.ep-mod-add-inline {
  font-size: 10px; padding: 3px 7px; border-radius: 4px;
  flex-shrink: 0; margin-left: 4px;
}

/* tipo grid */
.tipo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tipo-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 7px 4px 6px;
  background: var(--bg-soft); border: 1.5px solid transparent;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: all 0.15s; color: var(--ink-mute);
}
.tipo-btn:hover { border-color: var(--line-strong); color: var(--ink); background: var(--bg); }
.tipo-btn.sel { border-color: var(--gold); background: rgba(184,153,104,0.1); color: var(--gold-deep); }
.tipo-icon { width: 100%; display: flex; align-items: center; justify-content: center; }
.tipo-icon svg { width: 100%; height: auto; stroke: currentColor; fill: none; }
.tipo-btn span { font-family: var(--sans); font-size: 10px; font-weight: 600; letter-spacing: 0.04em; }

/* field grid */
.ep-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ep-field { display: flex; flex-direction: column; gap: 3px; }
.ep-field label { font-family: var(--sans); font-size: 10px; color: var(--ink-mute); font-weight: 500; }
.ep-input-wrap { display: flex; align-items: center; gap: 3px; }
.ep-num {
  width: 100%; min-width: 0;
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: var(--ink); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 6px; text-align: right;
}
.ep-num:focus { outline: none; border-color: var(--gold); }
.ep-input-wrap span { font-family: var(--sans); font-size: 10px; color: var(--ink-faint); flex-shrink: 0; }

/* dim rows */
.dim-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 7px;
}
.dim-row label { font-family: var(--sans); font-size: 11px; color: var(--ink-mute); flex: 1; }
.dim-row input {
  width: 72px; font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: var(--ink); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 6px; text-align: right;
}
.dim-row input:focus { outline: none; border-color: var(--gold); }
.dim-row span { font-family: var(--sans); font-size: 10px; color: var(--ink-faint); }

/* door buttons */
.ep-door-tipos { display: flex; flex-wrap: wrap; gap: 5px; }
.ep-door-btn {
  font-family: var(--sans); font-size: 11px; font-weight: 500;
  color: var(--ink-mute); background: var(--bg-soft);
  border: 1.5px solid transparent; border-radius: 999px;
  padding: 4px 9px; cursor: pointer; transition: all 0.15s;
}
.ep-door-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.ep-door-btn.sel { color: var(--gold-deep); background: rgba(184,153,104,0.12); border-color: var(--gold); }

/* counter */
.ep-counter { display: flex; align-items: center; gap: 8px; }
.ep-ctr {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg-soft); border: 1px solid var(--line);
  font-size: 16px; line-height: 1; color: var(--ink-soft);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.ep-ctr:hover { background: var(--bg-warm); }
#ep-door-hojas-val {
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  color: var(--ink); min-width: 20px; text-align: center;
}

/* module list */
.ep-mod-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 0; border-bottom: 1px solid var(--line-soft);
}
.ep-mod-item:last-child { border-bottom: none; }
.ep-mod-label { font-family: var(--sans); font-size: 12px; color: var(--ink-soft); flex: 1; }
.ep-mod-w {
  width: 58px; font-family: var(--sans); font-size: 12px; font-weight: 500;
  color: var(--ink); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 5px;
  padding: 4px 5px; text-align: right;
}
.ep-mod-w:focus { outline: none; border-color: var(--gold); }
.ep-mod-del {
  width: 22px; height: 22px; border: none; background: none;
  color: var(--ink-faint); font-size: 16px; cursor: pointer;
  border-radius: 4px; display: flex; align-items: center; justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.ep-mod-del:hover { color: var(--terra); background: rgba(140,58,40,0.08); }
.ep-dims-summary {
  font-family: var(--serif); font-size: 12px;
  font-style: italic; color: var(--ink-mute);
  margin-top: 6px; line-height: 1.5;
}

/* material */
.ep-mat-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ep-mat-swatch {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2.5px solid transparent; cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.ep-mat-swatch:hover { transform: scale(1.12); }
.ep-mat-swatch.sel { border-color: var(--gold-deep); }
.ep-mat-name { font-family: var(--serif); font-style: italic; font-size: 12px; color: var(--ink-mute); }

/* inline add */
.ep-add-inline {
  display: flex; align-items: center; gap: 5px; margin-top: 6px;
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  color: var(--gold-deep); background: none; border: none; padding: 3px 0;
  cursor: pointer; transition: opacity 0.15s;
}
.ep-add-inline:hover { opacity: 0.75; }
.ep-add-inline svg { stroke: currentColor; fill: none; stroke-width: 1.8; }

/* obs list */
.ep-obs-item {
  display: flex; align-items: center; gap: 6px; padding: 4px 0;
  font-family: var(--sans); font-size: 11px; color: var(--ink-soft);
  border-bottom: 1px solid var(--line-soft);
}
.ep-obs-item:last-child { border-bottom: none; }
.ep-obs-label { flex: 1; }
.ep-obs-del {
  width: 20px; height: 20px; border: none; background: none;
  color: var(--ink-faint); cursor: pointer; border-radius: 3px;
  font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.ep-obs-del:hover { color: var(--terra); }

/* check row */
.ep-check-row {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-size: 13px; color: var(--ink-soft);
  cursor: pointer;
}
.ep-check-row input { accent-color: var(--gold-deep); }

/* ── RIGHT PALETTE ─────────────────────────────────────────── */
.ep-group { padding: 10px 10px 6px; border-bottom: 1px solid var(--line-soft); }
.ep-group:last-child { border-bottom: none; }
.ep-group-label {
  font-family: var(--sans); font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--ink-faint); margin-bottom: 7px;
}
.ep-palette { display: flex; flex-wrap: wrap; gap: 6px; }
.ep-chip {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 72px; padding: 7px 4px 6px;
  background: var(--bg-soft); border: 1.5px solid transparent;
  border-radius: var(--radius-sm); cursor: grab;
  transition: all 0.15s; color: var(--ink-mute);
  user-select: none;
  touch-action: none;
}
.ep-chip:hover { background: var(--bg); border-color: var(--line); color: var(--ink); }
.ep-chip.dragging { opacity: 0.4; cursor: grabbing; }
.ep-chip svg { stroke: currentColor; fill: none; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.ep-chip span {
  font-family: var(--sans); font-size: 9.5px; font-weight: 600;
  text-align: center; line-height: 1.2; color: inherit;
}
.ep-chip-special {
  cursor: pointer;
  border-color: rgba(184,153,104,0.3);
  background: rgba(184,153,104,0.06);
}
.ep-chip-special:hover { background: rgba(184,153,104,0.14); border-color: var(--gold); color: var(--gold-deep); }

/* ── ELEMENT BAR ─────────────────────────────────────────────── */
.ed-elem-bar {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 300;
  display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--paper);
  border-radius: 999px;
  padding: 9px 16px;
  box-shadow: 0 4px 20px rgba(26,22,17,0.3);
}
.ed-elem-bar.hidden { display: none; }
.ed-elem-bar-info { display: flex; flex-direction: column; gap: 1px; }
.ed-elem-bar-name { font-family: var(--serif); font-size: 15px; color: var(--paper); }
.ed-elem-bar-pos { font-family: var(--sans); font-size: 11px; color: rgba(251,246,233,0.55); }
.ed-cotas-wrap { position: relative; display: inline-flex; }
.ed-cotas-chev { margin-left: 4px; opacity: 0.7; }
.ed-cotas-popover {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 100;
  background: rgba(14,12,9,0.97);
  border: 1px solid rgba(184,153,104,0.30);
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.45);
}
.ed-cotas-popover.hidden { display: none; }
.ed-cotas-popover label {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 12px var(--sans);
  color: var(--paper);
  cursor: pointer;
  user-select: none;
}
.ed-cotas-popover input[type="checkbox"] { accent-color: var(--gold); }
.ed-cotas-master { font-weight: 600; color: var(--gold); }
.ed-cotas-sep {
  height: 1px;
  background: rgba(184,153,104,0.20);
  margin: 2px -4px;
}

.ed-eb-w {
  width: 56px;
  padding: 2px 4px;
  margin: 0 1px;
  font: inherit;
  font-size: 11px;
  text-align: center;
  background: rgba(255,255,255,0.06);
  color: rgba(251,246,233,0.95);
  border: 1px solid rgba(184,153,104,0.30);
  border-radius: 4px;
  outline: none;
}
.ed-eb-w:focus { border-color: var(--gold); background: rgba(255,255,255,0.10); }
.ed-eb-w::-webkit-inner-spin-button,
.ed-eb-w::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ed-elem-bar-actions { display: flex; gap: 6px; }
.ed-eb-btn {
  font-family: var(--sans); font-size: 12px; font-weight: 500;
  color: var(--paper); background: rgba(255,255,255,0.12);
  border: none; padding: 5px 11px; border-radius: 999px;
  cursor: pointer; transition: background 0.15s;
}
.ed-eb-btn:hover { background: rgba(255,255,255,0.22); }
.ed-eb-btn.danger { color: #ff8a80; }
.ed-eb-btn.danger:hover { background: rgba(255,100,80,0.2); }
.ed-eb-close {
  font-size: 16px !important;
  font-weight: 700 !important;
  width: 32px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
@media (pointer: coarse) {
  .ed-eb-close { width: 44px; font-size: 22px !important; }
}

/* ── BARRA INFERIOR EN IPAD: tamaño aumentado para tactil ─── */
@media (pointer: coarse) {
  .ed-elem-bar {
    bottom: 24px;
    gap: 18px;
    padding: 14px 22px;
    border-radius: 32px;
  }
  .ed-elem-bar-name { font-size: 19px; }
  .ed-elem-bar-pos  { font-size: 14px; }
  .ed-eb-w {
    width: 84px;
    font-size: 17px;
    padding: 8px 8px;
    border-radius: 8px;
    min-height: 40px;
  }
  .ed-elem-bar-actions { gap: 10px; }
  .ed-eb-btn {
    font-size: 16px;
    padding: 10px 18px;
    min-height: 40px;
    min-width: 50px;
  }
}

/* ── MODALS EXTRA ────────────────────────────────────────────── */
.modal-sm .modal-box { max-width: 400px; }
.mm-field { display: flex; align-items: center; gap: 6px; }
.mm-input {
  flex: 1; font-family: var(--sans); font-size: 14px; font-weight: 500;
  color: var(--ink); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; text-align: right;
}
.mm-input:focus { outline: none; border-color: var(--gold); }
.mm-field span { font-family: var(--sans); font-size: 13px; color: var(--ink-mute); }
.opt-grid { display: grid; gap: 6px; margin-top: 4px; }
.opt-btn {
  font-family: var(--sans); font-size: 12px; font-weight: 500;
  color: var(--ink-mute); background: var(--bg-soft);
  border: 1.5px solid transparent; border-radius: var(--radius-sm);
  padding: 7px 4px; cursor: pointer; text-align: center;
  transition: all 0.15s;
}
.opt-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.opt-btn.active { border-color: var(--gold); background: rgba(184,153,104,0.1); color: var(--gold-deep); }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }
.btn-row { align-items: center; margin-top: 4px; }

/* cajonera rows */
.caj-cajon-row {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 0; border-bottom: 1px solid var(--line-soft);
}
.caj-cajon-row:last-child { border-bottom: none; }
.caj-cajon-row select {
  flex: 1; font-family: var(--sans); font-size: 12px;
  color: var(--ink); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 6px;
}
.caj-cajon-row select:focus { outline: none; border-color: var(--gold); }
.caj-cajon-row button {
  width: 22px; height: 22px; border: none; background: none;
  color: var(--ink-faint); font-size: 16px; cursor: pointer;
  border-radius: 4px; display: flex; align-items: center; justify-content: center;
}
.caj-cajon-row button:hover { color: var(--terra); }

/* ── HELPERS ─────────────────────────────────────────────────── */
.full { width: 100%; }
.hidden { display: none !important; }

/* ════════════════════════════════════════════════════════════
   EDITOR — DARK LUXURY THEME
   Paneles oscuros con acento dorado para máximo contraste
   con el 3D
   ════════════════════════════════════════════════════════════ */

/* Editor background */
#screen-editor { background: #0C0A08; }
.ed-layout { background: #0C0A08; }

/* Top bar */
#screen-editor .ed-topbar {
  background: rgba(16,13,10,0.97);
  border-bottom-color: rgba(184,153,104,0.18);
  box-shadow: 0 1px 0 rgba(184,153,104,0.08), 0 2px 16px rgba(0,0,0,0.4);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
#screen-editor .ed-back-btn { color: rgba(184,153,104,0.6); }
#screen-editor .ed-back-btn:hover { background: rgba(184,153,104,0.1); color: var(--gold); }
#screen-editor .ed-project-name {
  color: rgba(251,246,233,0.92);
  font-size: 16px; letter-spacing: 0.02em;
}
#screen-editor .ed-tool { color: rgba(184,153,104,0.5); }
#screen-editor .ed-tool:hover { background: rgba(184,153,104,0.09); color: var(--gold); }
#screen-editor .ed-tool.active { color: var(--gold); background: rgba(184,153,104,0.14); }
#screen-editor .ed-sep { background: rgba(184,153,104,0.14); }
#screen-editor .ed-tool-accent {
  background: linear-gradient(135deg, rgba(184,153,104,0.22) 0%, rgba(142,115,64,0.28) 100%);
  color: var(--gold);
  border: 1px solid rgba(184,153,104,0.35);
}
#screen-editor .ed-tool-accent:hover { background: rgba(184,153,104,0.28); }

/* Left panel */
#screen-editor .ed-left {
  background: linear-gradient(180deg, #141210 0%, #120F0D 100%);
  border-right-color: rgba(184,153,104,0.12);
}
#screen-editor .ed-left::-webkit-scrollbar { width: 3px; }
#screen-editor .ed-left::-webkit-scrollbar-thumb { background: rgba(184,153,104,0.18); border-radius: 2px; }

/* Right panel */
#screen-editor .ed-right {
  background: linear-gradient(180deg, #141210 0%, #120F0D 100%);
  border-left-color: rgba(184,153,104,0.12);
}
#screen-editor .ed-right::-webkit-scrollbar { width: 3px; }
#screen-editor .ed-right::-webkit-scrollbar-thumb { background: rgba(184,153,104,0.18); border-radius: 2px; }

/* Section headers */
#screen-editor .ed-section {
  border-bottom-color: rgba(184,153,104,0.08);
}
#screen-editor .ed-section-hd {
  color: rgba(184,153,104,0.5);
  letter-spacing: 0.08em;
}
#screen-editor .ep-sec-title {
  color: rgba(184,153,104,0.45);
  letter-spacing: 0.07em;
}

/* Row labels and inputs */
#screen-editor .ed-row-label { color: rgba(220,210,190,0.45); }
#screen-editor .ed-row input,
#screen-editor .ed-row select {
  background: rgba(255,255,255,0.05);
  border-color: rgba(184,153,104,0.18);
  color: rgba(240,230,210,0.9);
}
#screen-editor .ed-row input:focus,
#screen-editor .ed-row select:focus {
  border-color: rgba(184,153,104,0.6);
  background: rgba(255,255,255,0.07);
  box-shadow: 0 0 0 2px rgba(184,153,104,0.12);
}
#screen-editor .ed-row input::placeholder { color: rgba(184,153,104,0.3); }

/* Form hints */
#screen-editor .form-hint { color: rgba(184,153,104,0.35); }

/* Buttons dark */
#screen-editor .btn-outline {
  border-color: rgba(184,153,104,0.25);
  color: rgba(184,153,104,0.7);
  background: transparent;
}
#screen-editor .btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(184,153,104,0.08);
}
#screen-editor .btn-sm {
  background: rgba(255,255,255,0.05);
  border-color: rgba(184,153,104,0.2);
  color: rgba(220,210,190,0.7);
}
#screen-editor .btn-sm:hover {
  background: rgba(184,153,104,0.1);
  color: var(--gold);
}
#screen-editor .icon-btn { color: rgba(184,153,104,0.5); }
#screen-editor .icon-btn:hover { color: var(--gold); background: rgba(184,153,104,0.1); }

/* Palette chips */
#screen-editor .ep-chip {
  background: rgba(255,255,255,0.04);
  border-color: rgba(184,153,104,0.14);
  color: rgba(220,210,190,0.75);
}
#screen-editor .ep-chip:hover {
  background: rgba(184,153,104,0.1);
  border-color: rgba(184,153,104,0.4);
  color: var(--gold);
}
#screen-editor .ep-chip.dragging { opacity: 0.5; }

/* Module cards */
#screen-editor .mod-card {
  background: rgba(255,255,255,0.04);
  border-color: rgba(184,153,104,0.14);
}
#screen-editor .mod-card-label { color: rgba(184,153,104,0.6); }
#screen-editor .mod-card input {
  background: rgba(255,255,255,0.05);
  border-color: rgba(184,153,104,0.2);
  color: rgba(240,230,210,0.9);
}
#screen-editor .mod-card-del { color: rgba(184,153,104,0.3); }
#screen-editor .mod-card-del:hover { color: #ff6b5a; }

/* Obstacle items */
#screen-editor .obs-item {
  background: rgba(255,255,255,0.04);
  border-color: rgba(184,153,104,0.14);
  color: rgba(220,210,190,0.8);
}
#screen-editor .obs-item-edit { color: rgba(184,153,104,0.5); }
#screen-editor .obs-item-del { color: rgba(184,153,104,0.3); }

/* Material swatches label */
#screen-editor .mat-option {
  border-color: rgba(184,153,104,0.15);
}
#screen-editor .mat-option.active { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(184,153,104,0.25); }
#screen-editor .mat-label { color: rgba(220,210,190,0.55); }

/* Door / puerta controls */
.ed-door-ctrl {
  background: rgba(14,12,9,0.9);
  border-top-color: rgba(184,153,104,0.14);
}
.ed-door-ctrl label { color: rgba(184,153,104,0.55); }
input[type=range].door-slider {
  accent-color: var(--gold);
}

/* Element bar (bottom) */
.ed-elem-bar {
  background: rgba(14,12,9,0.94);
  border-top-color: rgba(184,153,104,0.18);
  backdrop-filter: blur(12px);
}

/* Fit button */
.ed-fit-btn {
  background: rgba(14,12,9,0.75);
  border: 1px solid rgba(184,153,104,0.25);
  color: rgba(184,153,104,0.7);
  backdrop-filter: blur(8px);
}
.ed-fit-btn:hover { background: rgba(184,153,104,0.12); color: var(--gold); }

/* Canvas placeholder */
#ed-placeholder {
  background: transparent;
  color: rgba(184,153,104,0.35);
}
#ed-placeholder svg { stroke: rgba(184,153,104,0.2); }
#ed-placeholder p { color: rgba(184,153,104,0.35); }

/* ── PANEL COLLAPSE TABS ────────────────────────────────────── */
.ed-left, .ed-right {
  transition: width 0.26s ease, min-width 0.26s ease, opacity 0.22s ease;
}
.ed-left.collapsed  { width: 0 !important; min-width: 0 !important; opacity: 0; overflow: hidden; }
.ed-right.collapsed { width: 0 !important; min-width: 0 !important; opacity: 0; overflow: hidden; }

/* Tab buttons — float over canvas edge */
.ed-layout { position: relative; }
.ed-panel-tab {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 60;
  width: 18px; height: 52px;
  background: rgba(20,18,14,0.88);
  border: 1px solid rgba(184,153,104,0.22);
  color: rgba(184,153,104,0.65);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s, left 0.26s ease, right 0.26s ease;
  backdrop-filter: blur(8px);
}
.ed-panel-tab svg { transition: transform 0.26s ease; }
.ed-panel-tab:hover { background: rgba(184,153,104,0.15); color: var(--gold); }
.ed-panel-tab-left  { left: 230px; border-radius: 0 6px 6px 0; border-left: none; }
.ed-panel-tab-right { right: 180px; border-radius: 6px 0 0 6px; border-right: none; }

/* Collapsed state — tabs slide to screen edge */
#screen-editor.left-collapsed  .ed-panel-tab-left  { left: 0; }
#screen-editor.right-collapsed .ed-panel-tab-right { right: 0; }
#screen-editor.left-collapsed  .ed-panel-tab-left  svg { transform: rotate(180deg); }
#screen-editor.right-collapsed .ed-panel-tab-right svg { transform: rotate(180deg); }

/* Dark-theme overrides for toggle-btn inside editor */
#screen-editor .ep-collapsible .ep-toggle-btn {
  color: rgba(184,153,104,0.5);
}
#screen-editor .ep-collapsible .ep-toggle-btn:hover { color: var(--gold); }
#screen-editor .ep-collapsible.open .ep-toggle-btn   { color: rgba(184,153,104,0.7); }

/* ── PERFORMANCE TÁCTIL EN IPAD ────────────────────────────── */
/* touch-action: manipulation elimina el delay de 300ms que iOS aplica
   en cada toque para detectar doble-tap-zoom. Sin esto, los botones
   "tardan" en responder y dan sensación de lentitud. */
button,
.ed-tool, .ed-tool-accent, .ed-tool-asana,
.ed-eb-btn, .icon-btn, .fab,
.btn-secondary, .btn-primary, .btn-danger,
.ed-door-btn, .tipo-frente-btn, .patas-btn,
.project-card, .vivienda-header,
.modal-close, .back-btn, .card-delete-btn,
.vivienda-rename, .vivienda-delete,
.update-banner-btn, .ep-toggle-btn, .ep-add-inline,
.ep-btn-sm, .ep-ctr, input[type="checkbox"],
input[type="number"], select {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ── BADGE DE VERSIÓN ───────────────────────────────────────── */
.version-badge {
  position: fixed;
  bottom: 8px;
  right: 8px;
  z-index: 9999;
  font: 600 11px var(--sans);
  color: rgba(184,153,104,0.85);
  background: rgba(14,12,9,0.85);
  border: 1px solid rgba(184,153,104,0.3);
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: 0.4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: background 0.15s, border-color 0.15s;
}
.version-badge:hover {
  background: rgba(20,16,12,0.95);
  border-color: rgba(184,153,104,0.6);
}
@media (pointer: coarse) {
  .version-badge { font-size: 13px; padding: 6px 12px; }
}

/* ── BANNER DE ACTUALIZACIÓN ────────────────────────────────── */
.update-banner {
  position: fixed;
  top: 12px; left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-deep) 100%);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font: 600 14px var(--sans);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  animation: bannerSlide 0.4s cubic-bezier(0.2, 0.9, 0.4, 1);
}
.update-banner.hidden { display: none; }
.update-banner-text { white-space: nowrap; }
.update-banner-btn {
  background: rgba(255,255,255,0.25);
  border: none;
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  font: 600 13px var(--sans);
  cursor: pointer;
  transition: background 0.15s;
}
.update-banner-btn:hover { background: rgba(255,255,255,0.4); }
@keyframes bannerSlide {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@media (pointer: coarse) {
  .update-banner { padding: 14px 22px; font-size: 16px; }
  .update-banner-btn { padding: 8px 18px; font-size: 15px; min-height: 36px; }
}

/* ── MODAL NOTAS DE VERSIÓN ─────────────────────────────────── */
.release-notes-modal {
  position: fixed; inset: 0;
  z-index: 10001;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.release-notes-modal.hidden { display: none; }
.release-notes-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.release-notes-content {
  position: relative;
  background: #161310;
  border: 1px solid rgba(184,153,104,0.35);
  border-radius: 14px;
  width: 100%;
  max-width: 720px;
  max-height: 86vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  overflow: hidden;
}
.release-notes-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(184,153,104,0.2);
  background: linear-gradient(135deg, rgba(184,153,104,0.15), transparent);
}
.release-notes-header h2 {
  margin: 0;
  font: 600 18px var(--sans);
  color: rgba(184,153,104,0.95);
  letter-spacing: 0.3px;
}
.release-notes-close {
  background: transparent;
  border: none;
  color: rgba(184,153,104,0.85);
  font-size: 28px;
  line-height: 1;
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.release-notes-close:hover { background: rgba(184,153,104,0.15); }
.release-notes-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  color: #e8e3da;
  font: 14px/1.55 var(--sans);
}
.release-notes-loading {
  text-align: center;
  color: rgba(184,153,104,0.7);
  padding: 30px 0;
}
.rn-release {
  margin-bottom: 22px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(184,153,104,0.15);
  border-radius: 10px;
}
.rn-release.rn-current {
  border-color: rgba(184,153,104,0.5);
  background: rgba(184,153,104,0.08);
}
.rn-release.rn-focus {
  box-shadow: 0 0 0 2px rgba(184,153,104,0.5);
}
.rn-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.rn-version {
  margin: 0;
  font: 700 16px var(--sans);
  color: rgba(184,153,104,0.95);
}
.rn-current-tag {
  display: inline-block;
  margin-left: 6px;
  font: 600 10px var(--sans);
  background: rgba(184,153,104,0.25);
  color: rgba(184,153,104,1);
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  vertical-align: middle;
}
.rn-date {
  font: 500 12px var(--sans);
  color: rgba(232,227,218,0.55);
}
.rn-title {
  margin: 4px 0 6px;
  font: 600 14px var(--sans);
  color: #f5efe2;
}
.rn-summary {
  margin: 0 0 10px;
  font: 13px/1.5 var(--sans);
  color: rgba(232,227,218,0.78);
}
.rn-changes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex; flex-direction: column; gap: 5px;
}
.rn-item {
  font: 13px/1.45 var(--sans);
  color: #e8e3da;
  padding: 4px 0 4px 0;
}
.rn-tag {
  display: inline-block;
  font: 600 11px var(--sans);
  margin-right: 6px;
  letter-spacing: 0.2px;
}
.rn-added .rn-tag    { color: #8fcf8f; }
.rn-fixed .rn-tag    { color: #e3b25b; }
.rn-changed .rn-tag  { color: #6fb6e3; }
.rn-removed .rn-tag  { color: #d97f7f; }
.rn-security .rn-tag { color: #d18bd1; }
@media (pointer: coarse) {
  .release-notes-header h2 { font-size: 20px; }
  .release-notes-body { font-size: 15px; padding: 18px 20px 22px; }
  .rn-version { font-size: 17px; }
  .rn-title { font-size: 15px; }
  .rn-item { font-size: 14px; padding: 6px 0; }
}
@media (max-width: 480px) {
  .release-notes-modal { padding: 8px; }
  .release-notes-content { max-height: 92vh; border-radius: 10px; }
  .release-notes-header { padding: 12px 16px; }
  .release-notes-body { padding: 12px 16px 16px; }
}

/* ─── Login: campo usuario ──────────────────────────────────── */
.login-user-row {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}
.login-user-input {
  width: 240px;
  text-align: center;
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0.04em;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-1);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-user-input:focus {
  outline: none;
  border-color: var(--ink-soft);
}
.login-user-input::placeholder {
  color: var(--ink-faint);
  font-style: italic;
}

/* ─── Top bar: usuario + acciones ──────────────────────────── */
.top-bar-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.top-bar-title { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.top-bar-user {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-mute);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 4px;
}
.top-bar-user.master { color: var(--accent, #b89968); }

.icon-btn.spinning svg { animation: spin 0.8s linear; transform-origin: center; }
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ─── Modales: hint + secciones ────────────────────────────── */
.modal-hint {
  font-size: 13px;
  color: var(--ink-mute);
  line-height: 1.5;
  margin: -4px 0 6px;
}

/* ─── Compartir: lista de usuarios con checkbox ───────────── */
.share-list {
  display: flex; flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.share-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.share-row:hover, .share-row.checked {
  background: var(--paper);
  border-color: var(--ink-soft);
}
.share-row input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--ink);
}
.share-row-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.share-row-role {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
  font-weight: 600;
}

/* ─── Admin: lista de usuarios + form nuevo ────────────────── */
.admin-users {
  display: flex; flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 8px;
}
.admin-user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.admin-user-row.master { border-color: var(--ink-soft); }
.admin-user-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  display: flex; flex-direction: column; gap: 2px;
}
.admin-user-name .role-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
  font-weight: 600;
}
.admin-user-name .role-badge.master { color: var(--accent, #b89968); }
.admin-user-actions {
  display: flex; gap: 6px;
}
.admin-mini-btn {
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.admin-mini-btn:hover { background: var(--bg); color: var(--ink); }
.admin-mini-btn.danger { color: var(--error); border-color: rgba(180,60,40,0.25); }
.admin-mini-btn.danger:hover { background: rgba(180,60,40,0.08); }
.admin-new-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 8px;
}
@media (max-width: 540px) {
  .admin-new-row { grid-template-columns: 1fr; }
}
