:root {
  --bg: #eef3f8;
  --card: #ffffff;
  --ink: #1a2332;
  --muted: #6b7a8c;
  --line: #d5dde8;
  --blue: #2f6fed;
  --blue-soft: #e8f0ff;
  --accent: #c36b6b;
  --wa: #25d366;
  --radius: 14px;
  --shadow: 0 10px 36px rgb(30 50 80 / 10%);
  --font: "DM Sans", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; }
h2 { margin: 0; font-size: 0.82rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink); }

.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.65rem 1rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  text-decoration: none; color: var(--ink); font-weight: 800;
}
.brand img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.brand em { font-style: normal; color: var(--accent); }
.topbar__actions { display: flex; gap: 0.4rem; align-items: center; }
.tb-btn {
  width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; cursor: pointer; color: var(--ink);
}
.tb-btn:hover { background: var(--blue-soft); border-color: #b7c9f5; }
.tb-btn--primary {
  width: auto; padding: 0 0.9rem; background: var(--wa); color: #fff;
  border-color: transparent; font-weight: 800; gap: 0.4rem;
  display: inline-flex; align-items: center;
}
.tb-btn--primary:hover { filter: brightness(0.95); }

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1rem;
  padding: 1rem;
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

.preview-pane { position: sticky; top: 4.5rem; }
.preview-card {
  background: #fff;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.preview-card svg {
  width: min(100%, 520px);
  height: auto;
  display: block;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
.preview-card svg:active { cursor: grabbing; }
.preview-caption {
  margin: 0.7rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.side-pane { min-width: 0; }
.pane-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 0.9rem 1rem 1.2rem;
  max-height: calc(100vh - 5.5rem);
  overflow: auto;
}

.block { margin-bottom: 1.15rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: none; margin-bottom: 0; }
.block__head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.65rem; }
.block > h2 { margin-bottom: 0.65rem; }

.link-btn {
  border: none; background: none; color: var(--blue); font-weight: 800;
  font-size: 0.82rem; cursor: pointer; padding: 0;
}
.link-btn:hover { text-decoration: underline; }

.size-list { display: grid; gap: 0.45rem; }
.size-opt {
  position: relative; display: flex; gap: 0.65rem; align-items: flex-start;
  padding: 0.7rem 0.8rem; border: 1.5px solid var(--line); border-radius: 12px;
  cursor: pointer; background: #fff;
}
.size-opt input { margin-top: 0.2rem; accent-color: var(--blue); }
.size-opt strong { display: block; font-size: 0.9rem; }
.size-opt strong em {
  font-style: normal; font-size: 0.68rem; font-weight: 800;
  color: var(--blue); background: var(--blue-soft); padding: 0.1rem 0.35rem;
  border-radius: 999px; margin-left: 0.25rem; vertical-align: middle;
}
.size-opt small { color: var(--muted); font-size: 0.75rem; }
.size-opt.is-on { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 0 1px var(--blue); }

.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.65rem; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.45rem 0.7rem; border: 1.5px solid var(--line); border-radius: 999px;
  font-size: 0.8rem; font-weight: 700; cursor: pointer; background: #fff;
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip.is-on { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1px solid rgb(0 0 0 / 15%); }
.dot--plata { background: linear-gradient(135deg, #888, #f2f2f2, #666); }
.dot--oro { background: linear-gradient(135deg, #8b6914, #f0d78c, #6b4f10); }
.dot--negra { background: #222; }
.dot--cobre { background: linear-gradient(135deg, #5c2e0a, #cd7f32); }

.field-label { margin: 0.4rem 0 0.4rem; font-size: 0.75rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.swatches { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.7rem; }
.swatch { position: relative; width: 30px; height: 30px; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch span {
  display: block; width: 100%; height: 100%; border-radius: 50%;
  background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
}
.swatch.is-on span { box-shadow: 0 0 0 2px var(--blue); }

.field { display: grid; gap: 0.35rem; margin-bottom: 0.7rem; font-size: 0.8rem; font-weight: 700; }
.field > span { display: flex; justify-content: space-between; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; font-size: 0.72rem; }
.field em { font-style: normal; color: var(--ink); }
.field input[type="text"],
.field select {
  width: 100%; min-height: 44px; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 0.55rem 0.75rem; background: #fff; color: var(--ink); font-weight: 600;
}
.field input[type="text"]:focus,
.field select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgb(47 111 237 / 15%); }
.field input[type="range"] { width: 100%; accent-color: var(--blue); }

.pos-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.35rem; margin-bottom: 0.7rem; }
.pos-row button {
  min-height: 36px; border: 1px solid var(--line); border-radius: 8px;
  background: #f7f9fc; font-weight: 700; font-size: 0.75rem; cursor: pointer;
}
.pos-row button:hover { border-color: var(--blue); color: var(--blue); }

.upload-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 44px; border: 1.5px dashed var(--line); border-radius: 10px;
  cursor: pointer; font-weight: 700; font-size: 0.85rem; color: var(--muted);
}
.upload-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }

.layers { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.layer {
  display: grid; grid-template-columns: 1fr auto; gap: 0.35rem; align-items: center;
  padding: 0.55rem 0.65rem; border-radius: 10px; border: 1.5px solid transparent;
  background: #f7f9fc; cursor: pointer; font-weight: 700; font-size: 0.85rem;
}
.layer.is-on { border-color: var(--blue); background: var(--blue-soft); }
.layer__main { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.layer__main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer__del {
  width: 30px; height: 30px; border: none; border-radius: 8px; background: transparent;
  color: var(--muted); cursor: pointer;
}
.layer__del:hover { background: #fff; color: var(--accent); }
.muted { margin: 0; color: var(--muted); font-size: 0.84rem; }

.modal {
  border: none; border-radius: 16px; padding: 0;
  width: min(420px, calc(100% - 1.5rem));
  box-shadow: 0 24px 60px rgb(20 30 50 / 28%);
}
.modal::backdrop { background: rgb(20 30 50 / 45%); }
.modal__card { padding: 1rem 1.1rem 1.2rem; display: grid; gap: 0.7rem; }
.modal__card header { display: flex; justify-content: space-between; align-items: center; }
.modal__card h2 { font-size: 1.1rem; text-transform: none; letter-spacing: 0; }
.modal__card label { display: grid; gap: 0.3rem; font-weight: 700; font-size: 0.85rem; }
.modal__card input, .modal__card textarea {
  border: 1.5px solid var(--line); border-radius: 10px; min-height: 42px; padding: 0.55rem 0.7rem;
}
.icon-x {
  width: 34px; height: 34px; border: none; border-radius: 8px; background: #f0f3f8;
  font-size: 1.3rem; cursor: pointer; line-height: 1;
}
.summary { margin: 0; padding: 0.7rem; background: #f7f9fc; border-radius: 10px; display: grid; gap: 0.3rem; }
.summary div { display: flex; justify-content: space-between; font-size: 0.88rem; }
.summary dt { color: var(--muted); font-weight: 700; }
.summary dd { margin: 0; font-weight: 800; }
.btn-wa {
  min-height: 46px; border: none; border-radius: 10px; background: var(--wa); color: #fff;
  font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
}
.btn-ghost {
  min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  font-weight: 700; cursor: pointer;
}

.icon-tabs { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.icon-tabs button {
  border: 1px solid var(--line); background: #f7f9fc; border-radius: 999px;
  padding: 0.3rem 0.65rem; font-size: 0.75rem; font-weight: 800; cursor: pointer;
}
.icon-tabs button.is-on { background: var(--blue); color: #fff; border-color: var(--blue); }
.icon-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 0.4rem; max-height: 280px; overflow: auto;
}
.icon-pick {
  aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: #f7f9fc;
  cursor: pointer; display: grid; place-items: center; color: var(--ink);
}
.icon-pick:hover { border-color: var(--blue); background: var(--blue-soft); }

@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
  .preview-pane { position: static; }
  .pane-card { max-height: none; }
  .preview-card { aspect-ratio: auto; }
}
@media (max-width: 560px) {
  .pos-row { grid-template-columns: 1fr 1fr; }
}
