  :root{
    --bg:#f4f5f7; --panel:#ffffff; --line:#e3e6ea; --txt:#25292e; --muted:#7a828c;
    --accent:#e8455e; --accent2:#ff6b81; --input:#f7f8fa; --shadow:0 2px 10px rgba(20,25,35,.06);

    /*.slider OFF = e8455e 
  
  slider .switch input:checked + .slider 30bb55


    */
  }
  *{box-sizing:border-box}
  html,body{height:100%;margin:0}
  body{
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Inter,Arial,sans-serif;
    color:var(--txt); background:var(--bg); overflow:hidden;
    -webkit-font-smoothing:antialiased;
  }
  /*#app{display:flex;height:100vh;width:100vw}*/

  /* ---------------- PANEL ---------------- */
#panel{
  width:330px;min-width:330px;height:100%;overflow-y:auto;
  background:#efefef;
  border-right:1px solid var(--line);padding:0 0 90px 0;
  box-shadow:var(--shadow);z-index:5;
}body.dark #panel{ background:#24272c; }

  #panel::-webkit-scrollbar{width:9px}
  #panel::-webkit-scrollbar-thumb{background:#d4d8de;border-radius:8px}
/*
  .brand{padding:16px 18px 12px;display:flex;align-items:center;gap:10px;border-bottom:1px solid var(--line)}
  .brand .dot{width:22px;height:22px;border-radius:7px;background:linear-gradient(135deg,var(--accent),#ff9aa8);box-shadow:0 3px 8px rgba(232,69,94,.35)}
  .brand h1{font-size:14px;margin:0;font-weight:700;letter-spacing:.2px}
  .brand small{display:block;font-weight:400;color:var(--muted);font-size:11px}
*/
  .sec{border-bottom:1px solid var(--line)}
  /*.sec-head{
    display:flex;align-items:center;justify-content:space-between;cursor:pointer;
    padding:13px 18px;font-size:12.5px;font-weight:600;user-select:none;letter-spacing:.2px;
  }*/
 /* .sec-head{
  display:flex;align-items:center;justify-content:space-between;cursor:pointer;
  padding:13px 18px;font-size:12.5px;font-weight:600;user-select:none;letter-spacing:.2px;
  background:#f4f5f7;
 border-bottom:1px solid var(--line);
}
.sec-head:hover{background:#efebe3}*/

.sec-head{
  display:flex;align-items:center;justify-content:space-between;cursor:pointer;
  padding:13px 18px;font-size:12.5px;font-weight:600;user-select:none;letter-spacing:.2px;
  /*border-bottom:1px solid var(--line);*/
  background:#f5efe8;
}
.sec-head:hover{ background:#d5d2c1 !important; }
body.dark .sec-head{ background:#35393e !important }
body.dark .sec-head:hover{ background:#33373d; }

  .sec-head:hover{background:#fafbfc}
  .sec-head .chev{transition:transform .18s;color:var(--muted);font-size:10px}
  .sec.closed .chev{transform:rotate(-90deg)}
  .sec.closed .sec-body{display:none}
  .sec-body{
  padding:17px 18px 16px;   /* ← top de 30px para que el contenido respire */
  background:var(--panel);
  padding-left: 35px;
}
/*generales*/

/* --- Sec-head no clicable (título fijo) --- */
/*/.sec-head.static{
  cursor:default;
}
.sec-head.static:hover{
  background:#f5efe8 !important;
}
body.dark .sec-head.static{
  background:#2a2e34;
}
body.dark .sec-head.static:hover{
  background:#2a2e34 !important;
}*/

/* La sección general respira menos a la izquierda porque ya contiene sub-bloques */
#sec-general .sec-body{
  padding-left:18px;
  padding-right:18px;
}

/* --- Sub-bloques internos --- */
.sub-block{
  margin-top:16px;
  padding-top:14px;
  border-top:1px solid var(--line);
}
.sub-title{
  font-size:10.5px;
  font-weight:700;
  color:var(--muted);
  letter-spacing:.6px;
  text-transform:uppercase;
  margin-bottom:10px;
}

/**/
  .row{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:9px 0}
  .row label{font-size:12px;color:#444b54;}/*flex:1*/
  .row .hint{font-size:10.5px;color:var(--muted);display:block;margin-top:2px}

  input[type=number],input[type=text]{
    width:88px;padding:7px 9px;border:1px solid var(--line);background:var(--input);
    border-radius:7px;font-size:12.5px;color:var(--txt);text-align:right;outline:none;
    font-variant-numeric:tabular-nums;
  }
  input[type=number]:focus,input[type=text]:focus{border-color:var(--accent);background:#fff}
  input[type=range]{width:100%;accent-color:var(--accent)}
  input[type=checkbox]{accent-color:var(--accent);width:15px;height:15px;cursor:pointer}
  select{
    width:100%;padding:8px 9px;border:1px solid var(--line);background:var(--input);
    border-radius:7px;font-size:12.5px;outline:none;color:var(--txt);
  }

  /* Selector de tipo de modelo */
  .icon-sprite{position:absolute;overflow:hidden}
  .mode-picker{
    --mi-a:#ff7b90; --mi-b:#c92f4a; --mi-c:#fff0f3; --mi-bg:#fff;
    position:relative;
  }
  .mode-trigger{
    width:100%;min-height:66px;display:flex;align-items:center;gap:11px;
    padding:8px 13px 8px 9px;border:2px solid var(--accent);border-radius:13px;
    background:linear-gradient(135deg,#fff 0%,#fff3f5 100%);color:var(--txt);
    box-shadow:0 5px 14px rgba(232,69,94,.17);cursor:pointer;text-align:left;
    transition:box-shadow .15s,transform .15s,background .15s;
  }
  .mode-trigger:hover{box-shadow:0 7px 18px rgba(232,69,94,.26);transform:translateY(-1px)}
  .mode-trigger:focus-visible,.mode:focus-visible{outline:3px solid rgba(232,69,94,.35);outline-offset:2px}
  .mode-art-wrap{
    width:46px;height:46px;flex:0 0 46px;display:grid;place-items:center;
    border-radius:10px;background:var(--mi-bg);box-shadow:inset 0 0 0 1px rgba(201,47,74,.14);
  }
  .mode-art{width:38px;height:38px;display:block}
  .mode-text{min-width:0;flex:1;display:flex;flex-direction:column;gap:2px;line-height:1.2}
  .mode-text b{font-size:14px;font-weight:700}
  .mode-text small{font-size:11px;color:var(--muted);font-weight:400}
  .mode-current-gem{display:flex;flex:0 0 auto}
  .mode-current-gem:empty{display:none}
  .mode-caret{
    width:9px;height:9px;flex:0 0 9px;margin:-4px 3px 0 2px;
    border-right:2px solid var(--accent);border-bottom:2px solid var(--accent);
    transform:rotate(45deg);transition:transform .16s,margin .16s;
  }
  .mode-picker.open .mode-caret{transform:rotate(225deg);margin-top:5px}
  .modes{
    display:none;position:absolute;z-index:40;top:calc(100% + 6px);left:0;right:0;
    max-height:min(64vh,520px);overflow-y:auto;padding:6px;
    background:var(--panel);border:1px solid var(--line);border-radius:12px;
    box-shadow:0 14px 34px rgba(20,25,35,.22);
  }
  .mode-picker.open .modes{display:block}
  @media (max-width:767px){ .modes{max-height:min(36vh,300px)} }
  .mode-group{
    padding:8px 8px 5px;font-size:10px;font-weight:700;letter-spacing:.6px;
    text-transform:uppercase;color:var(--muted);
  }
  .mode{
    width:100%;min-height:54px;display:flex;align-items:center;gap:10px;padding:5px 9px 5px 5px;
    border:0;border-radius:9px;background:transparent;color:var(--txt);
    cursor:pointer;text-align:left;transition:background .12s,color .12s;
  }
  .mode .mode-art-wrap{width:42px;height:42px;flex-basis:42px}
  .mode .mode-art{width:34px;height:34px}
  .mode .mode-text b{font-size:13px}
  .mode:hover,.mode:focus-visible{background:#fff0f3}
  .mode.on{background:var(--accent);color:#fff}
  .mode.on .mode-text small{color:rgba(255,255,255,.85)}
  .gem-badge{display:inline-flex;width:15px;height:15px;flex:0 0 15px;vertical-align:-3px;margin-left:5px;filter:drop-shadow(0 1px 1px rgba(21,101,192,.3))}
  .gem-badge svg{width:100%;height:100%;display:block}
  .mode > .gem-badge,.mode-current-gem .gem-badge{width:18px;height:18px;flex-basis:18px;margin-left:0}
  .mode.on > .gem-badge{filter:drop-shadow(0 0 2px rgba(255,255,255,.9))}

  .switch{position:relative;width:38px;height:21px;flex:0 0 auto}
  .switch input{opacity:0;width:0;height:0;position:absolute}
  .slider{position:absolute;inset:0;background:#fd8497;border-radius:20px;transition:.18s;cursor:pointer; width: inherit;}
  .slider:before{content:"";position:absolute;width:15px;height:15px;left:3px;top:3px;background:#fff;border-radius:50%;transition:.18s;box-shadow:0 1px 3px rgba(0,0,0,.25)}
  .switch input:checked + .slider{background:#30bb55}
  .switch input:checked + .slider:before{transform:translateX(17px)}

  .btn{
    border:none;border-radius:8px;padding:9px 12px;font-size:12px;font-weight:600;cursor:pointer;
    background:#e7f4ff;color:#454c55;transition:.15s;border: 2px solid #c5c5c5;
  }
  .btn:hover{background:#eceef2}
  .btn.primary{background:var(--accent);color:#fff}
  .btn.primary:hover{background:#d63a52}
  .btn:disabled{opacity:.45;cursor:not-allowed}

  .bar-card{background:var(--input);border-radius:9px;padding:9px;margin:8px 0;position:relative}
  .bar-card .del{position:absolute;right:8px;top:8px;cursor:pointer;color:var(--muted);font-size:14px;line-height:1}
  .bar-card .del:hover{color:var(--accent)}
  .bar-field{display:flex;align-items:center;justify-content:space-between;margin:5px 0}
  .bar-field span{font-size:11px;color:#666d76}
  .bar-field input{width:74px;padding:5px 7px;font-size:11.5px}

  .addbar{width:100%;background:none;border:1.4px dashed #cfd4da;color:#666d76;border-radius:8px;padding:8px;font-size:11.5px;font-weight:600;cursor:pointer;margin-top:4px}
  .addbar:hover{border-color:var(--accent);color:var(--accent)}

  /* ---------------- VIEWER ---------------- */
  #viewer{flex:1;position:relative;background:#eef0f3;overflow:hidden}
  #canvas-wrap{position:absolute;inset:0}
  canvas{display:block}

  #drop{
    position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
    background:rgba(244,245,247,.94);z-index:20;transition:.2s;
  }
  #drop.hide{opacity:0;pointer-events:none}
  #drop.over{background:rgba(232,69,94,.09)}
  .dropbox{
    border:2.5px dashed #c6ccd4;border-radius:20px;padding:48px 66px;text-align:center;
    background:#fff;box-shadow:0 14px 40px rgba(25,30,40,.10);cursor:pointer;transition:.2s;
  }
  .dropbox:hover{border-color:var(--accent);transform:translateY(-2px)}
  .dropbox svg{width:52px;height:52px;color:var(--accent);margin-bottom:12px}
  .dropbox h2{margin:0 0 6px;font-size:17px}
  .dropbox p{margin:0;color:var(--muted);font-size:12.5px}

  #hud{
    position:absolute;left:16px;top:16px;z-index:6;display:flex;gap:8px;flex-wrap:wrap;pointer-events:none;
  }
  .chip{
    background:rgba(255,255,255,.94);border:1px solid var(--line);border-radius:8px;
    padding:6px 11px;font-size:11.5px;font-weight:600;color:#4a515a;
    font-variant-numeric:tabular-nums;box-shadow:0 2px 8px rgba(20,25,35,.07);
  }
  .chip b{color:var(--accent)}

  #tools{
    position:absolute;right:16px;top:16px;z-index:6;display:flex;gap:8px;
  }
  #tools .btn{background:rgba(255,255,255,.94);box-shadow:0 2px 8px rgba(20,25,35,.08);border:1px solid var(--line)}

#footer{
  position:absolute;left:0;right:0;bottom:0;z-index:7;padding:12px 16px;
  display:flex;gap:9px;align-items:center;justify-content:center;
  background:linear-gradient(to top,rgba(238,240,243,.97),rgba(238,240,243,0));
  pointer-events:none;   /* ← la barra vacía NO captura clicks */
}
#footer .btn{
  pointer-events:auto;   /* ← pero los botones SÍ */
}
  #footer .btn{padding:11px 22px;font-size:12.5px;box-shadow:0 3px 12px rgba(20,25,35,.10)}
  #footer .btn.ghost{background:#fff;border:1px solid var(--line)}

  #status{
    position:absolute;left:50%;bottom:74px;transform:translateX(-50%);z-index:8;
    background:#22272e;color:#fff;padding:8px 16px;border-radius:20px;font-size:12px;
    opacity:0;transition:.2s;pointer-events:none;white-space:nowrap;
  }
  #status.show{opacity:1}
  #status.err{background:#c22a42}

  #model-busy{
    position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:7;
    display:flex;align-items:center;gap:9px;
    background:rgba(34,39,46,.9);color:#fff;padding:10px 18px;border-radius:22px;
    font-size:13px;font-weight:600;white-space:nowrap;pointer-events:none;
  }
  #model-busy[hidden]{display:none}
  .model-busy-spin{
    width:14px;height:14px;border-radius:50%;
    border:2px solid rgba(255,255,255,.3);border-top-color:#fff;
    animation:model-busy-spin .7s linear infinite;
  }
  @keyframes model-busy-spin{to{transform:rotate(360deg)}}
  @media (prefers-reduced-motion:reduce){.model-busy-spin{animation-duration:2s}}

  .thumb{
    width:100%;height:96px;object-fit:contain;background:var(--input);border-radius:9px;
    border:1px solid var(--line);margin-bottom:8px;
  }

  body.dark {
  --bg:#1a1d21; --panel:#24272c; --line:#33363c; --txt:#e8eaed; --muted:#9ba3ad;
  --input:#2c3036; --shadow:0 2px 10px rgba(0,0,0,.45);
}

/* Panel */
/*body.dark .sec-head:hover{ background:#2a2e34; }
body.dark .brand{ border-color:#33363c; }
body.dark .brand h1{ color:#e8eaed; }
body.dark .brand small{ color:#9ba3ad; }*/

/* Labels e hints — antes eran #444b54 fijo */
body.dark .row label{ color:#e8eaed; }
body.dark .row .hint{ color:#8b929c; }
body.dark .bar-field span{ color:#b0b6be; }

/* Inputs y selects */
body.dark input[type=number],
body.dark input[type=text],
body.dark select{
  color:#e8eaed; border-color:#3a3e44; background:#2c3036;
}
body.dark input[type=number]:focus,
body.dark input[type=text]:focus{
  background:#34383e; border-color:var(--accent);
}

/* Modos */
body.dark .mode-picker{ --mi-a:#ff7b90; --mi-b:#b92c45; --mi-c:#ffe1e7; --mi-bg:#1f2227; }
body.dark .mode-trigger{ background:linear-gradient(135deg,#2a2e34 0%,#3a1f26 100%); color:#eef0f3; }
body.dark .modes{ background:#2a2e34; border-color:#3a3e44; box-shadow:0 14px 34px rgba(0,0,0,.5); }
body.dark .mode{ color:#d6dae0; }
body.dark .mode:hover, body.dark .mode:focus-visible{ background:#3a1f26; }
body.dark .mode.on{ background:var(--accent); color:#fff; }
body.dark .mode-text small{ color:#a2a9b2; }
body.dark .mode.on .mode-text small{ color:rgba(255,255,255,.85); }

/* Bar-cards */
body.dark .bar-card{ background:#2c3036; }
body.dark .addbar{ color:#9ba3ad; border-color:#4a4e54; }
body.dark .addbar:hover{ border-color:var(--accent); color:var(--accent); }

/* Botones */
body.dark .btn{ background:#2c3036; color:#e8eaed; }
body.dark .btn:hover{ background:#34383e; }
body.dark .btn.ghost{ background:#24272c; border-color:#3a3e44; color:#6b6c6f; }

/* Visor completo */
body.dark #viewer{ background:#15171a; }
body.dark #hud .chip{
  background:rgba(36,39,44,.92); border-color:#3a3e44; color:#e8eaed;
}
body.dark #tools .btn{
  background:rgba(36,39,44,.92); color:#e8eaed; border-color:#3a3e44;
}
body.dark #status{ background:#3a3e44; color:#e8eaed; }
body.dark #footer{
  background:linear-gradient(to top, rgba(21,23,26,.97), rgba(21,23,26,0));
}

/* Drop overlay */
body.dark #drop{ background:rgba(20,22,26,.94); }
body.dark .dropbox{
  background:#24272c; border-color:#3a3e44; color:#e8eaed;
  box-shadow:0 14px 40px rgba(0,0,0,.45);
}
body.dark .dropbox h2{ color:#e8eaed; }
body.dark .dropbox p{ color:#9ba3ad; }

/* Thumb */
body.dark .thumb{ background:#2c3036; border-color:#3a3e44; }


/* ---------- Watermark ---------- */
/* Botón "?" en el brand */
.brand #btn-about{
  margin-left:auto;
  width:24px; height:24px;
  border:1px solid var(--line);
  border-radius:50%;
  background:var(--input);
  color:var(--muted);
  font-size:12px;
  font-weight:700;
  cursor:pointer;
  transition:.15s;
  display:flex; align-items:center; justify-content:center;
  padding:0;
}
.brand #btn-about:hover{
  border-color:var(--accent);
  color:var(--accent);
  background:#fff;
}
body.dark .brand #btn-about:hover{ background:#34383e; }

/* Watermark — decorativo, sin interacción */
#watermark{
  position:absolute;
  right:16px; bottom:16px;
  z-index:6;
  padding:6px 12px;
  background:rgba(255,255,255,.98);
  border:1px solid #c8cdd4;
  border-radius:8px;
  font-size:11.5px;
  font-weight:700;
  color:#2a2e34;
  letter-spacing:.4px;
  user-select:none;
  box-shadow:0 2px 10px rgba(20,25,35,.12);
  pointer-events:none;
}

body.dark #watermark{
  background:rgba(52,56,62,.98);
  border-color:#5a5f68;
  color:#ffffff;
  box-shadow:0 2px 10px rgba(0,0,0,.45);
}
#watermark:hover{
  background:rgba(255,255,255,.85) !important;
  color:var(--muted) !important;
}
body.dark #watermark:hover{
  background:rgba(36,39,44,.85) !important;
  color:#8b929c !important;
}
/* ---------- About overlay ---------- */
#about-overlay{
  position:fixed; inset:0; z-index:50;
  background:rgba(15,17,20,.55);
  display:none;
  align-items:center; justify-content:center;
  backdrop-filter:blur(3px);
}
#about-overlay.show{ display:flex; }

#about-box{
  position:relative;
  width:360px; max-width:92vw;
  padding:28px 26px 22px;
  background:var(--panel);
  color:var(--txt);
  border:1px solid var(--line);
  border-radius:14px;
  box-shadow:0 20px 60px rgba(15,17,20,.35);
  animation:about-in .18s ease-out;
}
@keyframes about-in{
  from{ transform:scale(.94); opacity:0; }
  to{ transform:scale(1); opacity:1; }
}
#about-box h2{
  margin:0 0 4px;
  font-size:16px;
  font-weight:700;
  letter-spacing:.2px;
}
#about-box .ver{
  margin:0 0 14px;
  font-size:11px;
  color:var(--accent);
  font-weight:600;
  letter-spacing:.4px;
}
#about-box p{
  margin:6px 0;
  font-size:12.5px;
  line-height:1.5;
  color:#444b54;
}
body.dark #about-box p{ color:#c4c9d0; }

#about-box .about-meta{
  margin:14px 0 12px;
  padding-top:12px;
  border-top:1px solid var(--line);
  display:flex; flex-direction:column; gap:4px;
  font-size:11.5px; color:var(--muted);
}
#about-box .foot{
  margin-top:10px;
  font-size:10.5px;
  color:var(--muted);
  text-align:center;
}
#about-close{
  position:absolute; top:10px; right:10px;
  width:26px; height:26px;
  border:none; border-radius:6px;
  background:transparent;
  color:var(--muted);
  font-size:14px; font-weight:600;
  cursor:pointer;
  transition:.15s;
}
#about-close:hover{ background:var(--input); color:var(--accent); }
/* Cotas del modelo */
#measure-svg{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  pointer-events:none;
  z-index:5;
  overflow:visible;
}
#measure-svg line{
  stroke:#9ba3ad;
  stroke-width:1.2;
  stroke-linecap:round;
}
#measure-svg text{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Inter,Arial,sans-serif;
  font-size:18px;
  fill:#6b7280;
  text-anchor:middle;
  dominant-baseline:middle;
  font-weight:600;
  paint-order:stroke;
  stroke:#ffffff;
  stroke-width:4px;
  stroke-linejoin:round;letter-spacing:0.5px;
}
body.dark #measure-svg line{ stroke:#e8eaed; }
body.dark #measure-svg text{ fill:#e8eaed; stroke:#15171a; }


/* ==================== TOPBAR ==================== */
#app{display:flex;flex-direction:column;height:100vh;width:100vw}

#topbar{
  height:52px;flex-shrink:0;
  position:relative;
  z-index:100;
  display:flex;align-items:center;justify-content:space-between;
  padding:0 18px;
  background:var(--panel);
  border-bottom:1px solid var(--line);
  box-shadow:0 2px 8px rgba(20,25,35,0.1);
  gap:12px;
}
.tb-left, .tb-right{display:flex;align-items:center;gap:14px}
body.dark #topbar{
  box-shadow:0 2px 12px rgba(0,0,0,.35);
}
.tb-brand{
  font-size:13.5px;font-weight:700;color:var(--txt);
  letter-spacing:.2px;display:flex;align-items:center;gap:8px;
}
.tb-brand .dot{
  width:18px;height:18px;border-radius:6px;
  background:linear-gradient(135deg,var(--accent),#ff9aa8);
  box-shadow:0 3px 8px rgba(232,69,94,.35);
}

.tb-link{
  font-size:12.5px;color:var(--muted);text-decoration:none;
  padding:6px 10px;border-radius:7px;cursor:pointer;
  transition:.15s;font-weight:600;
}
.tb-link:hover{background:var(--input);color:var(--txt)}

.tb-badge{
  font-size:11.5px;font-weight:600;
  padding:6px 11px;border-radius:20px;
  background:var(--input);color:var(--muted);
  border:1px solid var(--line);letter-spacing:.3px;
}
.tb-badge.pro{
  background:linear-gradient(135deg,#ffd93d,#ffb800);
  color:#5a3a00;border-color:#e8a800;
}

.tb-account{position:relative}
.tb-account-btn{
  background:var(--input);border:1px solid var(--line);
  border-radius:20px;padding:6px 12px;
  font-size:12px;font-weight:600;color:var(--txt);
  cursor:pointer;display:flex;align-items:center;gap:6px;
  transition:.15s;font-family:inherit;
}
.tb-account-btn:hover{background:#eceef2}
body.dark .tb-account-btn:hover{background:#34383e}
.tb-account-btn .chev{font-size:9px;color:var(--muted)}

.tb-account-menu{
  position:fixed;
  top:0;left:0;
  min-width:210px;background:var(--panel);
  border:1px solid var(--line);border-radius:10px;
  box-shadow:0 14px 40px rgba(20,25,35,.12);
  padding:6px;display:none;z-index:9999;
}
body.dark .tb-account-menu{box-shadow:0 14px 40px rgba(0,0,0,.5)}
.tb-account-menu.show{display:block}

.tb-email{
  padding:10px 12px;font-size:11.5px;color:var(--muted);
  border-bottom:1px solid var(--line);margin-bottom:4px;
  word-break:break-all;
}
.tb-account-menu a{
  display:flex;align-items:center;gap:8px;
  padding:9px 12px;border-radius:7px;
  font-size:12.5px;color:var(--txt);cursor:pointer;
  text-decoration:none;transition:.15s;
}
.tb-account-menu a:hover{background:var(--input)}
.tb-account-menu a.danger:hover{background:#fdeaed;color:#c22a42}

.tb-icon{
  width:34px;height:34px;border-radius:50%;
  border:1px solid var(--line);background:var(--input);
  color:var(--txt);font-size:15px;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition:.15s;padding:0;
}
.tb-icon:hover{border-color:var(--accent);color:var(--accent)}

/* Layout principal debajo de la topbar */
#main{flex:1;display:flex;overflow:hidden;min-height:0}

/* ==================== RESPONSIVE ==================== */
@media (max-width:760px){
  #topbar{padding:0 12px;gap:8px}
  /*.tb-brand span{display:none}*/
  .tb-link{display:none}
  .tb-badge{display:none}
  .tb-account-btn .txt{display:none}
  .tb-brand .tb-text{display:none}
}

@media (max-width:860px){
  #main{flex-direction:column}
  #panel{width:100%;min-width:0;height:52%;border-right:none;border-bottom:1px solid var(--line)}
  #viewer{height:48%}
}
.tb-ver{
  font-size:10px;
  font-weight:500;
  color:var(--muted);
  letter-spacing:.3px;
  margin-left:6px;
  vertical-align:2px;
}
.tb-text{
  display:flex;
  flex-direction:column;
  line-height:1.15;
}
.tb-title{
  font-size:13.5px;
  font-weight:700;
  color:var(--txt);
  letter-spacing:.2px;
}
.tb-sub{
  font-size:10.5px;
  font-weight:400;
  color:var(--muted);
  letter-spacing:.2px;
  margin-top:2px;
}
/*sec*/
/* Fila de la sección Referencia: miniatura a la izquierda, botón a la derecha */
.sec-img-row{
  display:flex;
  align-items:center;
  gap:12px;
}
.sec-img-row .thumb{
  width:20%;
  height:60px;
  margin-bottom:0;
  flex:0 0 auto;
  object-fit:contain;
  background:var(--input);
  border:1px solid var(--line);
  border-radius:8px;
}
.sec-img-row .btn{
  flex:1;
}
/* --- Sección Perfiles: fila compacta --- */
.profile-row{ gap:6px; margin:6px 0; }
.profile-row select{ min-width:0; }
.profile-row .btn{ flex:0 0 auto; }

#profile-name-row{
  animation:pn-in .16s ease-out;
}
@keyframes pn-in{
  from{ opacity:0; transform:translateY(-4px); }
  to  { opacity:1; transform:translateY(0); }
}

/* ==================== FASE 5: CUENTAS Y PLANES ==================== */
.modal-ov{position:fixed;inset:0;z-index:3000;display:none;align-items:center;justify-content:center;
  background:rgba(20,22,26,.55);padding:16px}
.modal-ov.show{display:flex}
.modal-box{position:relative;width:100%;max-width:380px;max-height:calc(100vh - 32px);overflow:auto;
  background:var(--panel);color:var(--txt);border-radius:16px;padding:22px;
  box-shadow:0 20px 60px rgba(0,0,0,.3)}
.modal-box.wide{max-width:640px}
.modal-box h2{margin:0 0 6px;font-size:19px}
.modal-sub{margin:0 0 14px;color:var(--muted);font-size:12.5px;line-height:1.5}
.modal-x{position:absolute;top:10px;right:10px;border:none;background:none;font-size:15px;
  color:var(--muted);cursor:pointer;padding:6px;border-radius:8px}
.modal-x:hover{background:var(--input);color:var(--accent)}
.modal-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:14px;flex-wrap:wrap}
.plans{display:grid;grid-template-columns:1fr 1fr;gap:12px}
@media (max-width:560px){ .plans{grid-template-columns:1fr} }
.plan{border:1px solid var(--line);border-radius:12px;padding:14px;display:flex;flex-direction:column;gap:6px}
.plan.pro{border-color:#e8a800;background:linear-gradient(180deg,rgba(255,217,61,.12),transparent)}
.plan-name{font-weight:700;font-size:15px}
.plan-price{font-size:12px;color:var(--muted)}
.plan ul{list-style:none;margin:6px 0;padding:0;font-size:12px;line-height:1.7;flex:1}
.plan li.no{color:var(--muted)}
.plan-note{font-size:11.5px;color:var(--muted);background:var(--input);border-radius:8px;padding:8px 10px}
.auth-note{margin:0 0 4px;font-size:12px;color:var(--muted)}
#chip-quality{display:none;cursor:pointer}
#chip-quality.show{display:block}
.tb-account-menu .acc-plan{padding:4px 12px 8px;font-size:11.5px;color:var(--muted)}

/* ==================== FASE 4: VISOR + EDITOR ==================== */
#tools{flex-wrap:wrap;justify-content:flex-end;max-width:calc(100% - 32px)}
#tools .btn:disabled{opacity:.45;cursor:not-allowed}
#vpanel{
  position:absolute;right:16px;top:58px;z-index:9;width:230px;display:none;
  background:var(--panel);border:1px solid var(--line);border-radius:12px;
  box-shadow:0 8px 28px rgba(20,25,35,.18);padding:12px;font-size:12px;color:var(--txt);
}
#vpanel.show{display:block}
#vpanel .row{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:7px 0}
#vpanel input[type=color]{width:42px;height:26px;border:1px solid var(--line);border-radius:6px;padding:0;background:none;cursor:pointer}
#vpanel select{width:120px}
#vpanel .vp-actions{display:flex;gap:6px;margin-top:10px}
#vpanel .vp-actions .btn{flex:1;padding:7px 6px;font-size:11.5px}
#vpanel .swatches{display:flex;gap:5px;flex-wrap:wrap;margin:2px 0 6px}
#vpanel .sw{width:18px;height:18px;border-radius:50%;border:1px solid rgba(0,0,0,.15);cursor:pointer}
#chip-edit{display:none;cursor:pointer;color:var(--accent)}
#chip-edit.show{display:block}

#ced{position:absolute;inset:0;z-index:25;display:none;flex-direction:column;background:var(--bg)}
#ced.show{display:flex}
#ced .ced-bar{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:10px 12px;
  background:var(--panel);border-bottom:1px solid var(--line)}
#ced .ced-title{font-weight:700;font-size:13px;color:var(--txt)}
#ced .ced-hint{font-size:11px;color:var(--muted);flex:1 1 260px}
#ced .ced-actions{display:flex;gap:6px;flex-wrap:wrap}
#ced .ced-actions .btn{padding:7px 10px;font-size:11.5px}
#ced-svg{flex:1;width:100%;min-height:0;touch-action:none;cursor:grab;background:
  repeating-conic-gradient(rgba(0,0,0,.035) 0% 25%, transparent 0% 50%) 50%/22px 22px}
#ced-svg.panning{cursor:grabbing}
#ced-svg .ced-poly{fill:rgba(232,69,94,.28);stroke:#e8455e;stroke-width:1.5;vector-effect:non-scaling-stroke;cursor:move}
#ced-svg .ced-poly.sel{fill:rgba(232,69,94,.42);stroke:#b3183a;stroke-width:2}
#ced-svg .ced-v{fill:#fff;stroke:#b3183a;stroke-width:1.5;vector-effect:non-scaling-stroke;cursor:pointer}
#ced-svg .ced-v.on{fill:#b3183a}
#ced-info{padding:6px 12px;font-size:11px;color:var(--muted);background:var(--panel);border-top:1px solid var(--line)}
@media (max-width:860px){
  /* En móvil el editor ocupa toda la pantalla (el visor es muy bajo) */
  #ced{position:fixed;z-index:2000}   /* por encima de la barra superior */
  #ced .ced-hint{display:none}
  #ced .ced-actions .btn{padding:7px 8px;font-size:11px}
}
