:root {
  --bg: #0f1420;
  --panel: #171e2e;
  --panel-2: #1e2739;
  --border: #2a3550;
  --text: #e8ecf5;
  --text-dim: #8b94ab;
  --accent: #6c5ce7;
  --accent-2: #8f7ff7;
  --ok: #2ecc71;
  --danger: #e74c3c;
  --radius: 12px;
}

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

body {
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #a29bfe);
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: #fff;
}
.brand h1 { font-size: 17px; font-weight: 700; }
.brand-sub { font-size: 12px; color: var(--text-dim); }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.badge {
  font-size: 12px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border); white-space: nowrap;
}
.badge-gray { color: var(--text-dim); }
.badge-ok { color: var(--ok); border-color: rgba(46, 204, 113, 0.4); }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  gap: 16px;
  padding: 16px 22px;
  flex: 1;
  align-items: start;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 20px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
}
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 10px; }
.panel h3 { font-size: 12px; color: var(--text-dim); margin: 12px 0 8px; font-weight: 600; }
.hint { font-size: 11.5px; color: var(--text-dim); line-height: 1.45; }
.hidden { display: none !important; }

/* ---------- Productos ---------- */
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.product-card {
  background: var(--panel-2); border: 2px solid var(--border); border-radius: 10px;
  padding: 10px 6px; text-align: center; cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  font-size: 12px; color: var(--text);
}
.product-card:hover { transform: translateY(-2px); }
.product-card.active { border-color: var(--accent); background: rgba(108, 92, 231, 0.12); }
.product-card .p-icon { font-size: 26px; display: block; margin-bottom: 4px; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--border);
  transition: transform 0.1s, border-color 0.15s;
}
.swatch:hover { transform: scale(1.12); }
.swatch.active { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(143, 127, 247, 0.3); }

/* ---------- Botones ---------- */
.btn {
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  border-radius: 9px; padding: 9px 13px; font-size: 13px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}
.btn:hover { background: #263149; border-color: #3b4a6d; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; font-weight: 700;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-block { width: 100%; padding: 13px; margin-top: 12px; font-size: 14px; }
.btn-ghost { background: transparent; }
.btn-tool { flex: 1; text-align: center; }
.btn-mini { padding: 6px 10px; font-size: 12px; }
.btn-small { font-size: 12px; }
.btn-danger { color: #ff8a80; }
.tool-buttons { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }

/* ---------- Escenario ---------- */
.stage-wrap { display: flex; flex-direction: column; gap: 10px; }
.stage-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 0 4px; }
.stage {
  position: relative;
  width: 560px; height: 560px;
  margin: 0 auto;
  background:
    radial-gradient(ellipse at 50% 40%, #ffffff 0%, #eef0f6 70%, #e3e7f0 100%);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.mockup-host, .mockup-host svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.canvas-holder {
  position: absolute;
  outline: 2px dashed rgba(108, 92, 231, 0.55);
  outline-offset: 2px;
  border-radius: 4px;
}
.canvas-holder::before {
  content: 'Zona de impresión';
  position: absolute; top: -22px; left: 0;
  font-size: 10.5px; color: #6c5ce7; font-weight: 700;
  letter-spacing: 0.04em;
}
.drop-hint {
  position: absolute; inset: 0;
  display: grid; place-items: center; text-align: center;
  color: rgba(70, 78, 100, 0.5); font-size: 15px; font-weight: 600;
  pointer-events: none;
  opacity: 0; transition: opacity 0.2s;
}
.stage.dragover .drop-hint { opacity: 1; }
.stage.dragover { outline: 3px dashed var(--accent); outline-offset: -3px; }

/* ---------- Capas ---------- */
.layers { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.layers li {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; font-size: 12.5px; cursor: pointer;
}
.layers li.active { border-color: var(--accent); }
.layers li .l-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layers li button { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 13px; padding: 2px 4px; }
.layers li button:hover { color: var(--text); }
.layers-empty { color: var(--text-dim); font-size: 12px; padding: 6px 2px; }

/* ---------- Controles ---------- */
.ctrl-row { display: flex; gap: 10px; align-items: end; margin-bottom: 10px; flex-wrap: wrap; }
.ctrl-row label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--text-dim); flex: 1; }
.ctrl-row input, .ctrl-row select {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit;
  width: 100%;
}
.ctrl-row input[type="color"] { padding: 3px; height: 36px; cursor: pointer; }
.ctrl-row input[type="range"] { padding: 0; height: 36px; }

/* ---------- Presupuesto ---------- */
.quote-box { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-top: 6px; }
.quote-line { display: flex; justify-content: space-between; font-size: 12.5px; padding: 4px 0; color: var(--text-dim); }
.quote-discount span:last-child { color: var(--ok); font-weight: 600; }
.quote-unit { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; color: var(--text); font-weight: 600; }
.quote-total { font-size: 16px; color: var(--text); font-weight: 800; }
.quote-total span:last-child { color: var(--accent-2); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(8, 11, 20, 0.7);
  display: grid; place-items: center; z-index: 100; backdrop-filter: blur(3px);
}
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 26px; width: min(480px, 92vw); position: relative;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; color: var(--text-dim); font-size: 16px; cursor: pointer;
}
.modal h3 { margin-bottom: 12px; font-size: 17px; }
.modal p { font-size: 13.5px; color: var(--text-dim); line-height: 1.55; margin-bottom: 10px; }
.modal img.preview { width: 100%; border-radius: 10px; background: #fff; margin: 10px 0; }
.modal .share-row { display: flex; gap: 8px; margin: 12px 0; }
.modal .share-row input { flex: 1; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 9px 11px; font-size: 12.5px; }
.modal a { color: var(--accent-2); }
.order-ok { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; color: var(--ok); margin-bottom: 8px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: var(--panel-2); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  padding: 12px 16px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.25s ease;
  max-width: 340px;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.footer { text-align: center; font-size: 11.5px; color: var(--text-dim); padding: 10px 0 16px; }

@media (max-width: 1180px) {
  .layout { grid-template-columns: 1fr; }
  .stage { max-width: 100%; }
}
