/* Hallmark · shape: app screen · genre: modern-minimal · theme: Terrazzo (deal 1/3, seed herramienta-web-para-crear-4ad5·fa4886c3·2026-11-20·r0)
 * nav: one top bar with autosave state, preview and exports · signature: the product rail of thumbnails and mono codes · states: empty, full, saving, undo, export error · terrazzo: off-white, ink rules, rust signal, square controls
 * axes: light/geometric-sans/warm · posture: restrained · contrast: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H5 E5 S5 R5 V4 · weakest: P, a tool has no argument, so the sample drawer and the live sheet carry the point */
/* Hallmark · finish-review: subagent · 6 findings · 5 resolved 1 dismissed (F3: linter wants text-wrap: balance, which is present) · gap answered: error red is semantic, not decoration */
@import url("./tokens.css");
@import url("./base.css");

:root {
  --topbar-h: 64px;
  --rail-w: 20rem;
  --radius-input: 0;
}

.skip { position: absolute; left: var(--space-md); top: calc(-1 * var(--space-3xl)); z-index: var(--z-toast); padding: var(--space-xs) var(--space-md); background: var(--color-ink); color: var(--color-paper); }
.skip:focus-visible { top: var(--space-sm); }

.topbar { position: sticky; top: 0; z-index: var(--z-sticky-nav); background: var(--color-paper); border-bottom: var(--rule-bar) solid var(--color-ink); }
.topbar__inner { max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); min-height: var(--topbar-h); display: flex; align-items: center; gap: var(--space-lg); }
.wordmark { font-family: var(--font-display); font-weight: var(--display-weight); font-size: var(--text-xl); letter-spacing: var(--tracking-display); text-decoration: none; line-height: 1; white-space: nowrap; }
.wordmark span { color: var(--color-accent); }
.save { margin: 0; color: var(--color-muted); font-size: var(--text-sm); min-width: 0; }
.save.is-error { color: var(--color-error); }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-xs); flex-shrink: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 var(--space-md); border: var(--rule-hair) solid var(--color-ink); border-radius: var(--radius-input); background: transparent; color: var(--color-ink); font: 500 var(--text-sm)/1 var(--font-body); white-space: nowrap; text-decoration: none; cursor: pointer; transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out); }
.btn:hover { background: var(--color-paper-2); }
.btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--color-ink); color: var(--color-paper); border-color: var(--color-ink); }
.btn--primary:hover { background: var(--color-ink-2); }
.btn--danger { color: var(--color-error); border-color: var(--color-error); }
.btn--danger:hover { background: var(--color-accent-soft); }
.btn.is-fallback { color: var(--color-accent); border-color: var(--color-accent); }

.workspace { max-width: var(--container); margin-inline: auto; padding: var(--space-lg) var(--gutter) var(--space-3xl); display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); gap: var(--gap-columns); align-items: start; }

.rail { position: sticky; top: calc(var(--topbar-h) + var(--space-md)); max-height: calc(100dvh - var(--topbar-h) - var(--space-xl)); overflow-y: auto; overscroll-behavior: contain; padding-right: var(--space-2xs); }
.rail__identity h1 { font-size: var(--text-xl); margin-bottom: var(--space-md); }
.rail__products { margin-top: var(--space-lg); padding-top: var(--space-md); border-top: var(--rule-bar) solid var(--color-ink); }
.rail__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.rail__head h2 { font-size: var(--text-lg); }
.count { font-family: var(--font-outlier); font-size: var(--text-sm); color: var(--color-muted); }
.rail__products > .btn { width: 100%; }
.field--search { margin-top: var(--space-sm); }
.product-list { list-style: none; margin: var(--space-sm) 0 0; padding: 0; }
.product-list__empty { padding: var(--space-md) 0; border-top: var(--rule-hair) solid var(--color-rule); color: var(--color-muted); font-size: var(--text-sm); }
.product { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); gap: var(--space-sm); align-items: center; width: 100%; padding: var(--space-xs) var(--space-2xs); background: transparent; border: 0; border-top: var(--rule-hair) solid var(--color-rule); text-align: left; color: inherit; cursor: pointer; transition: background-color var(--dur-micro) var(--ease-out); }
.product:hover { background: var(--color-paper-2); }
.product:focus-visible { outline: 2px solid var(--color-focus); outline-offset: -2px; }
.product.is-active { background: var(--color-accent-soft); box-shadow: inset var(--rule-bar) 0 0 var(--color-accent); }
.product__thumb { width: 2.5rem; height: 2.5rem; object-fit: cover; background: var(--color-paper-3); border: var(--rule-hair) solid var(--color-ink); }
.product__number { display: grid; place-items: center; font-family: var(--font-outlier); font-size: var(--text-xs); color: var(--color-muted); border: var(--rule-hair) solid var(--color-rule); }
.product__info { min-width: 0; }
.product__name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); font-weight: 500; }
.product__meta { display: flex; gap: var(--space-sm); margin-top: var(--space-3xs); color: var(--color-muted); font-size: var(--text-xs); min-width: 0; }
.product__meta span { font-family: var(--font-outlier); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail__foot { margin-top: var(--space-lg); padding-top: var(--space-sm); border-top: var(--rule-hair) solid var(--color-rule); }
.disclosure summary { min-height: 40px; display: flex; align-items: center; font-size: var(--text-sm); font-weight: 500; cursor: pointer; }
.disclosure summary:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.disclosure__body { padding-bottom: var(--space-sm); }
.file-actions { display: grid; gap: var(--space-2xs); margin-top: var(--space-md); }

.link-btn { display: block; width: 100%; text-align: left; min-height: 36px; padding: 0; border: 0; background: transparent; color: var(--color-ink); font-size: var(--text-sm); text-decoration: underline; text-underline-offset: 0.16em; cursor: pointer; }
.link-btn:hover { color: var(--color-accent); }
.link-btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.link-btn--danger { color: var(--color-error); }

.editor { min-width: 0; }
.editor__empty { padding: var(--space-2xl) 0 var(--space-3xl); max-width: 46ch; }
.editor__empty h2 { font-size: var(--text-2xl); }
.editor__empty p { margin-top: var(--space-md); color: var(--color-ink-2); }
.editor__empty-actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-top: var(--space-lg); }
.editor__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); padding-bottom: var(--space-sm); border-bottom: var(--rule-bar) solid var(--color-ink); }
.editor__head h2 { font-size: var(--text-xl); }
.editor__tools { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
.tool { min-height: 36px; padding: 0 var(--space-sm); border: var(--rule-hair) solid var(--color-rule); background: transparent; color: var(--color-ink); font-size: var(--text-sm); cursor: pointer; transition: background-color var(--dur-micro) var(--ease-out); }
.tool:hover { background: var(--color-paper-2); }
.tool:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.tool:active { transform: translateY(1px); }
.tool:disabled { opacity: 0.55; cursor: not-allowed; }
.tool--danger { color: var(--color-error); }
.undo { display: flex; align-items: center; gap: var(--space-sm); margin-top: var(--space-sm); padding: var(--space-sm) var(--space-md); background: var(--color-accent-soft); font-size: var(--text-sm); }
.undo button { border: 0; background: transparent; color: var(--color-ink); font-size: var(--text-sm); font-weight: 500; text-decoration: underline; text-underline-offset: 0.16em; cursor: pointer; }
.undo button:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

.editor__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--space-xl); padding-top: var(--space-lg); }
.field { margin-bottom: var(--space-md); }
.field label { display: block; margin-bottom: var(--space-2xs); font-size: var(--text-sm); font-weight: 500; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md); }
.input { width: 100%; min-height: 40px; padding: var(--space-2xs) var(--space-sm); border: var(--rule-hair) solid var(--color-muted); border-radius: var(--radius-input); background: var(--color-plate); color: var(--color-ink); font-size: var(--text-md); outline: 2px solid transparent; outline-offset: -3px; transition: background-color var(--dur-micro) var(--ease-out); }
.input::placeholder { color: var(--color-muted); opacity: 1; }
.input:hover { background: var(--color-paper-2); }
.input:focus-visible { outline-color: var(--color-focus); }
.input[aria-invalid="true"] { border-color: var(--color-error); }
.input:disabled { opacity: 0.55; cursor: not-allowed; }
.input--area { min-height: 5rem; padding-block: var(--space-xs); resize: vertical; line-height: 1.5; }
.input--tall { min-height: 7.5rem; }

.photos__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm); flex-wrap: wrap; }
.photos__head h3 { font-size: var(--text-md); }
.photos__head p { font-size: var(--text-sm); color: var(--color-muted); }
.photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-xs); margin-top: var(--space-sm); }
.slot { position: relative; min-width: 0; }
.slot__input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.slot__label { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2xs); aspect-ratio: 1; padding: var(--space-xs); border: var(--rule-hair) dashed var(--color-rule); background: var(--color-paper-2); color: var(--color-muted); font-size: var(--text-xs); text-align: center; cursor: pointer; transition: background-color var(--dur-micro) var(--ease-out); }
.slot__label:hover { background: var(--color-paper-3); }
.slot__input:focus-visible + .slot__label { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.slot__plus { font-family: var(--font-display); font-size: var(--text-lg); line-height: 1; color: var(--color-ink); }
.slot__img { width: 100%; aspect-ratio: 1; object-fit: cover; border: var(--rule-bar) solid var(--color-ink); }
.slot__missing { display: grid; place-items: center; aspect-ratio: 1; padding: var(--space-2xs); border: var(--rule-hair) dashed var(--color-rule); color: var(--color-error); font-size: var(--text-xs); text-align: center; }
.slot__cover { position: absolute; top: var(--space-2xs); left: var(--space-2xs); padding: var(--space-3xs) var(--space-2xs); background: var(--color-ink); color: var(--color-paper); font-size: var(--text-xs); }
.slot__controls { display: flex; flex-wrap: wrap; gap: var(--space-md); margin-top: var(--space-2xs); }
.slot__controls button { position: relative; min-height: 32px; padding: 0 var(--space-2xs); border: var(--rule-hair) solid var(--color-rule); background: transparent; color: var(--color-ink); font-size: var(--text-xs); cursor: pointer; }
.slot__controls button::before { content: ""; position: absolute; inset: -6px; }
.slot__controls button:hover { background: var(--color-paper-2); }
.slot__controls button:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.slot__controls button:disabled { opacity: 0.55; cursor: not-allowed; }
.slot__controls .slot__remove { color: var(--color-error); }
.photo-grid.is-dragging .slot__label { background: var(--color-accent-soft); border-color: var(--color-accent); }
.photo-help { min-height: 1lh; margin-top: var(--space-sm); color: var(--color-muted); font-size: var(--text-sm); }
.photo-help.is-error { color: var(--color-error); }

.sheet-preview { margin-top: var(--space-2xl); padding-top: var(--space-md); border-top: var(--rule-bar) solid var(--color-ink); }
.sheet-preview h3 { font-size: var(--text-lg); margin-bottom: var(--space-md); }
.sheet-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--space-lg); max-width: 62rem; padding: var(--space-md); background: var(--color-plate); border: var(--rule-bar) solid var(--color-ink); box-shadow: var(--shadow-card); }
.sheet-card__photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2xs); align-content: start; }
.sheet-card__photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: var(--rule-hair) solid var(--color-rule); }
.sheet-card__photos img:first-child:nth-last-child(1) { grid-column: 1 / -1; }
.sheet-card__code { font-family: var(--font-outlier); font-size: var(--text-xs); color: var(--color-muted); }
.sheet-card__name { font-size: var(--text-xl); margin-top: var(--space-2xs); }
.sheet-card__price { font-family: var(--font-outlier); font-size: var(--text-lg); font-variant-numeric: tabular-nums; margin-top: var(--space-sm); }
.sheet-card__cat { font-size: var(--text-sm); color: var(--color-muted); margin-top: var(--space-2xs); }
.sheet-card__desc { margin-top: var(--space-sm); font-size: var(--text-sm); line-height: 1.6; white-space: pre-line; }
.sheet-card__empty { color: var(--color-muted); font-size: var(--text-sm); }

.preview { max-width: var(--container); margin-inline: auto; padding: var(--space-lg) var(--gutter) var(--space-3xl); }
.preview__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); padding-bottom: var(--space-sm); border-bottom: var(--rule-bar) solid var(--color-ink); }
.preview__bar h2 { font-size: var(--text-xl); }
.preview__actions { display: flex; gap: var(--space-xs); }
.preview__frame { display: block; width: 100%; height: calc(100dvh - var(--topbar-h) - var(--space-4xl)); min-height: 32rem; margin-top: var(--space-md); background: var(--color-plate); border: var(--rule-hair) solid var(--color-rule); }

.dialog { width: min(28rem, calc(100% - 2 * var(--space-md))); padding: var(--space-lg); background: var(--color-plate); color: var(--color-ink); border: var(--rule-bar) solid var(--color-ink); box-shadow: var(--shadow-card); }
.dialog::backdrop { background: color-mix(in oklab, var(--color-ink) 55%, transparent); }
.dialog h2 { font-size: var(--text-xl); }
.dialog p { margin-top: var(--space-sm); }
.dialog--privacy { max-height: 80vh; overflow: auto; }
.check { display: flex; align-items: center; gap: var(--space-sm); margin-top: var(--space-md); font-size: var(--text-sm); cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--color-accent); }
.dialog__actions { display: flex; justify-content: flex-end; gap: var(--space-sm); margin-top: var(--space-lg); }

@media (max-width: 72rem) {
  .editor__grid { gap: var(--space-lg); }
  .sheet-card { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 60rem) {
  .topbar__inner { flex-wrap: wrap; padding-block: var(--space-xs); }
  .save { order: 3; width: 100%; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; max-height: none; overflow: visible; }
  .product-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-md); }
  .editor__grid { grid-template-columns: minmax(0, 1fr); }
  .photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 40rem) {
  .btn__long { display: none; }
  .topbar__actions { width: 100%; }
  .topbar__actions .btn { flex: 1 1 0; min-width: 0; padding-inline: var(--space-2xs); font-size: var(--text-xs); }
  .product-list { grid-template-columns: minmax(0, 1fr); }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md); }
  .preview__bar { flex-direction: column; align-items: stretch; }
  .preview__actions { flex-wrap: wrap; }
  .btn { min-height: 44px; }
  .tool { min-height: 44px; }
}

@media (pointer: coarse) {
  .btn, .input, .tool, .slot__controls button { min-height: 44px; }
}
