/* =============================================================================
 * brush-creator-editor.css — Índice de secciones (§22.6xx.656k Sprint 5)
 * =============================================================================
 * Brush Creator dialog: 1:1 del editor de Grav, permite crear/importar packs
 * =============================================================================
 */
/* ═══════════════════════════════════════════════════════════════════ */

/* ─── Reset + body ─────────────────────────────────────────── */

/* === Brush creator page (base + hidden file input) === */

.brush-creator-page {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Source Sans Pro', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: transparent;
  color: var(--sepia, #5C4033);
  line-height: 1.5;
}
.brush-creator-page * { box-sizing: border-box; }

/* Reglas `.embedded` obsoletas — el editor YA NO es iframe (§22.6xx.61). */
.brush-creator-page.embedded {
  min-height: 0;
}
.brush-creator-page.embedded .editor-header {
  display: none;
}
/* §22.397 — hidden-file-input: belt-and-suspenders al `hidden` attribute. */
.hidden-file-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  left: -9999px !important;
  top: -9999px !important;
}

/* Visual feedback cuando un file está siendo arrastrado sobre la página. */
.brush-creator-page.dragging-files::after {
  content: 'Drop the PNG to add a stamp';
  position: fixed;
  inset: 1rem;
  border: 3px dashed var(--brass, #c85a29);
  border-radius: 12px;
  background: rgba(253, 246, 232, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cherry Swash', cursive;
  font-size: 1.8rem;
  color: var(--sepia, #5C4033);
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 4px 24px rgba(92, 51, 23, 0.25);
}
.brush-creator-page code {
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
  background: rgba(92, 51, 23, 0.10);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  color: var(--sepia, #5C4033);
}
.brush-creator-page em { font-style: italic; color: var(--sepia, #5C4033); opacity: 0.75; font-size: 0.85rem; }

/* ─── Header (mismo feel que theme-editor) ─────────────────── */

/* === Editor header + import button === */

.editor-header {
  margin: 0 0 1rem;
  padding: 0 0 0.6rem;
  border-bottom: 1px solid rgba(92, 64, 51, 0.20);
}.editor-header h1 {
  margin: 0;
  font-family: 'Cherry Swash', cursive;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brass-text, #93411c);
}
.editor-header .subtitle {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--sepia, #5C4033);
  opacity: 0.75;
  max-width: 720px;
}
.btn-import {
  font-size: 0.85rem !important;
  padding: 0.5rem 1rem !important;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}
.btn-import code {
  background: rgba(255, 255, 255, 0.15);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-family: 'Source Code Pro', monospace;
  font-size: 0.85em;
}

/* Layout — preview 380px (brush-creator tiene muchos campos, form necesita más espacio) */

/* === Layout (form pane + import pack row) === */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 380px;
  gap: 0.75rem;
}
.form-pane {
  padding: 1rem 1.25rem 2rem;
  overflow-y: visible;
  background: transparent;
  color: var(--sepia, #5C4033);
}.form-top-actions .btn-import {
  font-size: 0.8rem !important;
  padding: 0.4rem 0.85rem !important;
}
/* §22.6xx.555zz — Import .rbrush dentro de un theme-card. Hereda
   todos los estilos de .theme-card (translucent white, border sepia
   sutil, rounded 16px, shadow). Solo necesitamos customizar el row. */
.import-pack-row {
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
}
.import-pack-row .btn-import {
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
  flex-shrink: 0;
}
.import-pack-hint {
  font-size: 0.75rem;
  color: var(--sepia, #5C4033);
  opacity: 0.7;
  font-style: italic;
}

/* Cards — compactas, padding reducido. Mismo look que theme-editor. */
.card {
  background: var(--panel-cream, #FCF7EE);
  border: 1px solid rgba(92, 64, 51, 0.20);
  border-radius: 10px;
  padding: 0.75rem 1rem 0.9rem;
  margin: 0 0 0.85rem;
  box-shadow: none;
}
.card legend {
  font-family: 'Cherry Swash', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brass-text, #93411c);
  padding: 0 0.4rem;
}
.card .hint {
  margin: 0.1rem 0 0.5rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--sepia, #5C4033);
  opacity: 0.75;
  font-style: italic;
}

/* ─── Forms ────────────────────────────────────────────────── */
label { display: block; font-size: 0.78rem; color: var(--sepia, #5C4033); font-weight: 600; margin-bottom: 0.4rem; }
label > span { display: block; margin-bottom: 0.2rem; }
/* §22.6xx.39o-packs-ui-iter8 — :not(.text-field) excluye los inputs
   que ya usan la utility class unificada .text-field (definida en
   chrome.css). Sin este :not, la regla global sobrescribía los
   estilos de .text-field con especificidad (0,1,1) vs (0,1,0).
   El :not() añade especificidad (0,1,0) a la regla — pero el
   :not(.text-field) en sí añade 1 a la clase = (0,1,1) igual.
   Solución: usar :where(input:not(.text-field)) para que la
   especificidad se mantenga en (0,1,1) IGUAL a la regla original
   pero el :where() "rompe" la especificidad en (0,0,0), dando
   (0,1,0) TOTAL, que es MENOR que .text-field (0,1,0)? No, es
   igual. La solución correcta es: scoping con un contenedor
   (e.g. .brush-creator-page) o usar :not(.text-field) que SÍ añade
   especificidad. La forma más simple: usar el selector más
   específico con :not(.text-field) para que .text-field gane
   por especificidad. */
:where(input[type="text"]):not(.text-field),
:where(input[type="number"]):not(.text-field) {
  width: 100%;
  padding: 0.4rem 2rem 0.4rem 0.6rem;
  border: 1px solid rgba(92, 64, 51, 0.30);
  border-radius: 6px;
  background: #fff;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--sepia, #5C4033);
  transition: border-color 0.15s, box-shadow 0.15s;
}
:where(input[type="text"]):not(.text-field):focus,
:where(input[type="number"]):not(.text-field):focus {
  outline: none;
  border-color: var(--brass, #c85a29);
  box-shadow: 0 0 0 2px rgba(200, 90, 41, 0.20);
}

/* §22.6xx.39o-packs-ui-iter26 — El estilo hand-drawn de los <select> ahora
   es GLOBAL (chrome.css). El rule específico del brush creator se eliminó
   para evitar duplicación. La clase .text-field sigue funcionando igual
   (hereda appearance reset + bg-color cream en hover). */

/* Section header (mismo look que el workspace usa en panel-brushes.html: */

/* === Form section header + form rows === */

.form-section-header {
  font-size: 12.5px;
  line-height: 1.2;
  color: var(--sepia, #5C4033);
  font-weight: 600;
  margin: 0 0 0.4rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  opacity: 0.85;
}

/* Form row (un solo control). El grid wrapper se aplica en el HTML con */
.form-row {
  display: flex;
  flex-direction: column;
  margin: 0;
}
.form-row-full {
  grid-column: 1 / -1;
}

/* Toggle row: label a la izquierda, toggle a la derecha. Mismo patrón */

/* === Toggle row (settings on/off) === */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.15rem 0;
  cursor: pointer;
  font-size: 13px;
  color: #4a341c;
  font-weight: 500;
}
.toggle-row input[type="checkbox"] {
  /* Sobreescribe el estilo global de .checkbox (cuadradito 16x16). */
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  cursor: pointer;
}
.toggle-row:hover {
  color: var(--sepia, #5C4033);
}

/* ─── Sliders (§22.6xx.43 — unificado con workspace) ──────── */
input[type="range"] {
  width: 100%;
  height: 22px;             /* §22.6xx.43 — match con thumb 22x22 del sistema [A] */
  margin: 0.15rem 0 0.5rem;
  padding: 0;
  cursor: pointer;
  vertical-align: middle;
}
/* §22.6xx.54 — El form-row ahora es el contenedor de un control (label + */
.form-row {
  margin-bottom: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0;
}
.form-row > span:first-child {
  display: flex !important;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sepia, #5C4033);
}
.slider-help {
  display: block;
  font-style: italic;
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--sepia, #5C4033);
  opacity: 0.7;
  margin: 0.1rem 0 0.25rem;
  line-height: 1.3;
}
.slider-label .readout {
  display: inline-block;
  font-family: 'Source Code Pro', monospace;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--sepia, #5C4033);
  background: #fff;
  border: 1px solid rgba(92, 64, 51, 0.30);
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
  min-width: 3.5em;
  text-align: right;
}
.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--sepia, #5C4033);
  background: transparent;
  border: none;
  padding: 0;
}
.checkbox-label > input {
  margin-right: 0.4rem;
  accent-color: var(--brass, #c85a29);
}.btn-export {
  margin-top: 0.5rem;
  font-size: 1rem !important;
  padding: 0.7rem 1.4rem !important;
}
.btn-xs { font-size: 0.75rem !important; padding: 0.3rem 0.6rem !important; }
/* §22.6xx.555zs — 3 bloques unificados con estilo export-tab-tile
   centrado (icono arriba, título, descripción). Mismo patrón visual
   que las opciones Portrait/Landscape del dialog de crear cuaderno. */
.stamps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 0.85rem;
  margin: 0.4rem 0 0.6rem;
}
@media (max-width: 720px) {
  .stamps-grid { grid-template-columns: minmax(0, 1fr); }
}
.stamp-tile {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  gap: 0.85rem;
  padding: 0.95rem 0.9rem;
  height: 100%;
  min-height: 130px;
  border: none;
  border-radius: 0.85rem;
  background: transparent;
  cursor: pointer;
  transition:
    transform 140ms cubic-bezier(0.2, 0, 0, 1);
  outline: none;
  user-select: none;
  width: 100%;
  font-family: inherit;
  color: inherit;
  overflow: hidden;
}
/* §22.6xx.39o-packs-ui-iter23 — Hand-drawn border via ::before */
.stamp-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  border: 2px solid rgba(92, 64, 51, 0.25);
  border-radius: inherit;
  filter: url(#hand-drawn-filter);
  pointer-events: none;
  transition: border-color 180ms cubic-bezier(0.2, 0, 0, 1);
}
.stamp-tile:hover::before {
  border-color: rgba(92, 64, 51, 0.45);
}
.stamp-tile:focus-visible::before {
  border-color: var(--brass, #c85a29);
}
.stamp-tile:hover {
  transform: translateY(-1px);
}
.stamp-tile:focus-visible {
  outline: none;
}
.stamp-tile-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.7rem;
  color: var(--brass-text, #93411c);
  background: linear-gradient(135deg, rgba(200, 90, 41, 0.18) 0%, color-mix(in srgb, var(--brass) 12%, transparent) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  align-self: flex-start;
}
.stamp-tile-icon i {
  font-size: 1.35rem;
  line-height: 1;
}
/* §22.6xx.658dr.701 — Los iconos de las tres tiles pasaron de <svg> inline a
   iconos del sistema rp. `.rp-icon` se dimensiona con width/height, NO con
   font-size, así que la regla de arriba no los afecta: el glifo salía a
   1.70rem (su valor por defecto) dentro de una caja de 2.75rem y se veía
   más grande que los 1.5rem que ocupaba el <svg> al que sustituye.
   Descendiente (0,2,0) para ganarle a `.rp-icon`. */
.stamp-tile-icon .rp-icon {
  width: 1.5rem;
  height: 1.5rem;
}
.stamp-tile-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  min-width: 0;
  flex: 1 1 0;
}
.stamp-tile-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'Cherry Swash', cursive;
  color: var(--brass-text, #93411c);
  line-height: 1.2;
  width: 100%;
}
.stamp-tile-desc {
  margin: 0;
  font-size: 0.7rem;
  color: rgba(92, 64, 51, 0.65);
  line-height: 1.3;
  width: 100%;
  margin-bottom: 0.15rem;
}
.stamp-tile-btn {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: 0.45rem;
  pointer-events: none;
}

/* Bloque 1: drop area. Sin background (lo provee el .stamp-tile base = transparent).
   §22.6xx.39o-packs-ui-iter24 — Quitado el background rayado. La pista de
   "drop here" se comunica solo con el icono + texto del label.
   El hand-drawn border via ::before sigue presente. */
.stamp-tile--drop {
  background: transparent;
}
.stamp-tile--drop.is-dragover {
  transform: scale(1.01);
}
.stamp-tile--drop.is-dragover::before {
  border-color: var(--brass, #c85a29);
}

.stamp-drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.4rem;
  margin: 0 0 0.6rem;
  background: var(--panel-cream, #FCF7EE);
  border: 1.5px dashed rgba(92, 64, 51, 0.30);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--sepia, #5C4033);
  text-align: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  cursor: copy;
  user-select: none;
}
.stamp-drop-zone:hover {
  background: #f5e9ce;
  border-color: var(--sepia, #5C4033);
  color: var(--sepia, #5C4033);
}
.stamp-drop-zone.is-dragover {
  background: rgba(252, 247, 238, 0.7);
  border-color: var(--sepia, #5C4033);
  border-style: solid;
  color: var(--sepia, #5C4033);
}.stamp-drop-zone:hover .stamp-drop-icon,
.stamp-drop-zone.is-dragover .stamp-drop-icon {
  color: var(--sepia, #5C4033);
}/* §22.6xx.39o-packs-ui-iter20 — .stamp-tab como tile con hand-drawn border
   en TODOS los estados (idle, hover, is-active). Mismo patrón que
   .desk-light .brush-item (utilities.css:656) y .theme-card::before. */
.stamp-tab {
  position: relative;
  display: flex;
  align-items: center;
  border: none;
  border-radius: 6px;
  background: #fff;
  transition: background 0.15s;
  flex-shrink: 0;
  overflow: hidden;
}
.stamp-tab::before {
  content: "";
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  border: 2px solid rgba(92, 64, 51, 0.25);
  border-radius: inherit;
  filter: url(#hand-drawn-filter);
  pointer-events: none;
  transition: border-color 0.15s;
}
.stamp-tab:hover::before {
  border-color: rgba(92, 64, 51, 0.45);
}
.stamp-tab.is-active::before {
  border-color: var(--brass, #c85a29);
}
.stamp-tab:hover { background: rgba(252, 247, 238, 0.7); }
.stamp-tab.is-active {
  background: rgba(252, 247, 238, 0.7);
  box-shadow: none;
}
.stamp-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem 0.3rem 0.4rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  min-width: 0;
  color: var(--sepia, #5C4033);
  font-size: 0.78rem;
}
.stamp-tab-btn canvas {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 1px solid rgba(92, 64, 51, 0.30);
  border-radius: 4px;
  background-color: #f0e8d0;
  display: block;
}.stamp-tab-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sepia, #5C4033);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stamp-tab-id {
  font-family: 'Source Code Pro', monospace;
  font-size: 0.6rem;
  color: var(--sepia, #5C4033);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
  text-align: left;
  unicode-bidi: plaintext;
}
.stamp-tab-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  padding: 0;
  background: rgba(179, 90, 63, 0.85);
  color: var(--brass-text, #93411c);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.65rem;
  line-height: 1;
  display: none;
  font-family: inherit;
  align-items: center;
  justify-content: center;
}
.stamp-tab-remove .rp-icon {
  width: 0.65rem;
  height: 0.65rem;
}
.stamp-tab:hover .stamp-tab-remove,
.stamp-tab.is-active .stamp-tab-remove { display: flex; }
.stamp-tab-remove:hover { background: var(--brass-dark, #a0451c); }

.brushes-workspace {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 1rem;
  align-items: start;
}
/* §22.6xx.658dr.702 — El grid reserva 210px para el sidebar de stamps AUNQUE
   esté oculto, así que el estado vacío de pinceles no se centraba en la
   tarjeta: quedaba arrinconado a la derecha de un hueco vacío. Cuando no hay
   brushes no hay sidebar, así que el grid se queda con una columna y el texto
   ocupa la tarjeta entera.
   `:not(:has(...))` en vez de una clase que pone el JS: el sidebar ya es la
   fuente de verdad de si hay dos columnas o una, y duplicar ese estado en una
   clase sería un sitio más donde desincronizarse. `:has()` ya se usa en
   chrome.css:1049. */
.brushes-workspace:not(:has(.stamps-sidebar:not([hidden]))) {
  grid-template-columns: 1fr;
}

/* §22.6xx.555zz — Estilo consistente con el workspace: theme-card
   (translucent white + border sepia sutil + rounded 16px). Antes tenía
   border dorado de 2px (#c5a059) que no matcheaba el resto del workspace.
   §22.6xx.39o-packs-ui-iter20 — Quitar border y hover: el sidebar ya no
   necesita caja propia porque los .stamp-tab internos son tiles con
   border hand-drawn. */
.stamps-sidebar {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.25rem 0.1rem;
  box-shadow: none;
  color: var(--sepia, #5C4033);
}
.stamps-sidebar[hidden] { display: none; }
.stamps-sidebar:hover,
.stamps-sidebar.paper-light:hover {
  background-color: transparent;
  background-image: none;
}
.stamps-sidebar-label {
  font-family: 'Cherry Swash', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brass-text, #93411c);
  margin: 0 0 0.4rem;
  text-align: center;
  border-bottom: none;
  padding-bottom: 0;
}
.stamps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
/* §22.6xx.39o-packs-ui-iter20 — El li no necesita border/background: el
   .stamp-tab interno ya es el tile con hand-drawn border. */
.stamps-list li {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}
.stamp-tab.is-active {
  background: rgba(200, 90, 41, 0.10);
}
@media (max-width: 720px) {
  .brushes-workspace {
    grid-template-columns: 1fr;
  }
  .stamps-sidebar {
    position: static;
    max-height: none;
  }
}

/* §22.6xx.555zz — Estilo consistente con el workspace: theme-card
   (translucent white + border sepia sutil + rounded 16px). Antes tenía
   border dorado de 2px (#c5a059) que no matcheaba el resto del workspace. */
.brush-form-area {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  overflow: visible;
}

/* §22.6xx.39o-packs-ui-iter20 — Override paper-light en .brush-form:
   sin border, sin hover (los form-groups internos ya son theme cards con
   hand-drawn border — el border extra es ruido). */
.brush-form,
.brush-form:hover {
  border: none;
  background-color: transparent;
  background-image: none;
}

/* "Editing: <name>" header — visible cue del brush activo
   §22.6xx.39o-packs-ui-iter21 — theme-card: sin background, sin border
   regular (hand-drawn via theme-card::before), sin hover.
   §22.6xx.39o-packs-ui-iter27 — justify-content: space-between: texto
   a la izquierda, botón a la derecha. */
.brush-form-header {
  display: flex;
  flex-direction: row;  /* override theme-card's flex-direction: column */
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.75rem;
}
.brush-form-header[hidden] { display: none; }
.brush-preview-header[hidden] { display: none; }
/* §22.6xx.39o-packs-ui-iter27 — El botón usa .btn-wood .btn-wood-danger
   estándar (chrome.css:4314, 4440). Sin overrides visuales — hereda
   todo el styling wood (background, border-radius, box-shadow, padding,
   font-size, etc.). Solo se ajusta el tamaño para el header compacto. */
.brush-form-header > #btn-remove-active {
  font-size: 0.72rem !important;
  padding: 0.35rem 0.7rem !important;
  gap: 0.3rem !important;
}
.form-header-text {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  min-width: 0;
}
.form-header-label {
  font-family: 'Cherry Swash', cursive;
  font-size: 0.85rem;
  color: var(--brass-text, #93411c);
  font-weight: 700;
}
.form-header-name {
  font-family: 'Cherry Swash', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--sepia, #5C4033);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Flash animation cuando el form se re-renderiza (al cambiar de tab). */
@keyframes brush-form-flash {
  0%   { background: rgba(197, 160, 89, 0.25); }
  100% { background: transparent; }
}
.brush-form.flash {
  animation: brush-form-flash 0.5s ease-out;
}
@keyframes brush-header-flash {
  0%   { background: rgba(197, 160, 89, 0.35); }
  100% { background: transparent; }
}
.brush-form-header.flash {
  animation: brush-header-flash 0.5s ease-out;
}
/* §22.6xx.658dr.701 — Roberto: fuera el wrapper. El estado vacío ya no es
   una caja clara con borde discontinuo dentro del card, solo el texto
   centrado. Se quedan el centrado, el aire y el color del título. */
.form-empty {
  margin: 0;
  text-align: center;
  color: var(--sepia, #5C4033);
  font-size: 0.85rem;
  line-height: 1.45;
  padding: 1.5rem 1rem;
}
.form-empty[hidden] { display: none; }
.form-empty strong {
  display: block;
  color: var(--brass-text, #93411c);
  font-family: 'Cherry Swash', cursive;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
/* §22.6xx.54 — `.form-section` y `.brush-form-content` (estilos viejos) ELIMINADOS. */

/* Export bar */
.export-bar { background: var(--panel-cream, #FCF7EE); }.components-summary {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.components-summary li {
  background: #fff;
  border: 1.5px solid rgba(92, 64, 51, 0.30);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  color: #4a341c;
}
.export-status {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  min-height: 1.2em;
}
.export-status.success { color: #2e7d32; font-weight: 600; }
.export-status.error { color: #c62828; font-weight: 600; }

/* Preview pane — sticky 100vh, padding compacto. */
.preview-pane {
  padding: 1rem 1.1rem;
  background: var(--panel-cream, #FCF7EE);
  border-left: 2px solid var(--brass, #c85a29);
  border-radius: 0 12px 12px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.preview-pane h2 {
  margin: 0 0 0.2rem;
  font-family: 'Source Code Pro', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sepia, #5C4033);
  flex-shrink: 0;
}
.preview-pane .hint {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--sepia, #5C4033);
  flex-shrink: 0;
}
.preview-stage {
  background: transparent;
  border: none;
  box-shadow: none;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.brush-preview-empty {
  padding: 0.5rem 0.75rem 0.75rem;
  color: var(--sepia, #5C4033);
  font-size: 0.78rem;
  font-style: italic;
}
.brush-preview-empty[hidden] { display: none; }
.brush-preview-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid rgba(92, 64, 51, 0.12);
  flex-shrink: 0;
  background: transparent;
  font-family: 'Cherry Swash', cursive;
  font-size: 0.95rem;
  color: var(--brass-text, #93411c);
  font-weight: 700;
}
.preview-brush-thumb {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 1px solid rgba(92, 64, 51, 0.30);
  border-radius: 4px;
  background-color: #f0e8d0;
  display: block;
}
.brush-preview-header strong {
  color: var(--brass-text, #93411c);
  font-size: 0.95rem;
  font-family: 'Cherry Swash', cursive;
  font-weight: 700;
  font-weight: 700;
}
/* Test canvas + hover (overlaid) — v: §22.6xx.62 */
.brush-preview-wrap {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.brush-test-wrap {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}.brush-test-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 400;
}
.size-slider-label {
  display: inline-flex !important;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--sepia, #5C4033);
  margin: 0 !important;
}
.size-slider-label input[type="range"] {
  width: 90px;
  height: 22px;            /* §22.6xx.43 — match con thumb 22x22 del sistema [A] */
  margin: 0;
}
.size-slider-label .size-readout {
  font-family: 'Source Code Pro', monospace;
  color: var(--sepia, #5C4033);
  font-weight: 600;
  min-width: 2em;
  text-align: right;
}
.brush-test-box {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  border: none;
  border-radius: 0;
  background-color: #f0e8d0;
  background-image: linear-gradient(45deg, #e0d4b8 25%, transparent 25%),
                    linear-gradient(-45deg, #e0d4b8 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #e0d4b8 75%),
                    linear-gradient(-45deg, transparent 75%, #e0d4b8 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  cursor: crosshair;
  overflow: hidden;
}
.brush-test-box canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#brush-test-canvas { z-index: 1; }
/* §22.392 — El hover canvas se redimensiona al contour size (e.g. 84x84) */
#brush-hover-canvas {
  z-index: 2;
  pointer-events: none;
  width: auto;
  height: auto;
  transform: translate(-50%, -50%);
  will-change: left, top;
}
.hint.mono {
  font-size: 0.75rem;
  color: var(--sepia, #5C4033);
  margin: 0.4rem 0 0;
}
.hint.mono strong { color: var(--sepia, #5C4033); }

/* Responsive (preview pane goes below on narrow screens) */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .preview-pane { border-left: none; border-top: 2px solid var(--brass, #c85a29); }
}

/* ═══════════════════════════════════════════════════════════════════ */
.btn-create-stamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  margin-left: 8px;
  /* Hereda de .btn-wood (Cherry Swash + sepia tokens) */
}

.create-stamp-dialog {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cherry Swash', 'Georgia', serif;
}

.create-stamp-dialog[hidden] {
  display: none;
}

.create-stamp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(40, 25, 15, 0.55);
  backdrop-filter: blur(2px);
}

.create-stamp-panel {
  position: relative;
  background: #fbf3e0;
  /* Tono crema del workspace */
  border: 2px solid var(--brass, #c85a29);
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  width: min(880px, 92vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.create-stamp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1.5px solid var(--brass, #c85a29);
  background: linear-gradient(to bottom, #f5e7c4, #fbf3e0);
}

.create-stamp-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--sepia, #5C4033);
  font-family: 'Cherry Swash', 'Georgia', serif;
  /* §22.6xx.outline-title — outline `#F4D58D` (4 lados) para coherencia
     con `.floating-panel-title` (cabecera de dialogs/windows). */
  text-shadow:
    -1px -1px 0 #F4D58D,
     1px -1px 0 #F4D58D,
    -1px  1px 0 #F4D58D,
     1px  1px 0 #F4D58D;
}

.create-stamp-close {
  background: transparent;
  border: none;
  color: var(--sepia, #5C4033);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 120ms ease-out;
}
.create-stamp-close:hover { background: rgba(92, 51, 23, 0.1); }

.create-stamp-body {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 16px;
  padding: 16px;
  flex: 1;
  min-height: 0;
}

.create-stamp-canvas-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1.5px solid rgba(92, 64, 51, 0.30);
  border-radius: 6px;
  overflow: hidden;
  min-height: 0;
  position: relative;
}

.create-stamp-canvas-wrap canvas {
  /* El canvas es 500x500 px en bitmap. El CSS lo escala al tamaño del */
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: crosshair;
  /* touch-action: none para evitar scroll/zoom en stylus/pointer */
  touch-action: none;
}

.create-stamp-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
  overflow-y: auto;
}

.create-stamp-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.create-stamp-pressure .checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: var(--sepia, #5C4033);
  cursor: pointer;
}
.create-stamp-pressure input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--brass, #c85a29);
}
.create-stamp-hint {
  font-size: 0.78rem;
  color: var(--sepia, #5C4033);
  margin: 4px 0 0;
  line-height: 1.3;
}

.create-stamp-control > label {
  font-size: 12px;
  color: var(--sepia, #5C4033);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.create-stamp-control input[type="range"] {
  /* §22.6xx.43 — hereda el look del sistema [A] global (track + thumb + fill). */
  width: 100%;
}

.create-stamp-value {
  font-size: 11px;
  color: var(--sepia, #5C4033);
  font-family: 'Georgia', serif;
  text-align: right;
}

.create-stamp-mode-buttons {
  display: flex;
  gap: 4px;
}

.create-stamp-mode-buttons .btn-wood {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  font-size: 11px;
}

.create-stamp-mode-buttons .btn-wood.is-active {
  background: var(--brass, #c85a29);
  color: #fff;
}

.create-stamp-clear {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 4px;
  font-size: 11px;
}

.create-stamp-hint {
  font-size: 10.5px;
  line-height: 1.35;
  color: #7a5a3a;
  margin: 4px 0 0;
  font-family: 'Georgia', serif;
  font-style: italic;
}

.create-stamp-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1.5px solid var(--brass, #c85a29);
  background: linear-gradient(to top, #f5e7c4, #fbf3e0);
}

.create-stamp-cancel,
.create-stamp-create {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
}

.create-stamp-create {
  background: var(--sepia, #5C4033);
  color: #fbf3e0;
  border-color: var(--sepia, #5C4033);
}
.create-stamp-create:hover {
  background: #4a2a12;
}

@media (max-width: 700px) {
  .create-stamp-body {
    grid-template-columns: 1fr;
  }
  .create-stamp-canvas-wrap {
    min-height: 320px;
  }
}

/* ─── §22.710 — Form groups: jerarquía visual del formulario ──────── */
.brush-form-content {
  display: flex;
  flex-direction: column;
}
.form-group {
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.85rem;
}
.form-group:last-child {
  margin-bottom: 0;
}

/* Section header reescalado: ahora en Cherry Swash (la fuente de títulos */
.form-section-header {
  font-family: 'Cherry Swash', cursive;
  font-size: 1.05rem;
  line-height: 1.2;
  color: var(--brass-text, #93411c);
  font-weight: 700;
  margin: 0 0 0.1rem;
  letter-spacing: 0.01em;
  text-transform: none;
  opacity: 1;
}

/* Subtítulo del grupo: una línea en sepia/70 que dice el QUÉ del grupo */
.form-section-sub {
  margin: 0 0 0.7rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: rgba(74, 52, 28, 0.7);
  font-style: italic;
}

/* Grid de 2 columnas para sliders que van en pareja (tip/stroke/pressure */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 0.85rem;
  row-gap: 0.5rem;
}
@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Toggles agrupados: un solo bloque coherente con borde sutil y */
.form-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-top: 0.55rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(92, 51, 23, 0.1);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.45);
}

/* Form row: el contenedor de un control individual. El label con readout */
.form-row {
  display: flex;
  flex-direction: column;
  margin: 0 0 0.4rem;
}
.form-row:last-child {
  margin-bottom: 0;
}
.form-row__label {
  display: flex !important;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 13px;
  font-weight: 600;
  color: #4a341c;
  margin: 0;
}
.form-row__label .readout {
  font-family: 'Source Code Pro', monospace;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--brass-text, #93411c);
  background: rgba(184, 105, 74, 0.08);
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  min-inline-size: 2.2rem;
  text-align: end;
}

/* Compact: el primer .form-row dentro de .form-toggles se ve muy pegado */
.form-toggles .form-row,
.form-toggles .toggle-row {
  margin: 0;
  padding: 0.15rem 0;
}

/* §22.6xx.450.4.6 — OVERRIDES para que el dialog del workspace tenga */

.brush-creator-page {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* §22.6xx.webp-unified — La interface texture cubre todo el ancho del
   header de ESTE dialog. La base global usa `background-size: 1100px
   300px` (tamaño nativo de la textura del theme) con `no-repeat`
   centrado, lo que funciona en los panels estrecha pero deja bandas
   de 90px sin textura a cada lado aquí, donde el dialog llega a
   1280px. `cover` escala la textura proporcionalmente hasta cubrir
   toda el área, conservando el aspect ratio y el encuadre vertical
   central. Se aplica también al `::after` (la franja de sombra del
   borde inferior), que tenía el mismo ancho fijo. */
.brush-creator-page .floating-panel-header,
.brush-creator-page .floating-panel-header::after {
  background-size: cover !important;
}

.brush-creator-page .layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
}

.brush-creator-page .form-pane {
  overflow-y: auto;
  min-height: 0;
  /* §22.6xx.658dr.131 — Sin scrollbar propio: la barra la pone la regla única
     de widgets.css (sección K). Antes aquí había un `scrollbar-color` gris que
     en Chromium, al tener prioridad sobre los pseudo-elementos, sustituía al
     estilo global solo en este panel. */
  overscroll-behavior: contain;
}

.brush-creator-page .preview-pane {
  display: flex;
  flex-direction: column;
  /* §22.6xx.450.9 — preview-pane sin overflow propio. El preview-stage */
  /* §22.6xx.658dr.131 — Scrollbar unificada (widgets.css sección K). */
  overscroll-behavior: contain;
  /* §22.6xx.450.6 — Preview-pane más estrecho (340px). Sin border-left */
  border-left: 1px solid rgba(92, 64, 51, 0.12);
  padding: 0.75rem 1rem !important;
  background: transparent !important;
  overflow: visible;
  /* §22.6xx.450.9 — Sobrescribir `height: 100vh` de la regla .preview-pane */
  height: auto !important;
  /* §22.6xx.450.10 — `position: sticky` viene de la regla .preview-pane */
  position: static !important;
  top: auto !important;
  align-self: auto !important;
}

.brush-creator-page .brush-test-box {
  height: 180px;
  flex: 0 0 auto;
}

/* §22.6xx.450.11 — Adaptar la zona de configuración del brush al diseño */

/* 1) .form-group como theme-card. Sin background ni border regular — */
/* el hand-drawn border lo pone la clase .theme-card via ::before. */
.brush-creator-page .form-group {
  padding: 1rem 1.1rem 0.9rem;
  margin: 0 0 0.85rem;
  padding-block: 0;
  border-top: 0;
}
.brush-creator-page .form-group:first-child {
  margin-top: 0.25rem;
}
.brush-creator-page .form-group:last-child {
  margin-bottom: 0.25rem;
}

/* El header ya tiene Cherry Swash brass (§22.710). Le añadimos un poco */
.brush-creator-page .form-section-header {
  padding-top: 0.85rem;
  margin-bottom: 0.15rem;
}

/* 2) .form-toggles: grid 2-cols con gap (mismo patrón que */
.brush-creator-page .form-toggles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem 0.85rem;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(92, 64, 51, 0.08);
}
@media (max-width: 480px) {
  .brush-creator-page .form-toggles {
    grid-template-columns: 1fr;
  }
}

/* 3) Toggle brass-pommel — réplica de widgets.css sin scope .desk-light. */
.brush-creator-page .toggle {
  --handleoffset: 0.25rem;
  appearance: none !important;
  -webkit-appearance: none !important;
  position: relative;
  display: inline-block !important;
  flex-shrink: 0;
  cursor: pointer;
  width: 44px !important;
  height: 24px !important;
  min-width: 44px;
  min-height: 24px;
  border-radius: 999px;
  border: 0;
  margin: 0 !important;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.30), rgba(0, 0, 0, 0) 50%),
    var(--desk-oak, #8B5A2B);
  box-shadow:
    inset 0 2px 3px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
  transition: background-color 200ms ease, box-shadow 200ms ease;
  vertical-align: middle;
}
.brush-creator-page .toggle:focus-visible {
  outline: none;
  box-shadow:
    inset 0 2px 3px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    0 0 0 3px var(--brass-light, #e5a085);
}
.brush-creator-page .toggle::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fbe1cf 0%, var(--brass, #c85a29) 40%, var(--brass-dark, #a0451c) 95%);
  box-shadow:
    inset -1px -2px 2px rgba(0, 0, 0, 0.40),
    inset 1px 1px 1px rgba(255, 255, 255, 0.50),
    0 1px 2px rgba(0, 0, 0, 0.40);
  transition: transform 200ms ease, background 200ms ease;
}
.brush-creator-page .toggle:checked,
.brush-creator-page .toggle.toggle-primary:checked {
  background:
    linear-gradient(180deg, rgba(120, 50, 30, 0.35), rgba(0, 0, 0, 0) 50%),
    var(--robin, #C85A29);
}
.brush-creator-page .toggle:checked::before,
.brush-creator-page .toggle.toggle-primary:checked::before {
  transform: translateX(20px);
  background:
    radial-gradient(circle at 35% 30%, #FFFFFF 0%, #FFE6D6 50%, var(--parchment, #FCF7EE) 100%);
}
/* Tamaño pequeño (sm) — 36x20 con handle 16x16 */
.brush-creator-page .toggle.toggle-sm {
  width: 36px !important;
  height: 20px !important;
  min-width: 36px;
  min-height: 20px;
}
.brush-creator-page .toggle.toggle-sm::before {
  width: 16px;
  height: 16px;
}
.brush-creator-page .toggle.toggle-sm:checked::before,
.brush-creator-page .toggle.toggle-sm.toggle-primary:checked::before {
  transform: translateX(16px);
}

/* El .toggle-row (label + toggle) ya tiene display:flex + justify-content */
.brush-creator-page .form-toggles .toggle-row {
  padding: 0.1rem 0;
  border-bottom: 0;
  font-size: 12.5px;
  color: var(--sepia, #5C4033);
}

/* Quitar min-height: 100vh del .layout (regla original de Grav) */

/* ═══════════════════════════════════════════════════════════════════ */
