:root{
  --bg1:#f4f7ff;
  --bg2:#fff;
  --card:#ffffffcc;
  --stroke:#e7ecff;
  --text:#0f172a;
  --muted:#64748b;
  --primary1:#6d28d9;
  --primary2:#0ea5e9;
  --shadow: 0 12px 30px rgba(2,6,23,.10);
  --radius: 18px;
  --radius2: 22px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color:var(--text);
  background: radial-gradient(1200px 500px at 10% 0%, #c7d2fe 0%, transparent 60%),
              radial-gradient(900px 480px at 95% 20%, #bae6fd 0%, transparent 55%),
              linear-gradient(180deg, var(--bg1), #f8fafc 55%, #f1f5ff);
}

.hidden{display:none!important}
.small{font-size:12px}

.topbar{
  position:sticky;
  top:0;
  z-index:20;
  background:rgba(255,255,255,.75);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--stroke);
  padding:14px 18px;
  display:flex;
  gap:14px;
  align-items:center;
  justify-content:space-between;
}

.topbar-left{display:flex; gap:12px; align-items:center}
.avatar{
  width:42px;height:42px;border-radius:14px;
  background: linear-gradient(135deg, var(--primary1), var(--primary2));
  color:#fff; display:flex; align-items:center; justify-content:center;
  font-weight:800;
  box-shadow: 0 10px 20px rgba(14,165,233,.18);
}
.topbar-title{font-weight:800}
.topbar-sub{color:var(--muted); font-size:12px; margin-top:2px}
.topbar-actions{display:flex; gap:10px; align-items:center; flex-wrap:wrap}

.btn{
  border:1px solid var(--stroke);
  background:#fff;
  border-radius:14px;
  padding:10px 14px;
  cursor:pointer;
  box-shadow: 0 10px 20px rgba(2,6,23,.06);
  font-weight:700;
}
.btn:hover{transform: translateY(-1px)}
.btn:active{transform: translateY(0px)}
.btn-primary{
  border:none;
  background: linear-gradient(90deg, var(--primary1), var(--primary2));
  color:#fff;
}
.btn-ghost{
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color: #1d4ed8;
}
.btn-small{padding:8px 12px; border-radius:12px; font-size:13px}

.layout{
  padding:16px 18px 28px;
  display:grid;
  grid-template-columns: minmax(520px, 1fr) 420px;
  gap:16px;
  align-items:start;
}

.left{
  position:sticky;
  top:92px; /* debajo del header */
}

.preview-card{
  background: var(--card);
  border:1px solid var(--stroke);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  padding:14px;
}

.preview-top{display:flex; flex-direction:column; gap:10px}
.status{color:var(--muted); font-size:13px}
.loading-bar{
  width:100%; height:10px; border-radius:999px;
  background:#eef2ff; overflow:hidden;
  border:1px solid var(--stroke);
}
.loading-bar-inner{
  width:40%;
  height:100%;
  background: linear-gradient(90deg, var(--primary1), var(--primary2));
  animation: indet 1.2s infinite linear;
}
@keyframes indet{
  0%{transform: translateX(-120%)}
  100%{transform: translateX(260%)}
}

.preview-stage{
  margin-top:12px;
  border-radius: 20px;
  background: linear-gradient(180deg, #0b1220, #050914);
  border:1px solid rgba(255,255,255,.08);
  height: calc(100vh - 210px);
  min-height: 520px;
  position:relative;
  overflow:hidden;
}
.canvas{
  width:100%;
  height:100%;
  display:block;
}
.empty-hint{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  color:rgba(255,255,255,.75);
  text-align:center;
  padding:22px;
  pointer-events:none;
}

.tools-row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:12px;
}
.chip{
  border:1px solid var(--stroke);
  background:#fff;
  border-radius:999px;
  padding:9px 12px;
  font-weight:800;
  cursor:pointer;
}
.chip[disabled]{opacity:.55; cursor:not-allowed}
.tip{color:var(--muted); margin-top:10px}

.right{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.card{
  background: var(--card);
  border:1px solid var(--stroke);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  padding:14px;
}
.card-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.card-title{font-weight:900; font-size:16px}

.row{margin-top:10px}
.row-gap{display:flex; gap:10px; flex-wrap:wrap}

.label{display:block; color:var(--muted); font-size:12px; font-weight:800; margin-bottom:6px}
.input{
  width:100%;
  border:1px solid var(--stroke);
  border-radius:14px;
  padding:10px 12px;
  outline:none;
  background:#fff;
}
.input:focus{border-color:#c4b5fd; box-shadow:0 0 0 4px rgba(124,58,237,.10)}

.preset-list{
  margin-top:10px;
  display:flex;
  flex-direction:column;
  gap:10px;
  max-height: 420px;
  overflow:auto;
  padding-right:6px;
}
.preset-item{
  border:1px solid var(--stroke);
  border-radius:16px;
  padding:10px 10px;
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.preset-main{min-width:0}
.preset-name{font-weight:900}
.preset-meta{color:var(--muted); font-size:12px; margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.preset-actions{display:flex; gap:8px; align-items:center}
.star{
  width:40px; height:40px;
  border-radius:14px;
  border:1px solid #ddd6fe;
  background:#ede9fe;
  cursor:pointer;
  font-weight:900;
}
.star.on{background:#fde68a; border-color:#f59e0b}
.apply{padding:9px 12px; border-radius:14px; font-weight:900; border:1px solid var(--stroke); background:#fff; cursor:pointer}

.slider{margin-top:12px}
.slider-head{display:flex; justify-content:space-between; align-items:center; color:var(--muted); font-weight:800; font-size:12px; margin-bottom:6px}
input[type="range"]{width:100%}

/* LOGIN */
.login-body{display:flex; align-items:center; justify-content:center; padding:24px}
.login-wrap{width:100%; max-width:520px}
.login-card{
  background:rgba(255,255,255,.75);
  border:1px solid var(--stroke);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding:18px;
}
.login-brand{display:flex; gap:12px; align-items:center; margin-bottom:10px}
.login-title{font-weight:950; font-size:18px}
.login-sub{color:var(--muted); font-size:12px}
.login-form{margin-top:10px; display:flex; flex-direction:column; gap:10px}
.alert{
  margin-top:10px;
  background:#fee2e2;
  border:1px solid #fecaca;
  color:#7f1d1d;
  padding:10px 12px;
  border-radius:14px;
  font-weight:800;
}

/* Responsive */
@media (max-width: 1060px){
  .layout{grid-template-columns: 1fr; }
  .left{position:relative; top:auto}
  .preview-stage{height: 64vh; min-height: 420px}
}
