/* ============================================================
   SACRAMENTO
   Lienzo infinito para entregar dirección visual.
   Estética: editorial, onírica, hairlines, micro-tipografía.
   ============================================================ */

/* ---------- tema ---------- */

:root,
:root[data-theme="light"] {
  --paper:        #FAF9F6;
  --paper-raised: #FFFFFF;
  --ink:          #14130F;
  --ink-soft:     #6E6A62;
  --ink-faint:    #A9A49A;
  --hair:         #E5E1D9;
  --hair-soft:    #EFECE5;
  --grid:         #D8D3C8;
  --accent:       #14130F;
  --sel:          #2B6CFF;
  --sel-soft:     rgba(43, 108, 255, 0.10);
  --veil:         rgba(250, 249, 246, 0.72);
  --shadow-s:     0 1px 2px rgba(20, 19, 15, 0.05);
  --shadow-m:     0 1px 2px rgba(20, 19, 15, 0.05), 0 10px 30px rgba(20, 19, 15, 0.07);
  --shadow-l:     0 2px 6px rgba(20, 19, 15, 0.06), 0 24px 60px rgba(20, 19, 15, 0.13);
  --grain:        0.032;
}

:root[data-theme="dark"] {
  --paper:        #0C0C0E;
  --paper-raised: #151517;
  --ink:          #ECE9E2;
  --ink-soft:     #8C877E;
  --ink-faint:    #5A564F;
  --hair:         #262629;
  --hair-soft:    #1D1D20;
  --grid:         #2A2A2E;
  --accent:       #ECE9E2;
  --sel:          #6E9BFF;
  --sel-soft:     rgba(110, 155, 255, 0.14);
  --veil:         rgba(12, 12, 14, 0.74);
  --shadow-s:     0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-m:     0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-l:     0 2px 6px rgba(0, 0, 0, 0.5), 0 24px 60px rgba(0, 0, 0, 0.65);
  --grain:        0.05;
}

:root {
  --ui: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --r-pill: 999px;
  --r-panel: 14px;
  --r-card: 4px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.35s ease, color 0.35s ease;
  /* Safari en iPad: sin esto, el rebote elástico del scroll se traga el
     gesto de arrastrar el lienzo justo cuando llegas a un borde. */
  overscroll-behavior: none;
  /* y sin esto, al girar la tableta el texto cambia de tamaño solo */
  -webkit-text-size-adjust: 100%;
}

/* El toque en un botón responde al instante; sin esto el navegador espera
   ~300 ms por si viene un doble toque para hacer zoom. */
button, .btn, .ico, [role="button"] { touch-action: manipulation; }

::selection { background: var(--sel-soft); }

/* micro-tipografía de interfaz */
.micro {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 400;
}

/* ---------- lienzo ---------- */

#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: default;
}

body[data-tool="hand"] #stage { cursor: grab; }
body[data-tool="hand"] #stage.is-panning { cursor: grabbing; }
body[data-tool="text"] #stage,
body[data-tool="note"] #stage { cursor: crosshair; }
body[data-tool="crop"] #stage { cursor: crosshair; }

#grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

body[data-grid="dots"] #grid {
  background-image: radial-gradient(circle, var(--grid) 1px, transparent 1px);
}

body[data-grid="lines"] #grid {
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  opacity: 0.5;
}

body[data-grid="none"] #grid { background-image: none; }

/* El cliente ve una página, no un lienzo: sin retícula de puntos. */
body:not(.edit) #grid { background-image: none !important; }

/* crédito de marca, fijo en la esquina */
.byline {
  font-size: 8.5px;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  white-space: nowrap;
  margin-left: 4px;
}

@media (max-width: 900px) { .byline { display: none; } }

/* grano onírico */
#grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: var(--grain);
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

:root[data-theme="dark"] #grain { mix-blend-mode: screen; }

#canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
}

/* numeración editorial del lienzo (guiño a la retícula de referencia) */
.coord {
  position: absolute;
  font-size: 6px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}

body[data-grid="numbered"] #grid { background-image: none; }

/* durante pan/drag los embeds no roban el puntero */
body.busy iframe,
body.busy video { pointer-events: none !important; }

/* ---------- items ---------- */

.item {
  position: absolute;
  transform-origin: center center;
  user-select: none;
}

/* Bloqueado: no se arrastra ni se escala, pero sigue siendo seleccionable
   — si no, nunca podrías desbloquearlo. */
.item.locked .wrap { cursor: default; }

.lock-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  display: none;
  place-items: center;
  border-radius: 50%;
  background: var(--veil);
  backdrop-filter: blur(8px);
  border: 1px solid var(--hair);
  color: var(--ink-soft);
  cursor: pointer;
  z-index: 8;
  padding: 0;
}

.lock-badge svg { width: 12px; height: 12px; }
.lock-badge:hover { color: var(--ink); border-color: var(--ink); }

body.edit .item.locked .lock-badge { display: grid; }
body.edit .item.locked.sel .lock-badge { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.wrap {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--r-card);
  overflow: hidden;
}

.item[data-type="image"] .wrap,
.item[data-type="video"] .wrap { box-shadow: var(--shadow-s); }

.item img,
.item video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  border-radius: inherit;
}

.item[data-fit="contain"] img,
.item[data-fit="contain"] video { object-fit: contain; }

.item iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--r-card);
  background: var(--paper-raised);
}

/* texto suelto */
.item[data-type="text"] .wrap { overflow: visible; background: transparent; }

.rich {
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
  line-height: 1.32;
}

.rich a { color: inherit; }

/* ---------- nota: papel de cuaderno ---------- */

.item[data-type="note"] .wrap {
  background: #F5EEDF;
  border: 1px solid rgba(0, 0, 0, 0.09);
  box-shadow: var(--shadow-s);
  overflow: hidden;
  --note-rule: rgba(90, 78, 58, 0.16);
}

/* las rayas van detrás del texto, arrancando bajo el margen superior */
.note-rules {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
}

.item[data-type="note"] .rich {
  position: relative;
  z-index: 1;
  padding: 18px 20px;
  font-size: 13.5px;
  min-height: 100%;
  color: #2A2724;
}

/* papel oscuro: rayas e interfaz se invierten solas */
.item[data-type="note"] .wrap[style*="#2A2724"] { --note-rule: rgba(255, 255, 255, 0.14); }
.item[data-type="note"] .wrap[style*="#2A2724"] .rich { color: #ECE9E2; }

/* selector de tonos en el inspector */
.tones { display: inline-flex; align-items: center; gap: 3px; }

.tone {
  width: 17px; height: 17px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s;
}

.tone:hover { transform: scale(1.15); }
.tone.on { box-shadow: 0 0 0 2px var(--paper-raised), 0 0 0 3.5px var(--ink); }

/* ---------- barra de revisión ---------- */

.rev-bar {
  display: flex;
  align-items: stretch;
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-s);
  overflow: hidden;
}

.rev-opt {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0 12px;
  transition: background 0.15s, color 0.15s;
}

.rev-opt + .rev-opt { border-left: 1px solid var(--hair); }
.rev-opt:hover { background: var(--hair-soft); }

.rev-dot {
  flex: none;
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-faint);
  transition: background 0.15s, border-color 0.15s;
}

.rev-lab { outline: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rev-opt.on { color: var(--paper); }
.rev-opt.yes.on { background: #2E7D5B; }
.rev-opt.no.on  { background: #B4553C; }
.rev-opt.on .rev-dot { background: var(--paper); border-color: var(--paper); }

/* ---------- guía de apilado ---------- */

.drop-line {
  position: absolute;
  display: none;
  height: 3px;
  border-radius: 3px;
  background: var(--sel);
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 0 0 3px var(--sel-soft);
}

/* pieza que va a recibir lo que estás arrastrando: se ve antes de soltar */
.item.destino-pila > .wrap {
  box-shadow: 0 0 0 2px var(--sel), 0 0 0 6px var(--sel-soft);
  border-radius: 3px;
}

/* botón destacado del inspector (crear moodboard) */
.ico.solid-ico { background: var(--ink); color: var(--paper); }
.ico.solid-ico:hover { background: var(--ink); opacity: 0.85; }

/* documento */
.item[data-type="doc"] .wrap {
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-m);
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.doc-head {
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--hair-soft);
}

.doc-kicker {
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 7px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.doc-title {
  font-size: 15px;
  line-height: 1.3;
  font-weight: 500;
}

/* Solo un vistazo del contenido: el documento completo se abre con doble clic */
.doc-preview {
  flex: 1;
  min-height: 0;
  padding: 12px 18px 14px;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--ink-soft);
  overflow: hidden;
  position: relative;
}

.doc-preview > * { margin: 0 0 7px; font-size: inherit; font-weight: inherit; line-height: inherit; }
.doc-preview ul, .doc-preview ol { padding-left: 16px; }

.doc-preview::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 46px;
  background: linear-gradient(transparent, var(--paper-raised) 78%);
}

/* Botón para abrir el documento. Es un botón y no un cartel porque en un
   móvil no hay doble clic: el cliente tiene que poder abrirlo con un toque. */
.doc-open {
  position: absolute;
  left: 14px; bottom: 10px;
  z-index: 2;
  min-height: 24px;
  padding: 5px 11px;
  border: 1px solid var(--hair);
  border-radius: var(--r-pill);
  background: var(--paper);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.doc-open:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* lista de tareas */
.item[data-type="todo"] .wrap {
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-s);
  padding: 16px 18px;
  overflow: visible;
  height: auto;
  min-height: 100%;
}

.todo-title {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 12px;
}

.todo-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 9px;
  font-size: 12.5px;
  line-height: 1.5;
}

.todo-box {
  flex: none;
  width: 12px;
  height: 12px;
  margin-top: 3px;
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.todo-box.on { background: var(--ink); border-color: var(--ink); }
.todo-box.on::after {
  content: "";
  width: 5px; height: 2.5px;
  border-left: 1.4px solid var(--paper);
  border-bottom: 1.4px solid var(--paper);
  transform: rotate(-45deg) translate(0.5px, -1px);
}

.todo-row.done .todo-text { text-decoration: line-through; color: var(--ink-faint); }
.todo-text { outline: none; flex: 1; }

/* columna — contenedor con cabecera y cuerpo.
   El cuerpo lo coloca el motor (position:absolute) porque es una pieza más
   de la pila: al meter una imagen encima, el texto baja en vez de taparse. */
.item[data-type="column"] .wrap {
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  border-radius: 6px;
  display: block;
  position: relative;
}

.col-head {
  padding: 15px 17px 12px;
  border-bottom: 1px solid var(--hair-soft);
}

.col-kicker {
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 7px;
}

.col-title {
  font-size: 15px;
  line-height: 1.3;
  font-weight: 500;
  outline: none;
  color: var(--ink);
}

.col-body {
  position: absolute;
  left: 12px;                 /* COL_PAD del motor */
  top: 0;                     /* lo fija layoutStack */
  font-size: 12.5px;
  line-height: 1.68;
  color: var(--ink-soft);
  outline: none;
  min-height: 18px;
}

.col-body p { margin: 0 0 10px; }
.col-body:focus { color: var(--ink); }

/* pista de qué escribir */
.ghost { color: var(--ink-faint); font-style: italic; }

/* ---------- shotlist ---------- */

.item[data-type="shotlist"] .wrap {
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-s);
  display: flex;
  flex-direction: column;
}

.sl-head {
  flex: none;
  padding: 14px 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sl-kicker {
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.sl-info {
  width: 20px;
  height: 20px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--hair);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 0;
}

.sl-info svg { width: 12px; height: 12px; }
.sl-info:hover { border-color: var(--ink); color: var(--ink); }

.sl-name {
  flex: none;
  padding: 9px 16px 13px;
  font-size: 15px;
  line-height: 1.3;
  font-weight: 500;
  outline: none;
  border-bottom: 1px solid var(--hair-soft);
  color: var(--ink);
}

.sl-list {
  /* sin recorte: la pieza crece con las tomas (ver ajustarAlto en el motor) */
  flex: 1 0 auto;
  overflow: visible;
  padding: 13px 16px 16px;
}

.sl-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12.5px;
  line-height: 1.5;
}

.sl-num {
  flex: none;
  width: 20px;
  padding-top: 1px;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.sl-shot { flex: 1; outline: none; color: var(--ink); }
.sl-shot:empty::before { content: attr(data-ph); color: var(--ink-faint); }

/* ---------- quitar fondo ---------- */

.bg-sheet { width: min(760px, 100%); }

.bg-stage {
  position: relative;
  border: 1px solid var(--hair);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 18px;
  display: grid;
  place-items: center;
  min-height: 240px;
  max-height: 46vh;
  background-color: var(--paper);
  background-image:
    linear-gradient(45deg, var(--hair-soft) 25%, transparent 25%),
    linear-gradient(-45deg, var(--hair-soft) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--hair-soft) 75%),
    linear-gradient(-45deg, transparent 75%, var(--hair-soft) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.bg-stage canvas {
  display: block;
  max-width: 100%;
  max-height: 46vh;
  cursor: crosshair;
}

.bg-busy {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: var(--veil);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.bg-busy.on { display: grid; }

.bg-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.bg-ctl { display: flex; align-items: center; gap: 10px; }

.bg-ctl label {
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}

.bg-ctl output {
  font-size: 11px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  min-width: 26px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 18px;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: var(--hair);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--ink);
}

input[type="range"]::-moz-range-track { height: 1px; background: var(--hair); }
input[type="range"]::-moz-range-thumb {
  width: 11px; height: 11px; border: 0;
  border-radius: 50%; background: var(--ink);
}

.bg-seed {
  width: 22px;
  height: 22px;
  border: 1px solid var(--hair);
  border-radius: 4px;
}

.bg-hint {
  font-size: 11px;
  line-height: 1.6;
  color: var(--ink-faint);
  margin: 14px 0 0;
}

/* ============================================================
   BURBUJA DE FORMATO EN LÍNEA
   Aparece al seleccionar texto dentro de cualquier bloque editable.
   ============================================================ */

.bubble {
  position: fixed;
  display: none;
  align-items: center;
  gap: 1px;
  padding: 4px;
  background: var(--ink);
  border-radius: 9px;
  box-shadow: var(--shadow-l);
  z-index: 220;
}

.bubble.on { display: flex; }

.bubble .ico { width: 28px; height: 28px; color: var(--paper); border-radius: 6px; }
.bubble .ico svg { width: 14px; height: 14px; }
.bubble .ico:hover { background: rgba(255, 255, 255, 0.16); }
.bubble .sep { width: 1px; height: 16px; background: rgba(255, 255, 255, 0.22); margin: 0 4px; }

/* ============================================================
   SEGUNDA BARRA — DIRECCIÓN CREATIVA
   ============================================================ */

.dock-row {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 10px;
  z-index: 70;
  max-width: calc(100vw - 24px);
}

body:not(.edit) .dock-row { display: none; }

.dock-2 {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  background: var(--veil);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--hair);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-l);
}

.dock-2::before {
  content: "Dirección creativa";
  position: absolute;
  top: -17px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 7.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
  pointer-events: none;
}

/* Apilado en pantallas estrechas: column-reverse deja la barra de
   dirección creativa arriba, para que la principal siga al alcance. */
@media (max-width: 1080px) {
  .dock-row { flex-direction: column-reverse; align-items: center; gap: 26px; }
  .dock-2::before { top: -15px; }
}

/* ============================================================
   TELÉFONO — reparto de la interfaz
   ------------------------------------------------------------
   La barra de arriba llevaba la marca y seis botones peleándose por el
   mismo hueco: en un teléfono la marca acababa cortada por debajo de
   ellos. Aquí se separa por lo que hace cada cosa, no por lo que cabe:

     arriba  · la marca y el título, nada más
     lateral · lo de mirar y la paleta de crear, fuera del paso
     abajo   · las herramientas, el asistente y el pomodoro — donde
               llega el pulgar sin cambiar la mano de sitio

   El reparto lo hace colocarChrome() en el motor: aquí solo se viste.
   ============================================================ */

/* raíl lateral */
.rail {
  position: fixed;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px;
  background: var(--veil);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--hair);
  border-radius: 22px;
  box-shadow: var(--shadow-l);
  z-index: 65;
  /* si la paleta no cabe de alto, se desliza dentro del propio raíl en vez
     de salirse por debajo de la pantalla */
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  scrollbar-width: none;
}

.rail::-webkit-scrollbar { display: none; }
.rail .ico { flex: none; }

/* "Ver todo": texto en pantalla grande, icono a secas en el raíl */
.btn-fit svg { display: none; width: 16px; height: 16px; }

.rail .btn-fit {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: 9px;
  background: none;
  border: 0;
}

.rail .btn-fit svg { display: block; }
.rail .btn-fit .btn-lbl { display: none; }
.rail .btn-fit:hover { background: var(--hair-soft); }

body.telefono .rail { display: flex; }
body:not(.edit) .rail { display: none; }

/* la paleta de crear viaja entera al raíl: se desviste para no quedar
   como una pastilla dentro de otra */
.rail .dock-2 {
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 0;
  margin-top: 4px;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 0;
  border-top: 1px solid var(--hair);
  border-radius: 0;
  box-shadow: none;
}

.rail .dock-2::before { display: none; }
.rail .dock-2 .sep { width: 20px; height: 1px; margin: 4px 0; background: var(--hair); }

/* barra del pulgar: asistente y pomodoro */
.dock-tel {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 6px;
  background: var(--veil);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--hair);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-l);
}

/* en pantalla grande no tiene nada dentro y no debe ocupar ni un píxel */
.dock-tel:empty { display: none; }

@media (max-width: 720px) {
  /* arriba solo la marca: sin botones con los que chocar, ya no se corta */
  .topbar { height: 48px; padding: 0 14px; gap: 10px; }
  .top-right { gap: 6px; }
  .byline { display: none; }

  /* el estado del guardado es ruido salvo cuando avisa de algo */
  body.telefono .savestate { display: none; }
  body.telefono .savestate[data-state="error"],
  body.telefono .savestate[data-state="frenado"] { display: inline; }

  /* objetivos de toque más generosos */
  .dock .ico, .dock-2 .ico, .rail .ico, .dock-tel .ico { width: 36px; height: 36px; }
  .dock-row { gap: 20px; bottom: calc(14px + env(safe-area-inset-bottom)); }

  /* El raíl se centra en el hueco que queda LIBRE, no en la pantalla: así
     no puede meterse ni debajo de la marca ni encima de la barra del
     pulgar, pase lo larga que pase la paleta. */
  .rail {
    top: 56px;
    bottom: calc(170px + env(safe-area-inset-bottom));
    max-height: none;
    transform: none;
    justify-content: center;
  }

  /* el pomodoro pierde peso para caber al lado del asistente */
  .dock-tel .pomo-btn { height: 30px; padding: 0 11px; font-size: 8.5px; }
}

/* ============================================================
   FEED — cuadrícula tipo Instagram
   ============================================================ */

.item[data-type="grid"] .wrap {
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-s);
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.grid-head {
  flex: none;
  padding: 13px 15px 11px;
  border-bottom: 1px solid var(--hair-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.grid-name {
  font-size: 13px;
  font-weight: 500;
  outline: none;
  color: var(--ink);
  min-width: 0;
}

.grid-dims {
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}

.grid-cells {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 2px;
  padding: 10px;
}

.cell {
  position: relative;
  /* 4:5 — el formato del feed de Instagram desde 2025 */
  aspect-ratio: 4 / 5;
  background: var(--hair-soft);
  cursor: pointer;
  overflow: hidden;
}

.cell img {
  /* el tamaño y la posición los calcula pintarCelda() en el motor, para que
     el encuadre coincida exactamente con el PNG exportado */
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.cell.empty::after {
  content: "+";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 300;
  color: var(--ink-faint);
}

.cell.empty:hover::after { color: var(--ink); }
.cell.over { outline: 2px solid var(--sel); outline-offset: -2px; }

/* mientras se pregunta qué hay debajo del cursor, la pieza arrastrada
   no debe interceptar la consulta */
.item.arrastrando { pointer-events: none; }

/* reencuadre activo */
.cell.reframing { outline: 2px solid var(--sel); outline-offset: -2px; cursor: move; z-index: 3; }
.cell.reframing img { pointer-events: none; }

.reframe-hint {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 4px 2px;
  text-align: center;
  font-size: 7px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--veil);
  backdrop-filter: blur(6px);
  pointer-events: none;
}
.cell.dragging { opacity: 0.35; }

.cell-x {
  position: absolute;
  top: 3px; right: 3px;
  width: 17px; height: 17px;
  display: none;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

body.edit .cell:not(.empty):hover .cell-x { display: grid; }

.grid-foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px 11px;
}

.mini {
  height: 22px;
  padding: 0 9px;
  border: 1px solid var(--hair);
  background: transparent;
  color: var(--ink-soft);
  border-radius: var(--r-pill);
  font-family: inherit;
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}

.mini:hover { border-color: var(--ink); color: var(--ink); }

/* ============================================================
   CALENDARIO
   ============================================================ */

.item[data-type="calendar"] .wrap {
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-s);
  display: flex;
  flex-direction: column;
}

.cal-head {
  flex: none;
  padding: 13px 15px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--hair-soft);
}

.cal-month {
  font-size: 13px;
  font-weight: 500;
  text-transform: capitalize;
}

.cal-nav { display: flex; gap: 2px; }

.cal-nav button {
  width: 20px; height: 20px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  padding: 0;
}

.cal-nav button:hover { background: var(--hair-soft); color: var(--ink); }

.cal-dows {
  flex: none;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 9px 10px 5px;
}

.cal-dows span {
  text-align: center;
  font-size: 7.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.cal-days {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  padding: 0 10px 12px;
}

.day {
  position: relative;
  min-height: 34px;
  border-radius: 3px;
  padding: 3px 4px;
  cursor: pointer;
  overflow: hidden;
}

.day:hover { background: var(--hair-soft); }
.day.out { opacity: 0.28; }
.day.today .dnum { color: var(--paper); background: var(--ink); }

.dnum {
  display: inline-grid;
  place-items: center;
  min-width: 15px;
  height: 15px;
  border-radius: 50%;
  font-size: 9px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.dot {
  position: absolute;
  left: 4px; right: 4px; bottom: 4px;
  font-size: 7.5px;
  line-height: 1.3;
  color: var(--ink);
  max-height: 20px;
  overflow: hidden;
}

.day.has { background: var(--sel-soft); }

/* ---------- piezas agendadas en el calendario ---------- */

.cal-pins {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 2px;
}

.cal-pin {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 6.5px;
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: #2A2724;
  padding: 1.5px 3px;
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}

.cal-pin-t {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* quitar la fecha desde el propio calendario */
.cal-pin-x {
  flex: none;
  width: 9px;
  height: 9px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  font-size: 8px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
}

.cal-pin:hover .cal-pin-x { opacity: 1; }
.cal-pin-x:hover { background: rgba(0, 0, 0, 0.2); }

.cal-pin:hover { filter: brightness(0.94); }

/* cinta en la pieza agendada, con su mismo color */
.cinta {
  position: absolute;
  top: 8px;
  left: -6px;
  z-index: 8;
  font-size: 7.5px;
  letter-spacing: 0.1em;
  color: #2A2724;
  padding: 2.5px 7px;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* botón de rayo: agendar */
.rayo {
  position: absolute;
  top: 6px;
  right: 32px;
  width: 22px;
  height: 22px;
  display: none;
  place-items: center;
  border: 1px solid var(--hair);
  border-radius: 50%;
  background: var(--veil);
  backdrop-filter: blur(8px);
  color: var(--ink-soft);
  cursor: pointer;
  z-index: 8;
  padding: 0;
}

.rayo svg { width: 12px; height: 12px; }
.rayo:hover { color: var(--ink); border-color: var(--ink); }

body.edit .item:hover .rayo,
body.edit .item.sel .rayo { display: grid; }

/* ============================================================
   GUION Y PLAN DE RODAJE — filas de dos columnas
   ============================================================ */

.item[data-type="script"] .wrap,
.item[data-type="callsheet"] .wrap {
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-s);
  display: flex;
  flex-direction: column;
}

.sheet-head {
  flex: none;
  padding: 14px 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sheet-kicker {
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.sheet-name {
  flex: none;
  padding: 9px 16px 12px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  outline: none;
  border-bottom: 1px solid var(--hair-soft);
}

.sheet-cols {
  flex: none;
  display: grid;
  grid-template-columns: 62px 1fr 1fr;
  gap: 10px;
  padding: 9px 16px 7px;
  border-bottom: 1px solid var(--hair-soft);
}

.sheet-cols span {
  font-size: 7.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.sheet-rows {
  flex: 1 0 auto;
  overflow: visible;
  padding: 10px 16px 14px;
}

.srow {
  display: grid;
  grid-template-columns: 62px 1fr 1fr;
  gap: 10px;
  margin-bottom: 9px;
  font-size: 11.5px;
  line-height: 1.5;
}

.srow > div { outline: none; }
.srow .c0 { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.srow > div:empty::before { content: attr(data-ph); color: var(--ink-faint); }

.sheet-foot { flex: none; padding: 0 16px 13px; }

/* ============================================================
   MENÚ DE DESCARGAS
   ============================================================ */

.pop-list { min-width: 214px; }

.pop-list button {
  width: 100%;
  height: 30px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}

.pop-list button:hover { background: var(--hair-soft); }
.pop-list button svg { width: 14px; height: 14px; opacity: 0.6; flex: none; }
.pop-list .ctx-sep { height: 1px; background: var(--hair); margin: 5px 4px; }

/* vista de exportación a PDF */
.print-only { display: none; }

@media print {
  body > *:not(.print-only) { display: none !important; }
  .print-only { display: block !important; }
  .print-only img { max-width: 100%; }
  @page { margin: 12mm; }
}

/* ============================================================
   TIRA DE IMÁGENES — compartida por styling, beauty y casting
   ============================================================ */

.rack {
  flex: none;
  display: flex;
  gap: 4px;
  padding: 11px 15px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--hair-soft);
}

.rack::-webkit-scrollbar { display: none; }

.rack-item {
  position: relative;
  flex: none;
  width: 58px;
  aspect-ratio: 4 / 5;
  background: var(--hair-soft) center / cover no-repeat;
  border-radius: 2px;
  cursor: pointer;
  overflow: hidden;
}

.rack-add {
  flex: none;
  width: 58px;
  aspect-ratio: 4 / 5;
  border: 1px dashed var(--hair);
  border-radius: 2px;
  background: transparent;
  color: var(--ink-faint);
  font-size: 15px;
  font-weight: 300;
  cursor: pointer;
  padding: 0;
}

.rack-add:hover { border-color: var(--ink); color: var(--ink); }
.rack-item.over { outline: 2px solid var(--sel); outline-offset: -2px; }
.rack-item .cell-x { top: 2px; right: 2px; width: 15px; height: 15px; font-size: 10px; }
body.edit .rack-item:hover .cell-x { display: grid; }

/* ============================================================
   STYLING
   ============================================================ */

.item[data-type="styling"] .wrap,
.item[data-type="beauty"] .wrap,
.item[data-type="casting"] .wrap {
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-s);
  display: flex;
  flex-direction: column;
}

.item[data-type="styling"] .sheet-cols,
.item[data-type="beauty"] .sheet-cols { grid-template-columns: 1fr 1fr 1.1fr; }

.item[data-type="styling"] .srow,
.item[data-type="beauty"] .srow { grid-template-columns: 1fr 1fr 1.1fr; }

.item[data-type="styling"] .srow .c0 { color: var(--ink); }

/* ============================================================
   BEAUTY — zonas fijas del rostro
   ============================================================ */

.zones {
  flex: 1 0 auto;
  overflow: visible;
  padding: 12px 15px 15px;
}

.zone {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 11px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid var(--hair-soft);
}

.zone:last-child { border-bottom: 0; }

.zone-k {
  font-size: 7.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-top: 2px;
}

.zone-v {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink);
  outline: none;
}

.zone-v:empty::before { content: attr(data-ph); color: var(--ink-faint); }

/* ============================================================
   CASTING — ficha de modelo
   ============================================================ */

.cast-photo {
  flex: none;
  aspect-ratio: 4 / 5;
  background: var(--hair-soft) center / cover no-repeat;
  position: relative;
  cursor: pointer;
}

.cast-photo.empty::after {
  content: "Añadir retrato";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.cast-photo:hover .cell-x { display: grid; }

.cast-id { flex: none; padding: 14px 16px 11px; border-bottom: 1px solid var(--hair-soft); }

.cast-kicker {
  font-size: 7.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}

.cast-name {
  font-size: 19px;
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -0.01em;
  outline: none;
}

.cast-name:empty::before { content: "Nombre de la modelo"; color: var(--ink-faint); }

.cast-agency {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 6px;
  outline: none;
}

.cast-agency:empty::before { content: "Agencia"; color: var(--ink-faint); }

.facts {
  flex: 1 0 auto;
  overflow: visible;
  padding: 4px 16px 14px;
}

.fact {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--hair-soft);
}

.fact:last-child { border-bottom: 0; }

.fact-k {
  flex: none;
  font-size: 7.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.fact-v {
  font-size: 11.5px;
  color: var(--ink);
  text-align: right;
  outline: none;
  min-width: 40px;
}

.fact-v:empty::before { content: "—"; color: var(--ink-faint); }

/* ============================================================
   TÍTULO DEL BOARD EDITABLE
   ============================================================ */

body.edit .mark-doc [contenteditable] { outline: none; border-radius: 3px; padding: 1px 3px; margin: 0 -3px; }
body.edit .mark-doc [contenteditable]:hover { background: var(--hair-soft); }
body.edit .mark-doc [contenteditable]:focus { background: var(--hair-soft); box-shadow: inset 0 0 0 1px var(--hair); }

/* Todo en una línea: título · cliente · fecha */
.mark-doc {
  display: inline-flex;
  overflow: visible;
  align-items: baseline;
  gap: 0;
  white-space: nowrap;
}

.mark-doc .doc-sep { color: var(--ink-faint); padding: 0 6px; flex: none; }
.mark-doc .board-meta { color: var(--ink-soft); }
.mark-doc .board-fecha { color: var(--ink-faint); flex: none; }
.mark-doc .board-title:empty::before { content: "Título del board"; color: var(--ink-faint); }
.mark-doc .board-meta:empty::before { content: "Cliente"; color: var(--ink-faint); }

/* en pantallas estrechas se recorta el cliente antes que la fecha */
.mark-doc .board-meta { overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }

/* la fecha solo se esconde en pantallas de verdad estrechas */
@media (max-width: 620px) {
  .mark-doc .board-fecha,
  .mark-doc .doc-sep:last-of-type { display: none; }
}

/* ---------- hoja de información ---------- */

.info-sheet { width: min(520px, 100%); }

.info-sheet h3 {
  margin: 0 0 14px;
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.info-body { font-size: 13px; line-height: 1.7; color: var(--ink-soft); }
.info-body p { margin: 0 0 12px; }
.info-body strong { color: var(--ink); font-weight: 500; }
.info-body ol, .info-body ul { margin: 0 0 12px; padding-left: 20px; }
.info-body li { margin-bottom: 6px; }

/* swatch de color */
.item[data-type="color"] .wrap {
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-s);
  display: flex;
  flex-direction: column;
}

.chip { flex: 1; min-height: 0; }

.chip-meta {
  padding: 8px 10px;
  border-top: 1px solid var(--hair-soft);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.chip-meta strong { color: var(--ink); font-weight: 400; }

/* tarjeta de link */
.item[data-type="link"] .wrap {
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-s);
}

.link-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: var(--ink);
}

.link-thumb {
  flex: 1;
  min-height: 0;
  background: var(--hair-soft) center / cover no-repeat;
}

.link-meta { flex: none; padding: 14px 16px; }
.link-t { font-size: 13px; line-height: 1.45; margin-bottom: 7px; }
.link-hint { margin-top: 6px; }

.link-h {
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* Aviso cuando un embed no llega a cargar — mejor esto que un cuadro blanco mudo */
.embed-fallback {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
  background: var(--paper-raised);
  border: 1px dashed var(--hair);
  border-radius: var(--r-card);
  z-index: 2;
}

.item[data-embed="failed"] .embed-fallback { display: flex; }

.embed-fallback p {
  margin: 0;
  font-size: 11px;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 240px;
}

.embed-fallback .micro { color: var(--ink-faint); }

/* archivo subido: PDF, documento, audio */
.item[data-type="file"] .wrap {
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-s);
}

.file-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px 18px;
  height: 100%;
  cursor: pointer;
}

.file-badge {
  align-self: flex-start;
  font-size: 8px;
  letter-spacing: 0.16em;
  padding: 3px 7px;
  border: 1px solid var(--hair);
  border-radius: 4px;
  color: var(--ink-soft);
  margin-bottom: 11px;
}

.file-name {
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  word-break: break-word;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.file-hint {
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- tipografía subida ----------
   De una fuente lo que importa es cómo se ve, no su nombre de archivo.
   La tarjeta carga la letra de verdad y la enseña. */

.font-card {
  display: flex;
  flex-direction: column;
  padding: 16px 18px 14px;
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-s);
  min-height: 100%;
  height: auto;
  overflow: hidden;
}

.font-head { margin-bottom: 12px; }

.font-kicker {
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 3px;
}

.font-name {
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink);
  word-break: break-word;
}

.font-muestra { flex: 1; min-height: 0; color: var(--ink); }

.font-abc {
  font-size: 54px;
  line-height: 1.05;
  margin-bottom: 10px;
  word-break: break-word;
}

.font-set {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
  word-break: break-word;
  margin-bottom: 10px;
}

.font-frase {
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  outline: none;
}

.font-aviso {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  padding: 10px 0;
}

.font-pie {
  margin-top: 12px;
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.file-audio {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-s);
  min-height: 100%;
  height: auto;
}

.file-audio .file-name { margin: 0; font-size: 11px; }
.file-audio audio { width: 100%; height: 34px; }
.file-audio .file-hint { margin: 0; }

/* Formato que este navegador no sabe tocar (un .wma, o un .flac en algunos
   Safari). En vez de unos controles muertos, se dice qué pasa y se ofrece
   lo único que sí sirve: bajarlo y abrirlo fuera. */
.file-audio.audio-roto .file-hint { color: #C2410C; letter-spacing: 0.08em; }

.audio-dl {
  align-self: flex-start;
  height: 27px;
  font-size: 8.5px;
}

/* ---------- texto plano: se leen las primeras líneas ---------- */

.file-texto {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-s);
  min-height: 100%;
  height: auto;
  overflow: hidden;
}

.texto-mini {
  flex: 1;
  min-height: 0;
  /* tope: la tarjeta crece con su contenido, pero una previsualización no
     puede convertirse en una columna de tres metros */
  max-height: 240px;
  margin: 8px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
}

/* visor de PDF a pantalla completa */
.viewer {
  position: fixed;
  inset: 0;
  background: var(--paper);
  display: none;
  flex-direction: column;
  z-index: 260;
}

.viewer.on { display: flex; }

.viewer-bar {
  flex: none;
  height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--hair);
  background: var(--paper);
}

.viewer-name {
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50vw;
}

.viewer-grow { flex: 1; }
.viewer .btn { text-decoration: none; }

.viewer-frame {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 0;
  background: var(--hair-soft);
}

/* línea / flecha */
.item[data-type="line"] .wrap {
  overflow: visible;
  background: transparent;
  border: 0;
}

.item[data-type="line"] svg { display: block; width: 100%; height: 100%; overflow: visible; }
.item[data-type="line"] svg path { stroke: var(--ink); }

/* ---------- pincel ---------- */

.item[data-type="draw"] .wrap {
  overflow: visible;
  background: transparent;
  border: 0;
}

.item[data-type="draw"] svg { display: block; width: 100%; height: 100%; overflow: visible; }
.item[data-type="draw"] svg path { stroke: var(--ink); }

/* El trazo mientras lo estás dibujando: va suelto sobre el lienzo, sin ser
   todavía una pieza. Al soltar el dedo se convierte en una. */
.trazo-vivo {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 9998;
}

.trazo-vivo path { stroke: var(--ink); }

body[data-tool="brush"] #stage { cursor: crosshair; }

/* pie de foto */
.cap {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 9px;
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  pointer-events: none;
}

/* botón de sonido */
.snd {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 24px; height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--veil);
  backdrop-filter: blur(8px);
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: auto;
}

.item[data-type="video"]:hover .snd { opacity: 1; }

/* ---------- mini reproductor de video ----------
   Aparece al acercar el ratón y desaparece al salir: el video queda
   limpio mientras se reproduce. Va por encima del escudo de edición. */

.vplayer {
  position: absolute;
  left: 8px; right: 8px; bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  background: var(--veil);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border: 1px solid var(--hair);
  border-radius: var(--r-pill);
  opacity: 0;
  transition: opacity 0.18s;
  z-index: 6;
}

.item[data-type="video"]:hover .vplayer,
.vplayer.hold { opacity: 1; }

.vplayer .ico { width: 24px; height: 24px; flex: none; color: var(--ink); }
.vplayer .ico svg { width: 13px; height: 13px; }
.vplayer input[type="range"] { flex: 1; width: auto; min-width: 40px; }

.vtime {
  flex: none;
  font-size: 8.5px;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- pieza subiéndose ----------
   Previsualización difuminada del propio archivo + barra de progreso real. */

.item.uploading img,
.item.uploading video { filter: blur(14px) saturate(1.05); transform: scale(1.05); }
.item.uploading .vplayer { display: none; }

.upwrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 7;
  pointer-events: none;
}

.uplabel {
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--veil);
  padding: 5px 11px;
  border-radius: var(--r-pill);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.upbar {
  width: 56%;
  height: 2px;
  background: rgba(127, 127, 127, 0.3);
  border-radius: 2px;
  overflow: hidden;
}

.upbar i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--ink);
  transition: width 0.15s linear;
}

/* Escudo: permite arrastrar embeds/videos con la herramienta Selección.
   Solo en modo EDICIÓN — en modo lectura el cliente interactúa directo
   (dar play a YouTube, Spotify…). Y un embed "activado" (.live, por doble
   clic) baja su escudo para poder reproducirlo también mientras editas. */
.shield { position: absolute; inset: 0; display: none; }
body.edit[data-tool="select"] .item:not(.live) .shield,
body.edit[data-tool="crop"] .item:not(.live) .shield { display: block; }

.item.live .wrap { box-shadow: 0 0 0 2px var(--sel); }
.item[data-type="embed"] .shield { cursor: pointer; }

/* ---------- selección ---------- */

.item.sel .wrap { box-shadow: 0 0 0 1px var(--sel), var(--shadow-s); }
.item.sel[data-type="text"] .wrap { box-shadow: 0 0 0 1px var(--sel); }

.h {
  position: absolute;
  display: none;
  width: 8px; height: 8px;
  background: var(--paper-raised);
  border: 1px solid var(--sel);
  z-index: 6;
}

body[data-tool="select"] .item.sel.only .h { display: block; }

.h[data-h="nw"] { left: -4px;  top: -4px;    cursor: nwse-resize; }
.h[data-h="ne"] { right: -4px; top: -4px;    cursor: nesw-resize; }
.h[data-h="sw"] { left: -4px;  bottom: -4px; cursor: nesw-resize; }
.h[data-h="se"] { right: -4px; bottom: -4px; cursor: nwse-resize; }

.h[data-h="rot"] {
  left: 50%; top: -26px;
  margin-left: -4px;
  border-radius: 50%;
  cursor: grab;
}
.h[data-h="rot"]::before {
  content: "";
  position: absolute;
  left: 50%; top: 100%;
  width: 1px; height: 18px;
  background: var(--sel);
}

/* marquee de selección */
#marquee {
  position: fixed;
  display: none;
  border: 1px solid var(--sel);
  background: var(--sel-soft);
  pointer-events: none;
  z-index: 40;
}

/* guías de alineación */
.guide {
  position: absolute;
  background: var(--sel);
  pointer-events: none;
  z-index: 7;
}

/* ---------- recorte ---------- */

.item.cropping .wrap { overflow: visible; }

.crop-veil {
  position: absolute;
  inset: 0;
  outline: 9999px solid rgba(0, 0, 0, 0.42);
  outline-offset: 0;
  pointer-events: none;
  z-index: 4;
}

.crop-frame {
  position: absolute;
  border: 1px solid #fff;
  z-index: 5;
}

.crop-h {
  position: absolute;
  width: 12px; height: 12px;
  background: #fff;
  z-index: 6;
}

/* ---------- barra superior ---------- */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 54px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  z-index: 60;
  pointer-events: none;
}

.topbar > * { pointer-events: auto; }

.mark {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
  /* La marca se encoge al estrecharse la ventana, pero la liebre y la
     palabra son máscaras de ancho fijo: sin recortar, se salían de su caja
     y quedaban ENCIMA de los botones de la derecha, que dejaban de
     responder al clic aunque se vieran. */
  overflow: hidden;
}

.mark-name {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
}

/* La liebre y la palabra son máscaras teñidas con la tinta del tema: en claro
   salen negras y en oscuro claras, sin necesidad de dos archivos. */
.marca-liebre,
.marca-palabra {
  display: block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center;  mask-position: center;
  -webkit-mask-size: contain;     mask-size: contain;
}

.marca-liebre {
  width: 26px; height: 18px;          /* 2243.76 × 1580.32 */
  -webkit-mask-image: url("imagotipo.svg");
  mask-image: url("imagotipo.svg");
}

.marca-palabra {
  width: 102px; height: 12px;         /* 1870.05 × 220.7 */
  -webkit-mask-image: url("logotipo.svg");
  mask-image: url("logotipo.svg");
}

a.mark-home {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  letter-spacing: 0.3em;
}

/* la marca lleva a la biblioteca: se ilumina al pasar por encima */
a.mark-home { opacity: 0.78; transition: opacity 0.15s; }
a.mark-home:hover { opacity: 1; }

.mark-doc {
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}

/* Los controles de la derecha mandan: nunca se encogen ni se dejan tapar. */
.top-right { display: flex; align-items: center; gap: 8px; flex: none; }

/* En pantallas estrechas la palabra sobra — la liebre ya identifica la marca
   y así queda sitio para los botones, que es lo que hace falta poder tocar. */
@media (max-width: 720px) {
  .marca-palabra { display: none; }
  .mark { gap: 10px; }
}

.savestate {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  transition: color 0.2s;
  white-space: nowrap;
}

.savestate[data-state="saving"] { color: var(--ink-soft); }
.savestate[data-state="saved"] { color: var(--ink-faint); }
.savestate[data-state="error"] { color: #C2410C; }
/* guardado frenado a propósito para no borrar trabajo: se tiene que ver */
.savestate[data-state="frenado"] { color: #C2410C; font-weight: 500; }
body:not(.edit) .savestate { display: none; }

/* ---------- botones ---------- */

.btn {
  height: 30px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--hair);
  background: var(--paper-raised);
  color: var(--ink);
  border-radius: var(--r-pill);
  font-family: inherit;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s, opacity 0.15s;
}

.btn:hover { border-color: var(--ink-faint); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn:disabled:hover { border-color: var(--hair); }
.btn.solid { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.ico {
  width: 32px; height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  border-radius: 9px;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}

.ico svg { width: 16px; height: 16px; display: block; }
.ico:hover { background: var(--hair-soft); }
.ico.on { background: var(--ink); color: var(--paper); }
.ico:disabled { opacity: 0.28; cursor: default; }
.ico:disabled:hover { background: transparent; }

/* ---------- dock inferior ---------- */

.dock {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  background: var(--veil);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--hair);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-l);
  max-width: calc(100vw - 28px);
  overflow-x: auto;
  scrollbar-width: none;
}

.dock::-webkit-scrollbar { display: none; }

.dock .ico { flex: none; }

.dock .sep {
  flex: none;
  width: 1px;
  height: 20px;
  background: var(--hair);
  margin: 0 6px;
}

/* En tableta el dock se pasaba por unos pocos píxeles y el último botón
   quedaba fuera. Apretando los separadores cabe entero, sin tener que
   arrastrar la barra para llegar a Guardar. */
@media (max-width: 860px) {
  .dock .sep { margin: 0 2px; }
  .dock { padding: 6px 4px; }
}

/* etiqueta flotante */
.tip {
  position: fixed;
  padding: 5px 9px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 5px;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 300;
  white-space: nowrap;
}

.tip.on { opacity: 1; }
.tip kbd {
  font-family: inherit;
  opacity: 0.5;
  margin-left: 5px;
}

/* ---------- inspector flotante ---------- */

.inspector {
  position: fixed;
  display: none;
  align-items: center;
  gap: 2px;
  padding: 5px;
  background: var(--veil);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--hair);
  border-radius: 11px;
  box-shadow: var(--shadow-l);
  z-index: 80;
  max-width: calc(100vw - 24px);
  flex-wrap: nowrap;
}

.inspector.on { display: flex; }

/* Con la burbuja de formato abierta, el inspector se esconde: nunca dos
   barras encima del mismo texto. */
body.bubbling .inspector.on { display: none; }
.inspector .sep { width: 1px; height: 18px; background: var(--hair); margin: 0 5px; }

.field {
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 11px;
  border-radius: 7px;
  padding: 0 7px;
  cursor: pointer;
  outline: none;
}

.field:hover { background: var(--hair-soft); }

select.field {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 18px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 10px) 13px, calc(100% - 6px) 13px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

.field.num { width: 46px; text-align: center; padding: 0; cursor: text; font-variant-numeric: tabular-nums; }

/* cuerpo de letra con flechitas */
.stepper { display: inline-flex; align-items: center; }
.stepper select.field { padding-right: 14px; background-image: none; }

.step-arrows { display: inline-flex; flex-direction: column; margin-left: -2px; }

.step {
  width: 15px;
  height: 13px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font-size: 6px;
  line-height: 1;
  cursor: pointer;
  border-radius: 3px;
  display: grid;
  place-items: center;
}

.step:hover { background: var(--hair-soft); color: var(--ink); }
.field.font { max-width: 132px; }

.swatch-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--hair);
  border-radius: 7px;
  padding: 2px;
  background: var(--paper-raised);
  cursor: pointer;
}
.swatch-btn i { display: block; width: 100%; height: 100%; border-radius: 4px; }

input[type="color"] {
  width: 28px; height: 28px;
  padding: 0;
  border: 1px solid var(--hair);
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 4px; }

/* ---------- menú contextual ---------- */

.ctx {
  position: fixed;
  display: none;
  min-width: 208px;
  padding: 6px;
  background: var(--veil);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--hair);
  border-radius: 11px;
  box-shadow: var(--shadow-l);
  z-index: 200;
}

.ctx.on { display: block; }

.ctx button {
  width: 100%;
  height: 29px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}

.ctx button:hover { background: var(--hair-soft); }
.ctx button:disabled { opacity: 0.32; cursor: default; background: transparent; }
.ctx button span { font-size: 9.5px; letter-spacing: 0.1em; color: var(--ink-faint); }
.ctx .ctx-sep { height: 1px; background: var(--hair); margin: 5px 4px; }
.ctx .danger:hover { background: rgba(220, 38, 38, 0.1); color: #DC2626; }

/* ---------- popover (alinear, insertar) ---------- */

.pop {
  position: fixed;
  display: none;
  padding: 7px;
  background: var(--veil);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--hair);
  border-radius: 11px;
  box-shadow: var(--shadow-l);
  z-index: 210;
}

.pop.on { display: block; }
.pop-row { display: flex; gap: 2px; }
.pop-label {
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 5px 6px 7px;
}

/* ---------- pomodoro ---------- */

.pomo-btn { font-variant-numeric: tabular-nums; }
.pomo-btn.andando { border-color: var(--ink); color: var(--ink); }

.pop-pomo { width: 232px; padding: 8px; }
.pomo-opciones { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.pomo-opciones .btn { width: 100%; justify-content: center; }

.pomo-otro { display: flex; gap: 5px; margin-top: 7px; }

.pomo-min {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--hair);
  background: var(--paper-raised);
  border-radius: var(--r-pill);
  padding: 0 12px;
  font: inherit;
  font-size: 11.5px;
  color: var(--ink);
  outline: none;
}

.pomo-min:focus { border-color: var(--ink-faint); }
.pomo-restante {
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  padding: 2px 6px 10px;
}
.pomo-parar { width: 100%; justify-content: center; }

/* La pantalla de descanso: ocupa todo y no deja seguir sin verla. */
.pomo-fin {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: var(--veil);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  z-index: 300;
}

.pomo-fin.on { display: grid; animation: pomoEntra 0.5s ease both; }

@keyframes pomoEntra { from { opacity: 0; } to { opacity: 1; } }

.pomo-fin-caja { text-align: center; padding: 30px; }

.pomo-estrella {
  width: 108px;
  height: 108px;
  display: block;
  margin: 0 auto 26px;
  fill: var(--ink);
  animation: pomoEstrella 5s ease-in-out infinite;
}

/* Gira despacio y respira: la idea es que se sienta calma, no urgencia. */
@keyframes pomoEstrella {
  0%   { transform: rotate(0deg) scale(0.9); opacity: 0.85; }
  50%  { transform: rotate(180deg) scale(1.05); opacity: 1; }
  100% { transform: rotate(360deg) scale(0.9); opacity: 0.85; }
}

.pomo-fin-t {
  font-family: "Instrument Serif", serif;
  font-size: 32px;
  line-height: 1.25;
  color: var(--ink);
  margin-bottom: 10px;
}

.pomo-fin-s {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 26px;
}

@media (prefers-reduced-motion: reduce) {
  .pomo-estrella { animation: none; }
  .pomo-fin.on { animation: none; }
}

/* ---------- buscar dentro del board ---------- */

.pop-search { width: 280px; padding: 8px; }

.pop-search-input {
  width: 100%;
  border: 1px solid var(--hair);
  background: var(--paper-raised);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  outline: none;
}

.pop-search-input:focus { border-color: var(--ink-faint); }

.pop-search-results {
  margin-top: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.pop-search-hint {
  padding: 10px 6px;
  font-size: 11.5px;
  color: var(--ink-faint);
}

.pop-search-hit {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  padding: 8px 8px;
  border: 0;
  border-radius: 7px;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pop-search-hit:hover { background: var(--hair-soft); }

.pop-search-hit .hit-t {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pop-search-hit .hit-k {
  flex: none;
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- modales ---------- */

.scrim {
  position: fixed;
  inset: 0;
  background: var(--veil);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 250;
  padding: 24px;
}

.scrim.on { display: flex; }

.sheet {
  width: min(560px, 100%);
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  border-radius: 14px;
  box-shadow: var(--shadow-l);
  padding: 26px;
}

.sheet h2 {
  margin: 0 0 6px;
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.sheet p {
  margin: 0 0 18px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.input {
  width: 100%;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--hair);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.input:focus { border-color: var(--ink-faint); }

.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* editor de documento a pantalla completa */
.doc-scrim {
  position: fixed;
  inset: 0;
  background: var(--paper);
  display: none;
  flex-direction: column;
  z-index: 260;
}

.doc-scrim.on { display: flex; }

.doc-bar {
  flex: none;
  height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--hair);
  background: var(--paper);
}

.doc-tools {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}
.doc-tools::-webkit-scrollbar { display: none; }

.doc-actions { flex: none; display: flex; align-items: center; gap: 7px; }

/* Modo lectura (el link del cliente): el documento se lee, no se edita.
   Fuera la barra de herramientas, Guardar y Descartar; solo Cerrar. */
.doc-scrim.leer .doc-tools,
.doc-scrim.leer [data-d="save"],
.doc-scrim.leer [data-d="cancel"] { display: none; }

/* Descargar sigue estando en modo lectura: el cliente entra así, y
   llevarse el documento es justo lo que va a querer hacer. */
.doc-actions .sep {
  width: 1px;
  height: 18px;
  background: var(--hair);
  margin: 0 3px;
}

.doc-scrim.leer .doc-actions .sep { display: none; }
.doc-scrim:not(.leer) [data-d="close"] { display: none; }
.doc-scrim.leer .doc-actions { flex: 1; justify-content: flex-end; }
.doc-scrim.leer .doc-name { cursor: default; }

.doc-bar .ico { flex: none; }
.doc-bar .field { flex: none; }
.doc-bar .sep { flex: none; width: 1px; height: 18px; background: var(--hair); margin: 0 7px; }

.doc-sheet {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 56px 24px 140px;
}

.doc-page {
  max-width: 720px;
  margin: 0 auto;
}

.doc-name {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 34px;
  letter-spacing: -0.02em;
  font-weight: 500;
  outline: none;
  margin-bottom: 8px;
}

.doc-name::placeholder { color: var(--ink-faint); }

.doc-meta {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-bottom: 22px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--hair);
}

.doc-body {
  outline: none;
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
  min-height: 50vh;
}

.doc-body h1 { font-size: 27px; line-height: 1.25; margin: 34px 0 12px; font-weight: 500; letter-spacing: -0.015em; }
.doc-body h2 { font-size: 20px; line-height: 1.3;  margin: 28px 0 10px; font-weight: 500; }
.doc-body h3 { font-size: 15px; line-height: 1.4;  margin: 22px 0 8px;  font-weight: 500; letter-spacing: 0.02em; }
.doc-body p { margin: 0 0 14px; }
.doc-body ul, .doc-body ol { margin: 0 0 14px; padding-left: 22px; }
.doc-body li { margin-bottom: 5px; }
.doc-body blockquote {
  margin: 20px 0;
  padding: 2px 0 2px 18px;
  border-left: 1px solid var(--hair);
  color: var(--ink-soft);
  font-style: italic;
}
.doc-body pre {
  background: var(--hair-soft);
  padding: 14px 16px;
  border-radius: 6px;
  font-size: 12.5px;
  overflow-x: auto;
  margin: 0 0 14px;
}
.doc-body hr { border: 0; border-top: 1px solid var(--hair); margin: 30px 0; }
.doc-body a { color: inherit; }
.doc-body img { max-width: 100%; border-radius: var(--r-card); }

/* ---------- aviso efímero ---------- */

.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  padding: 9px 17px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-pill);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
  z-index: 300;
}

.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- zoom ---------- */

.zoom {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 5px;
  background: var(--veil);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--hair);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-m);
  z-index: 60;
}

.zoom-val {
  min-width: 48px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

/* ---------- ayuda ---------- */

.legend {
  position: fixed;
  left: 20px;
  bottom: 24px;
  font-size: 8.5px;
  line-height: 2;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
  z-index: 50;
  pointer-events: none;
  max-width: 190px;
}

body:not(.edit) .legend { display: none; }

@media (max-width: 900px) { .legend { display: none; } }
@media (max-width: 620px) {
  /* El título se queda: es lo que te dice en qué board estás. Lo que sobra
     es el cliente y la fecha — antes se escondía la línea entera. */
  .mark-doc .board-meta,
  .mark-doc .board-fecha,
  .mark-doc .doc-sep { display: none; }
  .mark-doc { font-size: 12px; max-width: 52vw; }
  .dock { bottom: 12px; }
  .zoom { display: none; }
  .doc-sheet { padding: 32px 18px 120px; }
  .doc-name { font-size: 26px; }
}

@media print {
  .topbar, .dock, .zoom, .legend, .inspector, #grain { display: none !important; }
}

/* ============================================================
   BIBLIOTECA (dashboard) — carpetas por cliente y boards
   ============================================================ */

/* La biblioteca SÍ scrollea — es una página normal, no el lienzo.
   `html` manda: su overflow se propaga al viewport, así que con
   `html{overflow:hidden;height:100%}` no había forma de bajar por mucho que
   el body dijera `auto`. Con pocas carpetas no se notaba; en un teléfono, con
   la lista larga, todo lo que caía por debajo del pliegue era inalcanzable.
   La clase la pone index.html en la etiqueta <html>. */
html.dash-html,
html.dash-html body.dash {
  height: auto;
  min-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  /* el rebote elástico aquí sí lo queremos: es una lista, no un lienzo */
  overscroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
}

.dash-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 28px 90px;
}

.dash-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 26px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--hair);
}

.dash-brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.dash-brand h1 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--ink);
}

/* en la biblioteca la marca va un punto más grande que en el board */
.dash-brand .marca-liebre  { width: 30px; height: 21px; }
.dash-brand .marca-palabra { width: 118px; height: 14px; }

.dash-brand span {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.dash-actions { display: flex; align-items: center; gap: 8px; }

/* fila de carpetas */
.dash-folders {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.folder-chip {
  height: 32px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--hair);
  background: var(--paper-raised);
  color: var(--ink-soft);
  border-radius: var(--r-pill);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.folder-chip svg { width: 13px; height: 13px; opacity: 0.6; }
.folder-chip:hover { border-color: var(--ink-faint); color: var(--ink); }
.folder-chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.folder-chip.on svg { opacity: 1; }
.folder-chip .count { opacity: 0.5; font-variant-numeric: tabular-nums; }
.folder-chip.drop { border-color: var(--sel); border-style: dashed; color: var(--sel); }

/* Menú de la carpeta: a diferencia del "···" de una tarjeta de board (que
   solo aparece con :hover), este queda siempre algo visible — en touch no
   existe el hover, y sin esto no había forma fiable de encontrarlo. */
.folder-menu {
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  margin: 0 -4px 0 2px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  opacity: 0.5;
  font-size: 13px;
  line-height: 1;
  letter-spacing: 0.06em;
  cursor: pointer;
  flex: none;
}

.folder-menu:hover { opacity: 1; background: var(--hair-soft); }

/* rejilla de boards */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 20px;
}

.board-card {
  position: relative;
  border: 1px solid var(--hair);
  border-radius: 8px;
  background: var(--paper-raised);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.2s, transform 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.board-card:hover { border-color: var(--ink-faint); box-shadow: var(--shadow-m); transform: translateY(-2px); }
.board-card.dragging { opacity: 0.4; }

.board-cover {
  aspect-ratio: 4 / 3;
  background: var(--hair-soft) center / cover no-repeat;
  border-bottom: 1px solid var(--hair-soft);
  position: relative;
}

.board-cover.empty {
  display: grid;
  place-items: center;
}

/* portada con iniciales o icono sobre color */
.board-cover.mark {
  display: grid;
  place-items: center;
}

.cover-mark {
  font-family: "Instrument Serif", serif;
  font-size: 40px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #fff;
  mix-blend-mode: luminosity;
  opacity: 0.95;
}

.board-cover.empty::after {
  content: "";
  width: 34px; height: 34px;
  border: 1px solid var(--hair);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, var(--hair) 0 30%, transparent 31%);
  opacity: 0.6;
}

.board-body { padding: 13px 15px 15px; }

.board-title {
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--ink);
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.board-meta {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-menu {
  position: absolute;
  top: 8px; right: 8px;
  width: 26px; height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: var(--veil);
  backdrop-filter: blur(8px);
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  font-size: 15px;
  line-height: 1;
  padding: 0;
}

.board-card:hover .board-menu { opacity: 1; }

.dash-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--ink-faint);
}

.dash-empty p { font-size: 13px; line-height: 1.7; margin: 0 0 18px; }

/* buscador */
.dash-search {
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--hair);
  background: var(--paper-raised);
  color: var(--ink);
  border-radius: var(--r-pill);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  width: 200px;
  transition: border-color 0.15s, width 0.2s;
}

.dash-search:focus { border-color: var(--ink-faint); width: 240px; }

@media (max-width: 560px) {
  .dash-wrap { padding: 22px 16px calc(70px + env(safe-area-inset-bottom)); }
  .dash-search { width: 130px; }
  .dash-search:focus { width: 150px; }

  /* En el teléfono la cabecera no cabe en una línea: la marca arriba y,
     debajo, el buscador ocupando el ancho con los botones al lado. Antes se
     apretaban todos en la misma fila y el buscador quedaba en nada. */
  .dash-top {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding-bottom: 20px;
    margin-bottom: 22px;
  }
  .dash-actions { gap: 7px; }
  .dash-search { flex: 1; width: auto; min-width: 0; }
  .dash-search:focus { width: auto; }
}

/* ============================================================
   BOARD DENTRO DE BOARD
   ============================================================ */

.item[data-type="board"] .wrap {
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-m);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow 0.18s, transform 0.15s;
}

.item[data-type="board"]:hover .wrap {
  box-shadow: var(--shadow-l);
  transform: translateY(-2px);
}

.bcard-tapa {
  flex: none;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  position: relative;
}

.bcard-ico {
  font-size: 40px;
  line-height: 1;
  color: #2A2724;
  opacity: 0.55;
  user-select: none;
}

.bcard-pie {
  flex: 1;
  min-height: 0;
  padding: 12px 14px 4px;
}

.bcard-kicker {
  font-size: 7.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 5px;
}

.bcard-nombre {
  font-size: 14px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--ink);
  outline: none;
  word-break: break-word;
}

.bcard-abrir {
  flex: none;
  padding: 6px 14px 12px;
  font-size: 7.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
/* ============================================================
   LLUVIA DE IDEAS
   Un lienzo de papel hueso con una esfera en el centro. Dentro de ella,
   por su perímetro, los rótulos de las ideas; cada uno se pulsa y se
   desarrolla. Crema, luz y azul convergiendo.

   La geometría (el ángulo de cada rótulo, el tamaño de la esfera) la
   calcula el motor y la escribe en píxeles: aquí solo se viste.
   ============================================================ */

.bs-card {
  background: #F2EEE6;                 /* hueso */
  border: 1px solid #E2DBCC;
  border-radius: 3px;
  box-shadow: var(--shadow-m);
  overflow: hidden;
}

.bs-forma {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* el pelo que cierra la esfera */
.bs-contorno {
  fill: none;
  stroke: #26364A;
  stroke-width: 1;
  opacity: 0.16;
  vector-effect: non-scaling-stroke;
}

/* ---------- el título del lienzo ---------- */

.bs-titulo {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 20px;
  z-index: 2;
  text-align: center;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: 0.005em;
  color: #1C2A38;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.bs-card.compacta .bs-titulo { font-size: 16px; top: 16px; }

.bs-pie-nota {
  position: absolute;
  left: 0; right: 0;
  bottom: 14px;
  z-index: 2;
  text-align: center;
  font-size: 8px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6C7C8C;
  pointer-events: none;
}

/* ---------- un rótulo dentro de la esfera ---------- */

.bs-idea {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  text-align: center;
}

.bs-idea.der    { align-items: flex-start; text-align: left; }
.bs-idea.izq    { align-items: flex-end;   text-align: right; }
.bs-idea.centro { align-items: center;     text-align: center; }

.bs-rotulo {
  font-family: var(--ui);
  font-size: 11.5px;
  line-height: 1.35;
  color: #16222E;
  text-shadow: 0 1px 6px rgba(255, 255, 255, 0.7);
}

.bs-idea.pulsable { cursor: pointer; }
.bs-idea.pulsable:hover .bs-rotulo { color: #000; }

/* El botón: cristal. Se apoya en el degradado que tiene debajo y lo
   refleja, por eso el fondo es translúcido y no un color plano. */
.bs-dev {
  height: 22px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: var(--r-pill);
  background: linear-gradient(160deg,
    rgba(255, 255, 255, 0.92) 0%,
    rgba(255, 255, 255, 0.55) 46%,
    rgba(255, 255, 255, 0.78) 100%);
  backdrop-filter: blur(6px) saturate(150%);
  -webkit-backdrop-filter: blur(6px) saturate(150%);
  box-shadow: 0 1px 3px rgba(30, 52, 74, 0.16);
  color: #24384C;
  font-family: inherit;
  font-size: 7px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.18s, transform 0.18s;
}

/* aparece al acercarte: la esfera se lee limpia y la acción está donde la
   buscas en cuanto la buscas */
.bs-idea:hover .bs-dev,
.bs-idea .bs-dev:focus-visible,
.bs-idea.armando .bs-dev { opacity: 1; transform: none; }

.bs-dev:hover { color: #000; border-color: #FFF; }
.bs-dev:disabled { cursor: default; }

body:not(.edit) .bs-dev { display: none; }
.bs-idea.armando { cursor: default; }
.bs-idea.armando .bs-rotulo { opacity: 0.5; }

/* ---------- modo lista ----------
   Lo que se ve cuando la pieza se estrecha: al apilarla en una columna.
   La esfera se queda arriba, pequeña, y las ideas caen debajo. */

.bs-lista {
  position: absolute;
  left: 16px;
  right: 16px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bs-idea.lista {
  position: static;
  transform: none;
  width: auto;
  align-items: flex-start;
  text-align: left;
  gap: 4px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid #E6DFD1;
}

.bs-idea.lista .bs-dev { opacity: 1; transform: none; }

/* ---------- más ideas ---------- */

.bs-mas {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 3;
  height: 23px;
  padding: 0 13px;
  border: 1px solid #DDD5C6;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.7);
  color: #6C7C8C;
  font-family: inherit;
  font-size: 7px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s, color 0.15s, border-color 0.15s;
}

.bs-card:hover .bs-mas { opacity: 1; }
.bs-mas:hover { color: #16222E; border-color: #C6BCA8; }

/* ---------- mientras la IA piensa ----------
   Los degradados ya están ahí, convergiendo; encima, tres órbitas a un
   pelo girando a distinto ritmo y un núcleo que late. Se ve que dentro se
   está armando algo. */

.bs-orbita {
  fill: none;
  stroke: #4E7FA8;
  stroke-width: 1;
  opacity: 0.45;
  vector-effect: non-scaling-stroke;
  animation: bs-girar 7s linear infinite;
}

.bs-orbita.o2 { stroke: #B9A382; animation-duration: 11s; animation-direction: reverse; }
.bs-orbita.o3 { stroke: #7FA9D4; animation-duration: 9s; }

.bs-nucleo {
  fill: #FBF6EC;
  opacity: 0.9;
  animation: bs-latir 2.2s ease-in-out infinite;
}

@keyframes bs-girar {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes bs-latir {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .bs-orbita, .bs-nucleo { animation: none; }
}

/* ---------- migas de pan ---------- */

.migas {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  font-size: 10px;
  color: var(--ink-faint);
  margin-left: 14px;
  white-space: nowrap;
  overflow: hidden;
  max-width: 34vw;
}

.miga {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0 2px;
}

.miga:hover { color: var(--ink); text-decoration: underline; }
.miga.actual { color: var(--ink-faint); }
.miga-sep { padding: 0 5px; opacity: 0.5; }

@media (max-width: 820px) { .migas { display: none; } }

/* ---------- selector de símbolo y color del board ---------- */

.pop-board {
  width: 268px;
  max-height: 60vh;
  overflow-y: auto;
}

.simbolos {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 2px 4px 8px;
}

.simbolo {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.simbolo:hover { background: var(--hair-soft); }
.simbolo.on { border-color: var(--ink); background: var(--hair-soft); }

.tonos-board { padding: 2px 4px 4px; gap: 4px; }
.tonos-board .tone { width: 21px; height: 21px; }

/* board de destino al arrastrarle algo encima */
.item.destino-board .wrap {
  box-shadow: 0 0 0 3px var(--sel), var(--shadow-l);
  transform: translateY(-3px) scale(1.02);
}

.item.destino-board .bcard-abrir::after {
  content: " · soltar aquí";
  color: var(--sel);
}

/* ============================================================
   SELECCIÓN DE TEXTO — que no se pinte todo de azul al arrastrar
   ------------------------------------------------------------
   Los campos editables son contenteditable, y el navegador los hace
   seleccionables SIEMPRE. Al arrastrar una pieza, eso hacía que se
   marcara el texto de medio board. Solución: solo se puede seleccionar
   texto dentro del campo que estás editando de verdad (el que tiene el
   foco). El resto del lienzo no se selecciona nunca.
   ============================================================ */

#stage, #canvas { user-select: none; -webkit-user-select: none; }

.item [contenteditable],
.rich, .col-title, .col-body, .sl-name, .sl-shot, .todo-text,
.sheet-name, .srow > div, .zone-v, .cast-name, .cast-agency, .fact-v,
.grid-name, .rev-lab, .bcard-nombre, .doc-title, .todo-title {
  user-select: none;
  -webkit-user-select: none;
}

/* Al entrar a editar, el texto vuelve a ser seleccionable.
   Usamos la clase .editando (la pone el motor al recibir el foco) porque
   :focus no siempre coincide si la ventana del navegador no está activa. */
/* .item [contenteditable] tiene más peso que .editando a secas, así que
   el selector de aquí tiene que ser igual de específico o más. */
.item [contenteditable].editando,
.mark-doc [contenteditable].editando,
.item .editando,
.editando,
.item [contenteditable]:focus,
.rich:focus, .col-title:focus, .col-body:focus, .sl-name:focus,
.sl-shot:focus, .todo-text:focus, .sheet-name:focus, .srow > div:focus,
.zone-v:focus, .cast-name:focus, .cast-agency:focus, .fact-v:focus,
.grid-name:focus, .rev-lab:focus, .bcard-nombre:focus, .todo-title:focus {
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

/* la interfaz sí deja seleccionar: asistente, modales, documento */
.asis, .scrim, .doc-scrim, .viewer, #ctx, .pop, .info-sheet {
  user-select: text;
  -webkit-user-select: text;
}

/* el título del board en la barra: igual, solo al editarlo */
.mark-doc [contenteditable] { user-select: none; -webkit-user-select: none; }
.mark-doc [contenteditable]:focus { user-select: text; -webkit-user-select: text; }

/* ============================================================
   ASIGNACIÓN
   Un encargo: quién, para cuándo y qué se entrega.

   Lo que la hace distinta a todo lo demás del lienzo es que quien recibe
   el LINK —sin clave de edición— también la toca: puede ajustar su fecha
   y subir entregables. Por eso sus controles siguen vivos en modo
   lectura, cuando todos los demás están apagados.
   ============================================================ */

.asig {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 15px 15px;
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-s);
  min-height: 100%;
  height: auto;
}

.asig-cab { display: flex; flex-direction: column; gap: 3px; }

.asig-kicker {
  font-size: 7.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.asig-quien {
  font-size: 15px;
  line-height: 1.25;
  font-weight: 500;
  color: var(--ink);
  outline: none;
  word-break: break-word;
}

.asig-quien:empty::before {
  content: attr(data-ph);
  color: var(--ink-faint);
  font-weight: 400;
}

body.edit .asig-quien:hover { background: var(--hair-soft); }
body.edit .asig-quien:focus { background: var(--hair-soft); box-shadow: inset 0 0 0 1px var(--hair); }

.asig-tarea {
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--ink-soft);
}

/* ---------- la fecha ---------- */

.asig-fecha {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 9px;
  border-top: 1px solid var(--hair-soft);
}

.asig-lab {
  flex: none;
  font-size: 7.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.asig-input {
  flex: 1;
  min-width: 150px;
  height: 27px;
  padding: 0 8px;
  border: 1px solid var(--hair);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-size: 11px;
  outline: none;
}

.asig-input:focus { border-color: var(--ink-faint); }
.asig-input:disabled { opacity: 0.5; }

.asig-cuenta {
  flex: none;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.asig-cuenta.cerca { color: #B45309; }
.asig-cuenta.tarde { color: #C2410C; font-weight: 500; }

/* la fecha escrita en cristiano, para el que solo mira */
.asig-legible {
  font-size: 9.5px;
  color: var(--ink-faint);
}

/* ---------- entregables ---------- */

.asig-archivos { display: flex; flex-direction: column; gap: 7px; }

.asig-lista { display: flex; flex-direction: column; gap: 4px; }

.asig-vacio {
  font-size: 10px;
  color: var(--ink-faint);
  padding: 2px 0;
}

.asig-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border: 1px solid var(--hair-soft);
  border-radius: 8px;
  background: var(--paper);
}

.asig-ext {
  flex: none;
  min-width: 30px;
  text-align: center;
  font-size: 7px;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}

.asig-nom {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asig-nom:hover { text-decoration: underline; }

.asig-peso {
  flex: none;
  font-size: 9px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.asig-x {
  flex: none;
  width: 18px; height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-faint);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.asig-x:hover { background: var(--hair-soft); color: var(--ink); }

.asig-subir,
.asig-todo {
  align-self: flex-start;
  height: 27px;
  padding: 0 13px;
  border: 1px solid var(--hair);
  border-radius: var(--r-pill);
  background: var(--paper-raised);
  color: var(--ink);
  font-family: inherit;
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.asig-subir { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.asig-subir:hover { opacity: 0.88; }
.asig-todo:hover { border-color: var(--ink-faint); }

/* avance de la subida */
.asig-barra {
  height: 2px;
  border-radius: 2px;
  background: var(--hair-soft);
  overflow: hidden;
}

.asig-barra i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ink);
  transition: width 0.2s;
}

/* cerrada: se ve que ya no admite entregas */
.asig-cerrada .asig-kicker { color: #C2410C; }

/* ---------- la esfera sin ideas ----------
   Si la IA falló, el motivo se queda escrito DENTRO de la esfera. Antes
   solo salía en un aviso que se iba a los dos segundos, así que la esfera
   se quedaba vacía sin decir por qué y parecía rota. */

.bs-hueco {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  text-align: center;
}

.bs-nota {
  font-size: 10.5px;
  line-height: 1.5;
  color: #33465C;
  text-shadow: 0 1px 6px rgba(255, 255, 255, 0.8);
}

.bs-nota.malo { color: #A8340C; }

.bs-reintentar {
  height: 25px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 1px 3px rgba(30, 52, 74, 0.16);
  color: #24384C;
  font-family: inherit;
  font-size: 7.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
}

.bs-reintentar:hover { color: #000; border-color: #FFF; }

/* ============================================================
   LA PUERTA — el diálogo de la clave de edición
   ------------------------------------------------------------
   Es lo primero que ve quien abre un board con permiso de edición, así
   que se merece su propia hoja: viene antes de que exista la interfaz
   y no puede depender de nada de ella.
   ============================================================ */

.clave-scrim {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--veil);
  backdrop-filter: blur(10px) saturate(115%);
  -webkit-backdrop-filter: blur(10px) saturate(115%);
  opacity: 0;
  transition: opacity 0.22s ease;
  font-family: var(--ui);
}

.clave-scrim.on { opacity: 1; }

.clave-sheet {
  width: min(420px, 100%);
  padding: 30px 30px 26px;
  border: 1px solid var(--hair);
  border-radius: var(--r-panel);
  background: var(--paper-raised);
  box-shadow: var(--shadow-l);
  transform: translateY(10px) scale(0.985);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.25, 1);
}

.clave-scrim.on .clave-sheet { transform: none; }

.clave-kicker {
  font-size: 8.5px;
  font-weight: 400;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 16px;
}

.clave-sheet h2 {
  margin: 0 0 10px;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 27px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.clave-texto {
  margin: 0 0 22px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-soft);
}

.clave-texto strong { color: var(--ink); font-weight: 500; }

/* el campo, con el botón de ver la clave dentro */
.clave-campo {
  position: relative;
  display: flex;
  align-items: center;
}

.clave-input {
  width: 100%;
  height: 46px;
  padding: 0 76px 0 15px;
  border: 1px solid var(--hair);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 14px;
  letter-spacing: 0.04em;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.clave-input::placeholder { color: var(--ink-faint); letter-spacing: 0; }

.clave-input:focus {
  border-color: var(--sel);
  box-shadow: 0 0 0 3px var(--sel-soft);
}

.clave-ojo {
  position: absolute;
  right: 6px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-faint);
  font-family: var(--ui);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.clave-ojo:hover { color: var(--ink); background: var(--hair-soft); }

.clave-error {
  display: none;
  margin-top: 10px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #B4553C;
}

.clave-error.on { display: block; }

.clave-acciones {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 22px;
}

.clave-acciones .btn { height: 38px; padding: 0 18px; font-size: 11px; }

.clave-acciones .btn[disabled] { opacity: 0.4; pointer-events: none; }

.clave-pie {
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--hair-soft);
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--ink-faint);
}

/* botón de la barra superior para quien entró como cliente y sí tiene clave */
.btn-clave { white-space: nowrap; }

@media (max-width: 720px) {
  .clave-sheet { padding: 24px 22px 22px; }
  .clave-sheet h2 { font-size: 23px; }
  .clave-acciones { flex-direction: column-reverse; }
  .clave-acciones .btn { width: 100%; }
}

/* ============================================================
   SELECTOR DE MES DEL CALENDARIO
   ------------------------------------------------------------
   El nombre del mes es un botón. Con solo las flechitas, llegar a marzo
   del año que viene eran ocho clics — y esa fricción era la mitad de por
   qué todo acababa agendado en el mes que ya estaba puesto.
   ============================================================ */

.cal-month-btn {
  cursor: pointer;
  padding: 2px 7px;
  margin: -2px -7px;
  border-radius: 6px;
  transition: background 0.15s;
}

.cal-month-btn:hover { background: var(--hair-soft); }

.cal-month-btn::after {
  content: "▾";
  margin-left: 5px;
  font-size: 8px;
  color: var(--ink-faint);
  vertical-align: 1px;
}

.pop-mes { width: 216px; }

.mes-anios {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 0 2px 4px;
}

.mes-anio,
.mes-uno {
  height: 26px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--ui);
  font-size: 10.5px;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, color 0.12s;
}

.mes-anio:hover,
.mes-uno:hover { background: var(--hair-soft); color: var(--ink); }

.mes-anio.on,
.mes-uno.on {
  border-color: var(--ink);
  background: var(--hair-soft);
  color: var(--ink);
  font-weight: 500;
}

.mes-rejilla {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 0 2px;
}

.mes-uno { text-transform: capitalize; }

.mes-hoy {
  width: calc(100% - 4px);
  margin: 7px 2px 2px;
  height: 27px;
  border: 1px solid var(--hair);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--ui);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.mes-hoy:hover { color: var(--ink); border-color: var(--ink); }


/* el botón de recortar con modelo, dentro de la ventana de quitar fondo */
.btn-ia { border-color: var(--sel); color: var(--sel); }
.btn-ia:hover:not(:disabled) { background: var(--sel-soft); }
.btn-ia:disabled { opacity: .55; cursor: default; }
