/* Componentes propios del cuaderno. */

/* ---------- Botones ---------- */
.label-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--radius-label);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-ui) ease;
}
.label-btn::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px dashed rgb(255 249 237 / 0.45);
  border-radius: 4px;
  pointer-events: none;
}
.label-btn:active { transform: scale(0.97); }
.label-btn svg { width: 18px; height: 18px; }
.label-btn--soft { background: var(--paper-shade); color: var(--ink); }
.label-btn--soft::before { border-color: color-mix(in srgb, var(--ink) 25%, transparent); }
.label-btn--rose { background: var(--danger); }
.label-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.is-history-disabled[disabled] { opacity: 0.5; cursor: not-allowed; }

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 4px;
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-color: var(--ink-faint);
  text-underline-offset: 4px;
}
.text-btn svg { width: 18px; height: 18px; }
@media (hover: hover) and (pointer: fine) { .text-btn:hover { color: var(--ink); text-decoration-color: var(--ink-soft); } }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--ink-soft);
  transition: background-color var(--dur-ui) ease, color var(--dur-ui) ease;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn--sm { width: 36px; height: 36px; }
.icon-btn--sm svg { width: 18px; height: 18px; }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); } }
.icon-btn:active { transform: scale(0.94); }

/* ---------- Encabezados de sección ---------- */
.section { display: grid; gap: var(--s-3); }
.section + .section { margin-top: var(--s-6); }
.section__title { font-family: var(--font-text); font-style: italic; font-size: var(--fs-lg); line-height: 1.3; }
.section__hint { font-size: var(--fs-sm); color: var(--ink-soft); }

.stitch-rule {
  border: 0;
  height: 0;
  margin: var(--s-6) 0;
  border-top: 1.5px dashed var(--rule-strong);
}

/* ---------- Guardado ---------- */
/* “guardando… → guardado ✓” (DA3): solo opacidad; el texto cambia sin fundido entre estados visibles. */
.saved-note {
  display: inline-flex;
  align-items: center;
  gap: 2px 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-family: var(--font-hand);
  font-size: 1.45rem;
  line-height: 1.1;
  color: var(--ink-soft);
  opacity: 0;
  transition: opacity var(--dur-ui) var(--ease-out);
  white-space: nowrap;
}
.saved-note[data-state='saving'], .saved-note[data-state='saved'], .saved-note[data-state='failed'] { opacity: 1; }
.saved-note[data-state='saved'] { color: var(--thread-done-text); }
.saved-note__face { display: inline-flex; align-items: center; gap: 4px; }
.saved-note__glyph:empty { display: none; }
.saved-note__glyph svg { width: 16px; height: 16px; stroke-width: 2.25; }
.saved-note[data-state='saving'] .saved-note__glyph { color: var(--thread-later-text); }
/* El aviso de fallo es más largo: baja a su propio renglón para no apretar el saludo ni el título. */
.saved-note[data-state='failed'] {
  position: relative;
  z-index: 6; /* Sobre .sticker-layer (5): el aviso no queda debajo de una imagen. */
  background: var(--paper);
  flex: 1 1 100%;
  order: 1;
  justify-content: flex-start;
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  line-height: 1.4;
  white-space: normal;
  text-align: start;
}
:is(.day-head__top, .free-head, .saved-row, .sticker-tools):has(> .saved-note[data-state='failed']) { flex-wrap: wrap; }
/* En una página el indicador vive junto al menú: con el aviso, la cabecera entera le deja un renglón. */
.free-head:has(> .free-head__right > .saved-note[data-state='failed']) { flex-wrap: wrap; }
.free-head__right:has(> .saved-note[data-state='failed']) { display: contents; }
.saved-note[data-state='failed'] .saved-note__face { flex-basis: 100%; align-items: flex-start; }
.saved-note[data-state='failed'] .saved-note__text { max-width: 52ch; }
.saved-note[data-state='failed'] .saved-note__glyph svg { width: 14px; height: 14px; stroke-width: 1.75; margin-top: 2px; }
.saved-note__action { padding: 2px 4px; font-size: var(--fs-xs); }
.saved-note__action svg { width: 14px; height: 14px; }
.saved-note--twin { margin-inline-start: auto; }
[data-motion='reducidas'] .saved-note { transition: none; }
.saved-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }

/* Emociones libres: un hilo con palabra y una herramienta de escritura discreta. */
.feelings { display: grid; gap: var(--s-2); min-width: 0; }
.feelings__list { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.feeling-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 2px 4px 2px 9px; border: 1px solid var(--rule-strong); border-radius: var(--radius-label); background: var(--paper); color: var(--ink); }
/* Parche de una emoción (D49): fondo del color de la emoción, aro de puntadas y el dibujito en papel. */
.feeling-patch-wrap { display: inline-block; flex: none; width: 18px; height: 18px; line-height: 0; }
.feeling-patch { display: block; width: 100%; height: 100%; overflow: visible; }
.feeling-patch__bg { fill: var(--feeling-color, var(--ink-soft)); stroke: color-mix(in srgb, var(--feeling-color, var(--ink-soft)) 72%, var(--ink)); stroke-width: 1; }
.feeling-patch__ring { fill: none; stroke: var(--paper); stroke-width: 0.9; stroke-dasharray: 1.6 1.5; opacity: 0.75; }
.feeling-patch__glyph { fill: none; stroke: var(--paper); stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.feeling-patch__glyph .fill, .feeling-patch__glyph.is-star { fill: var(--paper); }
.feeling-patch__glyph.is-star { stroke-width: 1.2; }
.feeling-chip__remove { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; }
.feeling-chip__remove svg { width: 14px; height: 14px; }
.feeling-chip__remove:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.feelings__entry { display: flex; align-items: end; gap: var(--s-2); min-width: 0; }
.feelings__input { min-width: 0; flex: 1; }
.feelings__suggestions { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.feelings__suggestions:empty { display: none; }
.feelings__suggestion { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px 3px 4px; border: 1px dashed var(--rule-strong); border-radius: var(--radius-label); color: var(--ink-soft); font-family: var(--font-text); font-style: italic; font-size: var(--fs-xs); }
.feelings__suggestion .feeling-patch-wrap { width: 15px; height: 15px; }
.feelings__suggestion:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.feeling-mark { display: inline-flex; align-items: center; gap: 5px; min-width: 0; color: var(--ink); font-size: var(--fs-xs); overflow-wrap: anywhere; }

/* ---------- Casilla de punto cruz ---------- */
.rolling-value { position: relative; display: inline-block; overflow: hidden; vertical-align: bottom; font-variant-numeric: tabular-nums; }
.rolling-value__current { display: block; }
.rolling-value__old { position: absolute; inset: 0; pointer-events: none; }
.cal-mode { position: relative; display: inline-grid; grid-template-columns: repeat(2, 1fr); gap: 0; isolation: isolate; padding: 3px; background: var(--paper-shade); border-radius: var(--radius-label); }
.cal-mode__marker { position: absolute; z-index: -1; left: 3px; top: 3px; bottom: 3px; width: calc(50% - 3px); background: color-mix(in srgb, var(--butter) 50%, var(--paper)); border: 1px dashed var(--ink-faint); border-radius: 4px; pointer-events: none; }
.cal-mode .choice { background: transparent; border-color: transparent; min-height: 44px; }
.cal-mode .choice[aria-pressed='true'] { background: transparent; border-color: transparent; color: var(--ink); }
.adaptive-stepper { display: inline-flex; align-items: center; gap: var(--s-1); padding: 3px; background: var(--paper-shade); border-radius: var(--radius-label); }
.adaptive-stepper .input--num { width: 4.5rem; text-align: center; background: var(--paper); font-variant-numeric: tabular-nums; }
.adaptive-stepper .icon-btn { color: var(--ink); }
.adaptive-stepper .icon-btn:disabled { opacity: .4; cursor: default; }
.color-selector { display: flex; flex-wrap: wrap; gap: var(--s-2); flex-basis: 100%; grid-column: 1 / -1; padding-block: var(--s-2); }
.color-selector__choice { position: relative; display: grid; justify-items: center; gap: 4px; width: 68px; padding: 4px; font-family: var(--font-ui); font-size: var(--fs-xs); text-align: center; cursor: pointer; }
.color-selector__swatch { display: block; width: 30px; height: 30px; border: 1px solid var(--ink-faint); border-radius: 50%; transition: transform var(--dur-press) var(--ease-out); }
.color-selector input:checked + .color-selector__swatch { outline: 2px solid var(--ink); outline-offset: 3px; transform: scale(calc(1 + .06 * var(--move))); }
.color-selector input:focus-visible + .color-selector__swatch { outline: 3px solid var(--focus); outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) { .color-selector__swatch { transition: none; transform: none !important; } }
.sortable-list { list-style: none; padding: 0; margin: var(--s-3) 0; }
.sortable-list li { display: flex; align-items: center; gap: var(--s-1); border-bottom: 1px dashed var(--rule); }
.sortable-list__handle { flex: 1; min-width: 0; justify-content: flex-start; text-align: left; cursor: grab; }
.sortable-list .icon-btn svg { transform: rotate(90deg); }
.paper-folder { margin: var(--s-6) 0; }
.paper-folder__cover { position: relative; display: grid; gap: var(--s-1); padding: 46px var(--s-4) var(--s-3); min-height: 112px; cursor: pointer; list-style: none; isolation: isolate; }
.paper-folder__cover::-webkit-details-marker { display: none; }
.paper-folder__cover::after { content: ''; position: absolute; z-index: -1; inset: 32px 0 0; background: color-mix(in srgb, var(--lavender) 40%, var(--paper)); border: 1px dashed var(--ink-faint); border-radius: 4px 12px 4px 4px; box-shadow: var(--shadow-note); }
.paper-folder__fan { position: absolute; inset: 0 12px auto; height: 70px; z-index: -2; pointer-events: none; }
.paper-folder__peek { position: absolute; left: calc(12% + var(--peek-index) * 22%); top: 0; width: 40%; height: 75px; overflow: hidden; padding: 8px; border-radius: 2px; background: var(--sage); color: var(--ink); font-family: var(--font-hand); font-size: var(--fs-md); transform: rotate(calc((var(--peek-index) - 1) * 5deg * var(--move))); transition: transform var(--dur-ui) var(--ease-out); }
.paper-folder__peek:nth-child(2) { background: var(--butter); }
.paper-folder__peek:nth-child(3) { background: var(--blush); }
.paper-folder[open] .paper-folder__peek { transform: translateY(calc(-6px * var(--move))) rotate(calc((var(--peek-index) - 1) * 8deg * var(--move))); }
.paper-folder__title { font-family: var(--font-text); font-size: var(--fs-lg); }
.paper-folder__hint { font-family: var(--font-ui); font-size: var(--fs-xs); color: var(--ink-soft); }
.paper-folder[open] .paper-folder__hint { visibility: hidden; }
.paper-folder__body { padding: var(--s-2) var(--s-3); border-inline: 1px dashed var(--rule-strong); }
.paper-pocket { min-width: 0; flex: 1; width: 100%; padding: var(--s-3) var(--s-3) 0; background: color-mix(in srgb, var(--blush) 26%, var(--paper)); border-radius: 4px 4px 10px 10px; }
.paper-pocket__seam { min-height: 44px; display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2); font-family: var(--font-hand); font-size: var(--fs-lg); border-bottom: 1px dashed var(--ink-faint); cursor: pointer; }
.paper-pocket__note { margin-top: var(--s-3); padding: var(--s-3); background: var(--paper); box-shadow: var(--shadow-note); transform: translateY(calc(-4px * var(--move))); transition: transform var(--dur-ui) var(--ease-out); }
.paper-pocket__note :is(.win__link, .memory__link) { display: grid; width: 100%; }
.year-album__photo { display: block; width: 100%; cursor: zoom-in; }
.year-album__photo .year-album__image { max-height: 200px; width: 100%; object-fit: contain; }
dialog.image-viewer { width: min(960px, calc(100% - 24px)); }
.image-viewer__stage { display: grid; place-items: center; height: min(55dvh, 520px); overflow: hidden; touch-action: none; background: var(--paper-shade); cursor: grab; }
.image-viewer__photo { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; user-select: none; }
.image-viewer__tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--s-2); }
.image-viewer__thumbs { display: flex; gap: var(--s-2); overflow-x: auto; padding: 4px; }
.image-viewer__thumb { flex: none; width: 56px; height: 56px; border: 2px solid transparent; border-radius: 4px; }
.image-viewer__thumb img { width: 100%; height: 100%; object-fit: cover; }
.image-viewer__thumb[aria-current='true'] { border-color: var(--ink); }
.file-queue { list-style: none; padding: 0; max-height: 50dvh; overflow: auto; }
.file-queue li { display: flex; gap: var(--s-3); align-items: center; padding-block: var(--s-3); border-bottom: 1px solid var(--rule); overflow-wrap: anywhere; }
.file-queue li > div { flex: 1; min-width: 0; }
.file-queue li > svg { width: 32px; height: 32px; flex: none; }
.file-queue__state { font-family: var(--font-ui); font-size: var(--fs-sm); color: var(--ink-soft); }
.file-queue__preview { width: 48px; height: 48px; object-fit: cover; }
.file-queue__progress { width: 100%; height: 20px; accent-color: var(--thread-done); }
.section--attachments.is-file-drop { outline: 2px dashed var(--thread-later); outline-offset: 4px; background: color-mix(in srgb, var(--lavender) 15%, var(--paper)); }
.photo-album { margin-block: var(--s-4); }
.date-range { padding: var(--s-3); margin-bottom: var(--s-4); background: color-mix(in srgb, var(--lavender) 18%, var(--paper)); }
.date-range > summary { cursor: pointer; min-height: 36px; font-family: var(--font-text); }
.date-range__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
.date-range__fields .input { min-width: 0; width: 100%; }
.notebook-search { margin-block: var(--s-4); border-bottom: 1px dashed var(--rule-strong); padding-block: var(--s-2); }
.notebook-search > summary { display: flex; align-items: center; gap: var(--s-2); min-height: 44px; cursor: pointer; font-family: var(--font-text); }
.notebook-search > summary svg { width: 20px; height: 20px; }
.notebook-search[open] > .input { width: 100%; margin-block: var(--s-2); }
.notebook-search__filters summary { cursor: pointer; min-height: 36px; font-size: var(--fs-sm); }
.notebook-search__fields { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.notebook-search__fields > * { min-width: 0; flex: 1 1 120px; }
.notebook-search__results { list-style: none; padding: 0; }
.notebook-search__results li { padding-block: var(--s-3); border-bottom: 1px solid var(--rule); overflow-wrap: anywhere; }
.notebook-search__results a { font-family: var(--font-text); font-size: var(--fs-md); }
.record-calendar { margin-block: var(--s-4); }
.record-calendar > summary { cursor: pointer; min-height: 44px; font-family: var(--font-text); }
.record-calendar > .t-meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-1); }
.record-calendar > .t-meta svg { width: 16px; height: 16px; flex: none; }
.heat-calendar { display: flex; gap: 3px; max-width: 100%; overflow-x: auto; padding: 4px 4px var(--s-3); }
.heat-calendar__week { display: grid; grid-template-rows: repeat(7, 24px); gap: 3px; flex: none; }
.heat-calendar__day, .heat-calendar__gap { width: 24px; height: 24px; }
.heat-calendar__day { display: grid; place-items: center; background: var(--paper-shade); border: 1px solid var(--rule-strong); border-radius: 3px; }
.heat-calendar__day[data-kind='writing'] { background: color-mix(in srgb, var(--blush) 65%, var(--paper)); }
.heat-calendar__day[data-kind='victory'] { background: color-mix(in srgb, var(--butter) 70%, var(--paper)); }
.heat-calendar__day svg { width: 14px; height: 14px; color: var(--ink); }
@media (max-width: 420px) { .date-range__fields { grid-template-columns: 1fr; } }
.photo-album > summary { min-height: 44px; padding-block: var(--s-2); cursor: pointer; font-family: var(--font-text); }
.photo-collage { columns: 2; column-gap: var(--s-3); padding: var(--s-2); }
.photo-collage__item { break-inside: avoid; margin: 0 0 var(--s-4); padding: var(--s-2); background: var(--paper); box-shadow: var(--shadow-note); }
.photo-collage__open { width: 100%; display: block; cursor: zoom-in; }
.photo-collage__item img { display: block; width: 100%; height: auto; }
.photo-collage__item figcaption { display: grid; gap: var(--s-1); padding-top: var(--s-2); font-family: var(--font-hand); font-size: var(--fs-md); }
.photo-collage__item figcaption a { font-family: var(--font-text); font-size: var(--fs-sm); }
@media (max-width: 420px) { .photo-collage { columns: 1; } }
@media (hover: hover) and (pointer: fine) { .paper-pocket:focus-within .paper-pocket__note, .paper-pocket:hover .paper-pocket__note { transform: translateY(calc(-8px * var(--move))); } }
@media (prefers-reduced-motion: reduce) { .paper-pocket__note, .paper-pocket:hover .paper-pocket__note, .paper-pocket:focus-within .paper-pocket__note { transform: none; transition: none; } }
@media (prefers-reduced-motion: reduce) { .paper-folder__peek, .paper-folder[open] .paper-folder__peek { transform: none; transition: none; } }
.stitch-box {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -8px -6px -8px -10px;
  border-radius: 8px;
}
.stitch-box svg { width: 24px; height: 24px; }
.stitch-box .aida { fill: color-mix(in srgb, var(--paper) 60%, white); stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 2 2; }
.stitch-box .hole { fill: var(--ink-faint); }
.stitch-box .mark { fill: none; stroke-width: 2.6; stroke-linecap: round; }
.stitch-box .mark--x1, .stitch-box .mark--x2 { stroke: var(--thread-done); }
.stitch-box[data-status='partial'] .mark--x1 { stroke: var(--thread-partial); }
.stitch-box .mark--later { stroke: var(--thread-later); stroke-width: 2.2; stroke-linejoin: round; }
.stitch-box .mark--knot { fill: var(--thread-skip); stroke: none; }
.stitch-box .mark { visibility: hidden; }
.stitch-box[data-status='done'] .mark--x1, .stitch-box[data-status='done'] .mark--x2,
.stitch-box[data-status='partial'] .mark--x1,
.stitch-box[data-status='postponed'] .mark--later,
.stitch-box[data-status='skipped'] .mark--knot { visibility: visible; }
.stitch-box:active { transform: scale(calc(1 - 0.03 * var(--move))); }

/* Marca quieta de estado (semana, impresión): mismas puntadas que la casilla, sin aida ni animación. */
.status-mark, .mood-mark { display: inline-flex; align-items: center; flex: none; }
.st-mark { width: 20px; height: 20px; flex: none; }
.st-mark__box { fill: none; stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 2 2; }
.st-mark__thread { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.st-mark[data-status='done'] .st-mark__thread { stroke: var(--thread-done); }
.st-mark[data-status='partial'] .st-mark__thread { stroke: var(--thread-partial); }
.st-mark[data-status='postponed'] .st-mark__thread { stroke: var(--thread-later); stroke-width: 2.2; }
.st-mark[data-status='skipped'] .st-mark__thread { fill: var(--thread-skip); stroke: none; }
@media (hover: hover) and (pointer: fine) {
  .stitch-box:hover .aida { stroke: var(--ink-soft); }
}

/* ---------- Lista de actividades ---------- */
.activities { display: grid; }
.activity {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 4px 0;
  border-bottom: 1px solid var(--rule);
}
.activity__text { flex: 1; min-width: 0; font-family: var(--font-text); font-size: var(--fs-md); line-height: 1.35; overflow-wrap: anywhere; }
.activity__title { cursor: text; }
.activity[data-status='done'] .activity__title {
  text-decoration: underline dashed var(--thread-done);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
}
.activity[data-status='skipped'] .activity__title,
.activity[data-status='postponed'] .activity__title { color: var(--ink-soft); }
.activity__meta { display: flex; gap: 8px; align-items: center; margin-top: 1px; }
.activity__note { font-family: var(--font-hand); font-size: 1.3rem; line-height: 1; color: var(--thread-later); }
.activity__note--partial { color: var(--thread-partial-text); }
.activity__note--skip { color: var(--ink-soft); }
.activity__routine { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-ui); font-size: var(--fs-xs); color: var(--ink-soft); }
.activity__routine svg { width: 14px; height: 14px; }
.activity__from { text-decoration-style: dashed; text-decoration-color: var(--ink-faint); }
.activity .icon-btn { margin-right: -8px; }
.activity__edit { flex: 1; min-width: 0; }
@media (pointer: coarse) {
  .activity { touch-action: pan-y; }
  .activity.is-swiping { background: color-mix(in srgb, var(--lavender) 18%, var(--paper)); }
  .activity.is-swiping > .icon-btn { color: var(--ink); }
}
.add-activity { display: flex; align-items: center; gap: 10px; min-height: 48px; border-bottom: 1px solid var(--rule); }
.add-activity svg { width: 20px; height: 20px; color: var(--ink-faint); flex: none; margin-left: 2px; margin-right: 2px; }
.add-activity input { flex: 1; min-width: 0; border: 0; background: transparent; font-family: var(--font-text); font-size: var(--fs-md); padding: 10px 0; }
.add-activity input::placeholder { color: var(--placeholder); font-style: italic; }
.add-activity input:focus-visible { outline: none; }
.add-activity:focus-within { border-bottom-color: var(--rule-strong); }

/* ---------- Menú (popover) ---------- */
.menu {
  position: fixed;
  z-index: 300;
  margin: 0;
  padding: 6px;
  min-width: 232px;
  border: 0;
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 0 var(--paper-edge), 0 14px 32px -14px rgb(40 30 28 / 0.55);
  inset: auto;
  transform-origin: var(--origin, top right);
}
.menu:popover-open, .menu.is-open { animation: menu-in var(--dur-ui) var(--ease-out); }
@keyframes menu-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
.menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 6px 10px;
  border-radius: 4px;
  text-align: left;
  font-size: var(--fs-sm);
}
.bloom-menu__trigger { background: color-mix(in srgb, var(--blush) 35%, var(--paper)); color: var(--ink); }
.menu--bloom { display: grid; grid-template-columns: repeat(2, minmax(96px, 1fr)); gap: 6px; padding: 10px; min-width: 224px; }
.menu--bloom .menu__item { display: grid; justify-items: center; gap: 6px; min-height: 72px; text-align: center; border-radius: 6px; background: color-mix(in srgb, var(--lavender) 25%, var(--paper)); }
.menu--bloom .menu__item:nth-child(2) { background: color-mix(in srgb, var(--blush) 30%, var(--paper)); }
.menu--bloom .menu__item:nth-child(3) { background: color-mix(in srgb, var(--sage) 35%, var(--paper)); }
.menu--bloom .menu__item:nth-child(4) { background: color-mix(in srgb, var(--butter) 35%, var(--paper)); }
.menu__item svg { width: 20px; height: 20px; flex: none; }
.menu__item[aria-checked='true'] { font-weight: 650; background: color-mix(in srgb, var(--butter) 30%, transparent); }
.menu__item:focus-visible { outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .menu__item:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); } }
.menu__sep { border: 0; border-top: 1px dashed var(--rule-strong); margin: 6px 4px; }

/* ---------- Nota adhesiva ---------- */
.sticky {
  position: relative;
  background: var(--butter);
  background-image: linear-gradient(to bottom, rgb(255 255 255 / 0.25), transparent 30%);
  padding: 26px 20px 18px;
  border-radius: var(--radius-note);
  box-shadow: var(--shadow-note);
  transform: rotate(-1.2deg);
  max-width: 440px;
}
.sticky .washi { position: absolute; top: -9px; left: 50%; transform: translateX(-50%) rotate(2deg); }
.sticky { color: var(--on-accent); }
.sticky label { display: block; font-family: var(--font-text); font-style: italic; font-size: var(--fs-md); margin-bottom: 4px; color: var(--on-accent); }
.sticky textarea.write { color: var(--on-accent); }
.sticky textarea.write { background-image: none; min-height: calc(var(--line) * 1.6); }
.sticky textarea.write::placeholder { color: color-mix(in srgb, var(--on-accent) 72%, var(--butter)); }

/* ---------- Washi ---------- */
.washi {
  display: block;
  width: 78px;
  height: 20px;
  background: color-mix(in srgb, var(--blush) 80%, transparent);
  clip-path: polygon(2% 0, 98% 0, 100% 20%, 97% 40%, 100% 60%, 97% 80%, 99% 100%, 1% 100%, 3% 80%, 0 60%, 3% 40%, 0 20%);
  pointer-events: none;
}
.washi--sage { background: color-mix(in srgb, var(--sage) 85%, transparent); }
.washi--lavender { background: color-mix(in srgb, var(--lavender) 85%, transparent); }
.washi--butter { background: color-mix(in srgb, var(--butter) 85%, transparent); }

/* ---------- Papelito ---------- */
.slip {
  position: relative;
  background: var(--paper);
  padding: 14px 18px;
  box-shadow: var(--shadow-note);
  clip-path: polygon(0 3%, 4% 0, 12% 2%, 20% 0, 30% 2%, 42% 0, 55% 2%, 68% 0, 80% 2%, 92% 0, 100% 2%, 99% 50%, 100% 98%, 90% 100%, 78% 98%, 64% 100%, 50% 98%, 36% 100%, 22% 98%, 10% 100%, 0 97%);
  font-family: var(--font-text);
}
.slip--rose { background: color-mix(in srgb, var(--blush) 45%, var(--paper)); }
.slip--butter { background: color-mix(in srgb, var(--butter) 40%, var(--paper)); }
.slip p + p, .slip p + .slip__actions { margin-top: 8px; }
.slip__actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Diálogo ---------- */
dialog.sheet {
  width: min(560px, calc(100vw - 20px));
  max-height: min(88dvh, 820px);
  padding: 0;
  border: 0;
  border-radius: 4px 10px 10px 4px;
  background: var(--paper);
  background-image: var(--tex-paper);
  color: var(--ink);
  box-shadow: 0 30px 70px -30px rgb(20 14 12 / 0.7);
  overflow: auto;
}
dialog.sheet::backdrop { background: rgb(40 30 28 / 0.38); }
dialog.sheet[open] { animation: sheet-in var(--dur-panel) var(--ease-out); }
/* El visor anima la foto desde su miniatura; el marco permanece quieto para medir y usarlo. */
dialog.sheet.image-viewer[open] { animation: none; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(calc(10px * var(--move))) scale(0.985); } to { opacity: 1; transform: none; } }
.sheet__body { padding: 28px clamp(20px, 5vw, 36px) 24px; display: grid; gap: var(--s-5); }
.sheet__title { font-family: var(--font-display); font-size: var(--fs-xl); line-height: 1.15; padding-right: 36px; }
.sheet__close { position: absolute; top: 10px; right: 10px; }
.sheet__grip { display: none; }
@media (max-width: 699px) {
  dialog.sheet--mobile-bottom { width: 100%; max-width: none; max-height: 88dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .sheet--mobile-bottom[open] { animation-name: bottom-sheet-in; }
  .sheet--mobile-bottom .sheet__grip { display: block; width: 64px; height: 24px; margin: 4px auto -12px; cursor: grab; touch-action: none; }
  .sheet--mobile-bottom .sheet__grip::after { content: ''; display: block; width: 32px; height: 4px; margin: 10px auto; background: var(--rule-strong); border-radius: 4px; }
  .sheet--mobile-bottom .sheet__body { padding-top: 30px; }
  @keyframes bottom-sheet-in { from { opacity: 0; transform: translateY(calc(30px * var(--move))); } to { opacity: 1; transform: none; } }
  .menu { max-height: 70dvh; overflow-y: auto; }
}
@media (prefers-reduced-motion: reduce) { dialog.sheet--mobile-bottom[open] { animation: none; } }
.sheet__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); justify-content: flex-end; align-items: center; padding-top: var(--s-2); }
.sheet__actions .spacer { flex: 1; }
@media (max-width: 599px) {
  dialog.sheet { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 12px 12px 0 0; }
}

/* ---------- Aviso breve ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 400;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(92vw, 480px);
  padding: 12px 18px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius-label);
  font-size: var(--fs-sm);
  box-shadow: 0 12px 28px -14px rgb(20 14 12 / 0.7);
  transition: opacity var(--dur-ui) var(--ease-out), transform var(--dur-ui) var(--ease-out);
}
.toast[hidden] { display: flex !important; opacity: 0; transform: translate(-50%, calc(8px * var(--move))); pointer-events: none; visibility: hidden; }
.toast button { color: var(--butter); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; min-height: 32px; }
.toast--illustrated { width: min(92vw, 480px); }
.memory-receipt { width: 40px; height: 40px; flex: none; }
.memory-receipt svg { display: block; width: 100%; height: 100%; }
.memory-receipt__paper rect { fill: var(--butter); }
.memory-receipt__paper path { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.memory-receipt__pocket { fill: var(--lavender); stroke: var(--paper); stroke-width: 1; }
.memory-receipt__check { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 699px) { .toast { bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* ---------- Cuaderno compartido (nube, D38): de quién es y qué se puede hacer ---------- */
.guest-note {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  max-width: min(92vw, 520px);
  margin: 0;
  padding: 6px 14px;
  background: var(--paper);
  color: var(--ink);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius-label);
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  text-align: center;
  pointer-events: none;
}
.guest-note__out { pointer-events: auto; padding: 4px 2px; min-height: 32px; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 650; text-decoration: underline dashed; text-underline-offset: 3px; cursor: pointer; }
.guest-note__out:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Botones de opción (energía, frecuencia, papel) ---------- */
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: var(--radius-label);
  border: 1.5px dashed var(--rule-strong);
  font-size: var(--fs-sm);
  color: var(--ink);
  background: transparent;
}
.choice svg { width: 20px; height: 20px; }
.choice[aria-pressed='true'], .choice[aria-checked='true'] { border-style: solid; border-color: var(--ink); background: color-mix(in srgb, var(--butter) 35%, var(--paper)); font-weight: 600; }
.choice--day { min-width: 44px; justify-content: center; padding: 8px 10px; }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper__value { min-width: 5.5ch; text-align: center; font-family: var(--font-text); font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }

/* ---------- Stickers ---------- */
.sticker-layer { position: absolute; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; border-radius: inherit; }
.sticker {
  position: absolute;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  transform: rotate(var(--rot, 0deg)) scale(var(--scale, 1));
  pointer-events: none;
  touch-action: none;
  border-radius: 12px;
}
.sticker svg { width: 100%; height: 100%; }
.is-decorating .sticker-layer { pointer-events: auto; background: color-mix(in srgb, var(--paper) 30%, transparent); outline: 2px dashed var(--rose); outline-offset: -8px; }
.is-decorating .sticker { pointer-events: auto; cursor: grab; }
.is-decorating .sticker:active { cursor: grabbing; }
.sticker[aria-selected='true'] { outline: 1.5px dashed var(--ink); outline-offset: 4px; }
.sticker.is-settling { animation: settle var(--dur-panel) var(--ease-out); }
@keyframes settle { from { transform: rotate(calc(var(--rot, 0deg) + 2deg * var(--move))) scale(calc(var(--scale, 1) * 1.06)); } }

.sticker-tools {
  position: sticky;
  bottom: 12px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin: var(--s-4) auto 0;
  padding: 6px 10px;
  background: var(--paper);
  border-radius: 8px;
  box-shadow: 0 1px 0 var(--paper-edge), 0 10px 24px -14px rgb(40 30 28 / 0.6);
}

.sticker-tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.sticker-tray__group { display: grid; gap: 8px; }
.sticker-tray__group h3 { font-family: var(--font-text); font-style: italic; font-size: var(--fs-md); }
.sticker-pick { display: grid; place-items: center; aspect-ratio: 1; border-radius: 10px; padding: 8px; }
.sticker-pick svg { width: 100%; height: 100%; }
@media (hover: hover) and (pointer: fine) { .sticker-pick:hover { background: color-mix(in srgb, var(--butter) 30%, transparent); } }

/* ---------- Vacío ---------- */
.empty { display: grid; justify-items: start; gap: var(--s-3); padding: var(--s-5) 0; color: var(--ink-soft); font-family: var(--font-text); font-style: italic; font-size: var(--fs-lg); }
.empty svg { width: 56px; height: 56px; opacity: 0.55; filter: grayscale(0.6); }

/* ---------- Escenas ---------- */
.scene-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
.scene { position: absolute; }

/* ---------- Mis stickers: imágenes subidas y dibujos (D24) ---------- */
.sticker--img { width: 110px; height: auto; margin: 0; border-radius: 4px; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(var(--scale, 1)); }
.sticker--img img { display: block; width: 100%; height: auto; pointer-events: none; user-select: none; }
.sticker--img.is-settling { animation: settle-img var(--dur-panel) var(--ease-out); }
@keyframes settle-img { from { transform: translate(-50%, -50%) rotate(calc(var(--rot, 0deg) + 2deg * var(--move))) scale(calc(var(--scale, 1) * 1.06)); } }
.sticker-tray--own { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.sticker-own { position: relative; }
.sticker-pick--img { width: 100%; background: color-mix(in srgb, var(--paper-shade) 60%, transparent); }
.sticker-pick--img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sticker-pick__del { position: absolute; top: -4px; right: -4px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--paper); color: var(--ink-soft); box-shadow: var(--shadow-tab); }
.sticker-pick__del svg { width: 14px; height: 14px; }
.sticker-tray__own-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Dibujar ---------- */
dialog.sheet.sheet--draw { width: min(760px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); }
.draw { display: grid; gap: var(--s-3); }
.draw__bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.draw__bar--end { justify-content: space-between; }
.draw__row { display: flex; flex-wrap: wrap; gap: 4px; }
.draw__opt { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 4px 10px; border-radius: 8px; border: 1px dashed transparent; font-size: var(--fs-sm); }
.draw__opt svg { width: 18px; height: 18px; }
.draw__opt[aria-checked='true'] { border-color: var(--ink); background: color-mix(in srgb, var(--butter) 45%, var(--paper)); }
.draw__colors .draw__opt { min-width: 36px; padding: 4px; }
.draw__swatch { display: block; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(73 61 59 / 0.25); }
.draw__width { display: block; width: 24px; height: var(--w); border-radius: 99px; background: var(--ink); }
.draw__text { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.draw__text[hidden] { display: none; }
.draw__text-input { flex: 1 1 14rem; }
.draw__text .select { width: auto; flex: 0 1 auto; }
.draw__paper { border-radius: 6px; background: var(--paper); background-image: var(--tex-paper); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.draw__canvas { display: block; width: auto; height: auto; max-width: 100%; max-height: 48dvh; aspect-ratio: 1; margin: 0 auto; touch-action: none; cursor: crosshair; }
.draw__canvas[data-tool='text'] { cursor: text; }
.draw__name { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--ink-soft); }
.draw__name .input { width: 12rem; }
@media (max-width: 520px) { .draw__tools .draw__opt span { display: none; } .draw__name .input { width: 9rem; } .sheet--draw .sheet__body { padding-inline: 14px; } }

/* ---------- Adjuntos ---------- */
.attachments { display: grid; gap: 4px; }
.attachment { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--rule); }
.attachment__open { flex: 1; min-width: 0; justify-content: flex-start; text-decoration: none; }
.attachment__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.attachment__size { margin-left: auto; padding-left: 8px; font-size: var(--fs-xs); color: var(--ink-soft); white-space: nowrap; }
.attachment__thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; flex: none; }

/* `?debug=hit` (solo diagnóstico): qué queda bajo el puntero. */
.hit-debug { position: fixed; left: 8px; bottom: 8px; z-index: 2147483647; pointer-events: none; max-width: calc(100vw - 16px); padding: 4px 8px; border-radius: 6px; background: var(--ink); color: var(--paper); font: 12px/1.35 var(--font-ui); white-space: pre-wrap; }

/* Arte de los stickers y de la tapa: pinturas desde los tokens fijos --st-* (clases, nunca hex ni estilos inline). */
.sf-ink { fill: var(--st-ink); } .ss-ink { stroke: var(--st-ink); }
.sf-paper { fill: var(--st-paper); } .ss-paper { stroke: var(--st-paper); }
.sf-cut { fill: var(--st-cut); } .ss-cut { stroke: var(--st-cut); }
.sf-butter { fill: var(--st-butter); } .ss-butter { stroke: var(--st-butter); }
.sf-blush { fill: var(--st-blush); } .ss-blush { stroke: var(--st-blush); }
.sf-rose { fill: var(--st-rose); } .ss-rose { stroke: var(--st-rose); }
.sf-peach { fill: var(--st-peach); } .ss-peach { stroke: var(--st-peach); }
.sf-sage { fill: var(--st-sage); } .ss-sage { stroke: var(--st-sage); }
.sf-sage-deep { fill: var(--st-sage-deep); } .ss-sage-deep { stroke: var(--st-sage-deep); }
.sf-lavender { fill: var(--st-lavender); } .ss-lavender { stroke: var(--st-lavender); }
.sf-satin { fill: var(--st-satin); } .ss-satin { stroke: var(--st-satin); }
.sf-cloud { fill: var(--st-cloud); } .ss-cloud { stroke: var(--st-cloud); }
.sf-wax { fill: var(--st-wax); } .ss-wax { stroke: var(--st-wax); }

/* ---------- Cuaderno de otra persona: solo para mirar y lo no compartido (D51) ---------- */
.is-lookonly button:disabled, .is-lookonly input:disabled, .is-lookonly select:disabled { opacity: 1; cursor: default; }
.is-lookonly textarea[readonly], .is-lookonly input[readonly] { cursor: default; }
.is-lookonly .sticker { pointer-events: none; }
/* Solo para mirar (D51): sin nada que invite a escribir o tocar. Queda lo anotado. */
.is-lookonly .feelings__entry, .is-lookonly .feelings__suggestions, .is-lookonly .feeling-chip__remove,
.is-lookonly .add-activity, .is-lookonly .activity__more, .is-lookonly .activity button[aria-haspopup="menu"],
.is-lookonly .sheet-add, .is-lookonly .sheet-block__more, .is-lookonly .text-btn, .is-lookonly .label-btn,
.is-lookonly .stepper .icon-btn, .is-lookonly .choice[aria-pressed="false"], .is-lookonly .activities-empty,
button.is-lookonly, .sticker-tools.is-lookonly, .is-lookonly button.icon-btn { display: none; }
.is-lookonly .feeling-chip { padding-right: 9px; }
.is-lookonly .choice[aria-pressed="true"] { opacity: 1; }
.is-lookonly textarea[readonly], .is-lookonly input[readonly] { background-color: transparent; }
.is-lookonly input[readonly] { border-color: transparent; box-shadow: none; padding-left: 0; }
.is-lookonly a.text-btn, .is-lookonly .page-link { display: inline-flex; }
.is-lookonly #st-account .label-btn, .is-lookonly #st-account .text-btn { display: inline-flex; }
.lookonly-empty { font-family: var(--font-text); font-style: italic; color: var(--ink-soft); font-size: var(--fs-sm); }
.lookonly-tag { font-family: var(--font-ui); font-size: var(--fs-xs); font-style: normal; font-weight: 400; color: var(--ink-soft); }
.access-blocked { display: grid; gap: var(--s-3); align-content: start; }

/* Qué ven quienes miran (D53), dentro de Privacidad */
.share-block { margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px dashed var(--rule-strong); display: grid; gap: var(--s-2); }
.share-block__title { font-family: var(--font-display); font-size: var(--fs-md); }
.share-block__all { font-weight: 650; }
.share-parts { margin-left: var(--s-4); }
