@font-face { font-family: 'Figtree'; font-weight: 400; src: url(fonts/figtree-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 500; src: url(fonts/figtree-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 600; src: url(fonts/figtree-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 700; src: url(fonts/figtree-latin-700-normal.woff2) format('woff2'); }

/* Mostrador de tienda: formulario blanco y claro; la etiqueta colgada en una pared ranurada. */
:root {
  --yellow: #f0cc1f; --yellow-deep: #d9b40a; --ink: #1c1a15; --muted: #625e52;
  --surface: #ffffff; --field: #f5f5f2; --rule: #e4e3dd; --danger: #b3261e;
  --wall: #dfe1e0; --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; scrollbar-color: #c9c7bd transparent; }
body { margin: 0; background: var(--surface); color: var(--ink); font: 400 15px/1.45 'Figtree', system-ui, sans-serif; accent-color: var(--yellow-deep); caret-color: var(--ink); }
::selection { background: #fbe777; }
:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 2px; }
h1, h2 { margin: 0; letter-spacing: -.02em; text-wrap: balance; }

input:not([type=checkbox], [type=range], [type=color], [type=file]), select {
  width: 100%; min-width: 0; height: 40px; padding: 0 12px; font: inherit; color: inherit;
  background: var(--field); border: 1px solid var(--rule); border-radius: var(--radius);
}
input::placeholder { color: #6f6b60; }
input:focus, select:focus, .editable:focus { background: #fff; border-color: var(--ink); outline: 2px solid var(--yellow); outline-offset: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  font: 600 14.5px 'Figtree', sans-serif; color: var(--ink); background: var(--surface);
  border: 1px solid #cfcdc4; border-radius: var(--radius); cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s;
}
.btn:hover { background: var(--field); border-color: var(--ink); }
.btn.primary { background: var(--yellow); border-color: var(--yellow); }
.btn.primary:hover { background: var(--yellow-deep); border-color: var(--yellow-deep); }
.link { padding: 4px 0; background: none; border: 0; font: 500 14px 'Figtree', sans-serif; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--yellow-deep); text-decoration-thickness: 2px; cursor: pointer; }
.link.danger { color: var(--danger); text-decoration-color: currentColor; text-decoration-thickness: 1px; }
.error { min-height: 1.4em; margin: 4px 0; color: var(--danger); font-size: 14px; }

/* acceso */
.login { width: min(340px, 100% - 32px); margin: 8vh auto; display: flex; flex-direction: column; text-align: center; }
.login img { align-self: center; }
.login h1 { font-size: 26px; margin: 8px 0 28px; }
.login label { text-align: left; font-weight: 600; margin-bottom: 6px; }

/* barra */
.bar { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 20px; border-bottom: 1px solid var(--rule); }
.bar h1 { font-size: 20px; }
.status { color: var(--muted); font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar nav { margin-left: auto; display: flex; gap: 8px; }

main { display: grid; grid-template-columns: minmax(380px, 520px) 1fr; height: calc(100dvh - 64px); }
#editor { position: relative; overflow: hidden auto; padding: 4px 28px 60px; }
fieldset { min-width: 0; margin: 0; padding: 22px 0 24px; border: 0; border-bottom: 1px solid var(--rule); }
fieldset:last-child { border: 0; }
legend { float: left; width: 100%; padding: 0; margin-bottom: 14px; font-size: 19px; font-weight: 700; letter-spacing: -.015em; }
legend + * { clear: both; }
.field { margin-bottom: 14px; min-width: 0; }
.row { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 4px; }
.row > * { flex: 1; }
.row > .link { flex: none; }
.row > select { flex: 0 0 160px; }
[data-show="brandType=text"] { align-items: center; margin-bottom: 14px; }
[data-show="brandType=image"] { margin-bottom: 14px; }
.price > :first-child { flex: 0 0 110px; }

.title { position: relative; display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.check { display: flex; align-items: center; gap: 9px; margin: 4px 0 14px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; margin: 0; }
input[type=range] { width: 100%; margin: 0; }

/* ayuda "?" */
.help { display: inline-flex; }
.help > button { width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 1px solid #aaa79c; background: none; color: var(--muted); font: 700 11px 'Figtree', sans-serif; cursor: help; }
.help:hover > button, .help > button:focus { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.tip {
  position: absolute; z-index: 20; top: calc(100% + 5px); left: 0; width: min(250px, 100%); min-width: 170px; padding: 10px 12px;
  background: var(--ink); color: #fff; border-radius: var(--radius); box-shadow: 0 8px 24px rgb(0 0 0 / .22);
  font-size: 12.5px; font-weight: 400; line-height: 1.45; visibility: hidden; opacity: 0; transition: opacity .15s, visibility .15s;
}
.tip em { display: block; margin-top: 6px; font-style: normal; color: #f6de6a; }
.help:hover .tip, .help:focus-within .tip { visibility: visible; opacity: 1; }
.row > .field:last-child .tip { left: auto; right: 0; }
.price > .field:first-child .tip { width: 220px; }

.segmented { display: inline-flex; padding: 3px; gap: 3px; background: var(--field); border-radius: var(--radius); }
.segmented button { padding: 6px 18px; border: 0; border-radius: 7px; background: none; font: 600 14px 'Figtree', sans-serif; color: var(--muted); cursor: pointer; }
.segmented button[aria-pressed=true] { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgb(0 0 0 / .14); }

.icons { display: flex; flex-wrap: wrap; gap: 6px; }
.icons button { width: 42px; height: 40px; padding: 8px; display: grid; place-items: center; border: 1px solid var(--rule); background: #fff; border-radius: var(--radius); color: var(--ink); cursor: pointer; }
.icons button.text { width: auto; padding: 0 12px; font: 500 13.5px 'Figtree', sans-serif; }
.icons button[aria-pressed=true] { border-color: var(--ink); background: #fdf3b8; }
.icons svg { width: 22px; height: 22px; }

.upload { position: relative; display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload label:focus-within { outline: 2.5px solid var(--ink); outline-offset: 2px; }
.upload img { height: 40px; max-width: 140px; object-fit: contain; }

.colors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 8px; }
.color { display: flex; align-items: center; gap: 8px; font-size: 13.5px; line-height: 1.2; cursor: pointer; }
input[type=color] { flex: none; width: 34px; height: 34px; padding: 0; border: 1px solid #cfcdc4; border-radius: 50%; overflow: hidden; background: none; cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; }
input[type=color]::-moz-color-swatch { border: 0; }

/* editor de texto */
.rich { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--field); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 5px; border-bottom: 1px solid var(--rule); }
.toolbar button { min-width: 32px; height: 32px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 0; border-radius: 7px; background: none; font: 500 14px 'Figtree', sans-serif; color: var(--ink); cursor: pointer; }
.toolbar button:hover { background: #e8e7e0; }
.toolbar button[aria-pressed=true], .toolbar button[aria-expanded=true] { background: #fbe777; }
.toolbar svg { width: 18px; height: 18px; }
.sep { width: 1px; height: 18px; margin: 0 4px; background: #d2d0c7; }
.emojis { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); max-height: 150px; overflow-y: auto; padding: 6px; border-bottom: 1px solid var(--rule); }
.emojis button { height: 34px; border: 0; background: none; border-radius: 7px; font-size: 19px; cursor: pointer; }
.emojis button:hover { background: #fbe777; }
.editable { min-height: 220px; max-height: 420px; overflow-y: auto; padding: 12px 14px; background: #fff; border: 1px solid transparent; border-radius: 0 0 var(--radius) var(--radius); line-height: 1.6; }
.editable ul, .editable ol { margin: 0; padding-left: 22px; }
.editable li::marker { color: #b9701b; }

.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.slots label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.slots span { width: 18px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* vista previa: pared ranurada de la tienda */
.stage {
  min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; padding: 14px;
  background: repeating-linear-gradient(180deg, var(--wall) 0 54px, #aeb1b0 54px 58px, #c9cccb 58px 62px, #f0f1f0 62px 64px);
}
.tabs { display: flex; gap: 3px; padding: 3px; background: #fff; border-radius: 999px; box-shadow: 0 2px 8px rgb(0 0 0 / .12); }
.tabs button { padding: 7px 18px; border: 0; border-radius: 999px; background: none; font: 600 14px 'Figtree', sans-serif; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected=true] { background: var(--ink); color: #fff; }
.viewport { flex: 1; align-self: stretch; min-height: 0; display: flex; justify-content: center; align-items: center; }
.hang { position: relative; margin-top: 40px; filter: drop-shadow(0 14px 18px rgb(0 0 0 / .26)); }
/* cordón del que cuelga */
.hang::before { content: ''; position: absolute; z-index: 2; left: 50%; bottom: calc(100% - 14px); width: 3px; height: 70px; margin-left: -1.5px; border-radius: 3px; background: #fdfcf8; box-shadow: 1px 1px 2px rgb(0 0 0 / .35); }
.slot { position: absolute; }
.slot .tag { transform-origin: 0 0; }
.hint, .warning { margin: 8px 0 0; padding: 5px 14px; border-radius: 999px; background: #fff; font-size: 13.5px; text-align: center; }
.warning { background: #fde8e6; color: var(--danger); font-weight: 600; border-radius: var(--radius); }
#sheet-preview { position: relative; box-shadow: 0 10px 30px rgb(0 0 0 / .25); }
.sheet { position: relative; overflow: hidden; background: #fff; transform-origin: 0 0; }
.slot.guide { outline: 1px dashed #9b9b9b; outline-offset: 0; }

dialog { width: min(520px, 100% - 24px); max-height: 82dvh; padding: 22px; border: 0; border-radius: 16px; color: var(--ink); box-shadow: 0 24px 60px rgb(0 0 0 / .3); }
dialog::backdrop { background: rgb(28 26 21 / .45); }
dialog h2 { font-size: 20px; margin-bottom: 14px; }
dialog > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
dialog > header h2 { margin: 0; }
dialog form > label { display: block; margin-bottom: 6px; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 8px; }
#library-list { list-style: none; margin: 12px 0 0; padding: 0; }
#library-list li { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--rule); }
#library-list .open { flex: 1; min-width: 0; padding: 11px 6px; text-align: left; background: none; border: 0; font: inherit; color: inherit; cursor: pointer; border-radius: 6px; }
#library-list .open:hover { background: #fdf6cc; }
#library-list strong, #library-list span { display: block; overflow-wrap: anywhere; }
#library-list span { color: var(--muted); font-size: 13px; }
#library-list .empty { border: 0; padding: 20px 0; color: var(--muted); }

/* zona de impresión: fuera de pantalla pero medible */
#print-area { position: absolute; left: -10000px; top: 0; }

@media (max-width: 880px) {
  .bar { height: auto; flex-wrap: wrap; padding: 10px 12px; }
  .bar nav { margin: 0; width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .bar nav .btn { padding: 0 8px; }
  .status { flex: 1; }
  main { display: flex; flex-direction: column; height: auto; }
  .stage { order: -1; height: 76dvh; }
  #editor { overflow: visible; padding: 4px 16px 40px; }
  .colors { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media print {
  body { background: #fff; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { position: static; }
  .sheet { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
