:root {
  --ink: #0E1A2B;
  --orange: #E85A1A;
  --grey: #5C6470;
  --light-grey: #B8BEC5;
  --paper: #FAFAF7;
  --grid: #E5E2D8;

  --cerrado: #DCE0E5;
  --cerrado-soft: #D0D5DC;
  --cerrado-borde: #BDC3CC;

  --interior: #FFFFFE;
  --interior-soft: #F6F4ED;

  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Una sola easing para todo el lenguaje */
  --ease: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-slow: cubic-bezier(0.5, 0, 0.1, 1);

  /* Sistema de espaciado en módulos de 4 */
  --gap: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  min-height: 100vh;
}

.deck {
  width: 100vw;
  height: 100vh;
  padding: 32px;
  background: var(--paper);
  overflow: hidden;
}

.frame {
  position: relative;
  border: 1px solid var(--ink);
  height: 100%;
  padding: 24px 36px 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Cuadrícula dentro del frame */
.frame::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}
.frame > * { position: relative; z-index: 1; }

/* ============================================
   HEADER — más presencia, sin línea separadora
   ============================================ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 28px;
  margin-bottom: 28px;
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 28px;
}

.logo-block {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.logo {
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 56px;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
  text-transform: uppercase;
}
.logo-cursor {
  display: inline-block;
  width: 26px;
  height: 7px;
  background: var(--orange);
  margin-left: 4px;
  margin-bottom: 4px;
  animation: blink 1.4s var(--ease) infinite;
  vertical-align: bottom;
}
@keyframes blink {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: 0.15; }
}

.divider-v {
  width: 1px;
  height: 38px;
  background: var(--cerrado-borde);
  align-self: center;
}

.meta-tag {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--orange);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.meta-user {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--ink);
  letter-spacing: 0.04em;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1.5px;
  cursor: pointer;
  transition: color 0.2s var(--ease);
}
.meta-user:hover {
  color: var(--orange);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--grey);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.header-right .time {
  color: var(--orange);
  font-weight: 500;
}
.session-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
  animation: pulse 2s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* ============================================
   DASHBOARD — ocupa toda la altura disponible
   ============================================ */
.dashboard {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: var(--gap);
  align-items: stretch;
  flex: 1;
  min-height: 0;  /* importante para que el grid pueda encoger */
}

.col {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-height: 0;
}

/* Las cajas crecen para ocupar el espacio vertical disponible */
.col .compuerta {
  flex: 1;
  min-height: 0;
}

/* El chat también se estira */
.col-chat .chat-frame {
  flex: 1;
  min-height: 0;
}

/* ============================================
   COMPUERTA
   ============================================ */
.compuerta {
  border: 1px solid var(--ink);
  background: var(--interior);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.4s var(--ease);
  box-shadow:
    0 1px 0 rgba(14, 26, 43, 0.04),
    0 4px 16px rgba(14, 26, 43, 0.05);
}

/* Hover de la caja cerrada: la sombra crece sutilmente */
.compuerta:not(.open):hover {
  box-shadow:
    0 1px 0 rgba(14, 26, 43, 0.06),
    0 6px 22px rgba(14, 26, 43, 0.1);
}

/* Proporciones relativas de las cajas dentro de su columna.
   Antes eran min-heights fijas, ahora se reparten el espacio */
.compuerta.altura-alta { flex: 2.2; }
.compuerta.altura-media { flex: 1.4; }
.compuerta.altura-baja { flex: 1; }

/* HEADER de la caja — siempre visible, blanco, con número y +
   Es lo único que separa al usuario del contenido cerrado */
.compuerta-header {
  position: relative;
  z-index: 12;
  background: var(--interior);
  border-bottom: 1px solid var(--ink);
  padding: 14px 18px 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: background 0.3s var(--ease);
  flex-shrink: 0;
}
.compuerta-header:hover {
  background: var(--interior-soft);
}

.compuerta-header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.compuerta-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--orange);
  font-weight: 500;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.compuerta-titulo {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Meta info pequeña (// 14) — entre título y botón */
.titulo-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--light-grey);
  letter-spacing: 0.06em;
  font-weight: 500;
  transition: color 0.4s var(--ease);
  flex-shrink: 0;
}
.compuerta.open .titulo-meta { color: var(--orange); }

/* Botón + en círculo naranja */
.compuerta-toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--orange);
  border: none;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.5s var(--ease), background 0.3s var(--ease);
}
.compuerta-toggle::before,
.compuerta-toggle::after {
  content: '';
  position: absolute;
  background: var(--interior);
  border-radius: 1px;
  transition: transform 0.4s var(--ease);
}
/* Línea horizontal del + */
.compuerta-toggle::before {
  width: 12px;
  height: 2px;
}
/* Línea vertical del + */
.compuerta-toggle::after {
  width: 2px;
  height: 12px;
}
/* Cuando está abierta: rota a × */
.compuerta.open .compuerta-toggle {
  transform: rotate(135deg);
  background: var(--ink);
}
.compuerta-header:hover .compuerta-toggle {
  transform: scale(1.1);
}
.compuerta.open .compuerta-header:hover .compuerta-toggle {
  transform: rotate(135deg) scale(1.1);
}

/* Meta info (// 14) — versión legacy duplicada — eliminada */
/* Ahora vive dentro del header (.titulo-meta arriba ya definido) */

/* Cuerpo */
.compuerta-cuerpo {
  position: relative;
  overflow: hidden;
  flex: 1;
  background: var(--interior);
  height: 100%;
}

/* HOJAS — dos tonos sutilmente distintos */
.hoja {
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  z-index: 4;
  transition: transform 1s var(--ease-slow);
}
.hoja-arriba {
  top: 0;
  background: var(--cerrado);
  border-bottom: 1px solid var(--cerrado-borde);
}
.hoja-abajo {
  bottom: 0;
  background: var(--cerrado-soft);
  border-top: 1px solid var(--cerrado-borde);
}
.compuerta.open .hoja-arriba { transform: translateY(-101%); }
.compuerta.open .hoja-abajo { transform: translateY(101%); }

/* ============================================
   TIRADOR — Dos filas de puntos (mezcla Notion + grip)
   Líneas horizontales hechas de puntos. Una encima de otra.
   Comunica textura de agarre + apertura vertical.
   ============================================ */

.tirador-zona {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  cursor: pointer;
  padding: 14px 24px;
  transition: opacity 0.4s var(--ease);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.compuerta.open .tirador-zona {
  opacity: 0;
  pointer-events: none;
}

/* Cada fila de puntos */
.tirador-pieza {
  display: flex;
  gap: 5px;
  height: 3px;
  align-items: center;
}
/* Los puntos se generan con repeating gradient para que sea limpio */
.tirador-pieza::before {
  content: '';
  width: 38px;
  height: 3px;
  background-image: radial-gradient(
    circle,
    var(--grey) 1.2px,
    transparent 1.5px
  );
  background-size: 6px 3px;
  background-repeat: repeat-x;
  background-position: center;
  transition: background-image 0.3s var(--ease);
}

/* Hover de la caja: los puntos se tiñen naranja */
.compuerta:not(.open):hover .tirador-pieza::before {
  background-image: radial-gradient(
    circle,
    var(--orange) 1.2px,
    transparent 1.5px
  );
}


/* CONTENIDO interior — más padding, fade-in al abrir */
.contenido {
  padding: 28px 32px 32px;
  position: relative;
  z-index: 1;
  height: 100%;
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.4s var(--ease) 0.5s;
}
.compuerta.open .contenido {
  opacity: 1;
}
.contenido-placeholder {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--light-grey);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  padding-top: 40px;
}

/* ============================================
   CAJA ABIERTA — Sección Reciente + Bandeja
   ============================================ */

.seccion-titulo {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
  margin-bottom: 14px;
}

/* RECIENTE — lista de tarjetas */
.reciente-lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.pieza {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--cerrado-borde);
  background: var(--interior);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.pieza:hover {
  border-color: var(--orange);
  background: #FFF9F4;
}

.pieza-icono {
  width: 28px;
  height: 32px;
  flex-shrink: 0;
  position: relative;
  /* Icono de documento dibujado en CSS */
  background: var(--interior);
  border: 1px solid var(--grey);
  border-radius: 2px;
}
/* Esquina doblada */
.pieza-icono::before {
  content: '';
  position: absolute;
  top: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  background: var(--interior);
  border-left: 1px solid var(--grey);
  border-bottom: 1px solid var(--grey);
}
/* Líneas internas del icono */
.pieza-icono::after {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  top: 12px;
  height: 12px;
  background-image:
    linear-gradient(to bottom,
      var(--grey) 1px,
      transparent 1px,
      transparent 4px,
      var(--grey) 4px,
      var(--grey) 5px,
      transparent 5px,
      transparent 8px,
      var(--grey) 8px,
      var(--grey) 9px,
      transparent 9px
    );
  opacity: 0.5;
}

.pieza:hover .pieza-icono {
  border-color: var(--orange);
}
.pieza:hover .pieza-icono::before {
  border-color: var(--orange);
}

.pieza-info {
  flex: 1;
  min-width: 0;
}
.pieza-nombre {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 4px;
}
.pieza-fecha {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--light-grey);
  letter-spacing: 0.04em;
}

/* Separador entre Reciente y Bandeja */
.seccion-separador {
  height: 1px;
  background: var(--cerrado-borde);
  margin: 14px 0 16px;
  opacity: 0.5;
}

/* BANDEJA DE ENTREGA */
.bandeja {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0 6px;
}

.doc-fantasma {
  width: 90px;
  height: 110px;
  position: relative;
  border: 1.5px dashed var(--cerrado-borde);
  border-radius: 3px;
  opacity: 0.45;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
/* Esquina doblada del fantasma */
.doc-fantasma::before {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: var(--interior);
  border-left: 1.5px dashed var(--cerrado-borde);
  border-bottom: 1.5px dashed var(--cerrado-borde);
}

/* Icono fantasma central */
.doc-fantasma-icono {
  width: 22px;
  height: 26px;
  border: 1.5px dashed var(--cerrado-borde);
  border-radius: 2px;
  position: relative;
}
.doc-fantasma-icono::before {
  content: '';
  position: absolute;
  top: -1.5px;
  right: -1.5px;
  width: 6px;
  height: 6px;
  background: var(--interior);
  border-left: 1.5px dashed var(--cerrado-borde);
  border-bottom: 1.5px dashed var(--cerrado-borde);
}

/* Líneas fantasma de texto */
.doc-fantasma-lineas {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 60%;
  align-items: center;
}
.doc-fantasma-lineas span {
  display: block;
  height: 1.5px;
  background: repeating-linear-gradient(
    to right,
    var(--cerrado-borde) 0,
    var(--cerrado-borde) 3px,
    transparent 3px,
    transparent 6px
  );
}
.doc-fantasma-lineas span:nth-child(1) { width: 90%; }
.doc-fantasma-lineas span:nth-child(2) { width: 70%; }
.doc-fantasma-lineas span:nth-child(3) { width: 85%; }

/* Pieza recién entregada — borde naranja sutil */
.bandeja .pieza-entregada {
  border-color: var(--orange);
  background: #FFF9F4;
  animation: piezaEntregada 0.6s var(--ease);
}
@keyframes piezaEntregada {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.bandeja .pieza-entregada .pieza-icono {
  border-color: var(--orange);
}
.bandeja .pieza-entregada .pieza-icono::before {
  border-color: var(--orange);
}
.bandeja .pieza-entregada .pieza-fecha {
  color: var(--orange);
}

/* ============================================
   BUZÓN — Mensajes (Caja 05 Bandeja de entrada)
   ============================================ */

.mensajes-lista {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mensaje {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px 12px 22px;
  border: 1px solid var(--cerrado-borde);
  background: var(--interior);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  position: relative;
}
.mensaje:hover {
  border-color: var(--orange);
  background: #FFF9F4;
}

/* Punto naranja para no leído */
.mensaje.no-leido::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
}

/* ============================================
   EFECTO A — Modal mejorado tipo documento real
   ============================================ */

/* El modal actual ya existe, lo refino para que el contenido
   se sienta más a documento real */
.modal.efecto-a .modal-body {
  background: var(--interior);
  padding: 48px 64px;
}
.modal.efecto-a .modal-contenido {
  font-family: 'Inter', Georgia, serif;
  font-size: 16px;
  line-height: 1.75;
  color: #1a2332;
  max-width: 540px;
  margin: 0 auto;
}
.modal.efecto-a .modal-contenido p { margin-bottom: 18px; }

/* ============================================
   EFECTO C — Hoja flotando sobre la mesa
   ============================================ */

.hoja-flotante-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 26, 43, 0.5);
  z-index: 110;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.hoja-flotante-backdrop.active {
  display: flex;
  opacity: 1;
}

.hoja-flotante {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  background: #FFFFFF;
  padding: 64px 72px;
  box-shadow:
    0 1px 0 rgba(0,0,0,0.04),
    0 30px 60px rgba(14, 26, 43, 0.35),
    0 10px 20px rgba(14, 26, 43, 0.18);
  transform: rotate(-1.2deg) scale(0.96) translateY(20px);
  opacity: 0;
  transition: all 0.5s var(--ease);
  overflow-y: auto;
}
.hoja-flotante-backdrop.active .hoja-flotante {
  transform: rotate(-1.2deg) scale(1) translateY(0);
  opacity: 1;
}
/* Pequeña marca de "documento" en la esquina */
.hoja-flotante::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 36px;
  height: 36px;
  background: linear-gradient(
    225deg,
    transparent 49%,
    var(--cerrado) 49%,
    var(--cerrado) 50%,
    #F5F2EA 51%
  );
}
.hoja-flotante-titulo {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: -0.015em;
}
.hoja-flotante-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 32px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--cerrado-borde);
}
.hoja-flotante-contenido {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
}
.hoja-flotante-contenido p {
  margin-bottom: 16px;
}
.hoja-flotante-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--grey);
  font-size: 22px;
  cursor: pointer;
  z-index: 2;
  line-height: 1;
  transition: color 0.2s var(--ease);
}
.hoja-flotante-close:hover { color: var(--orange); }

/* ============================================
   EFECTO D — Despliegue inline (la tarjeta se expande)
   ============================================ */

.pieza-expandida {
  border: 1px solid var(--ink);
  background: var(--interior);
  margin-bottom: 8px;
  overflow: hidden;
  animation: expandirInline 0.4s var(--ease);
}
@keyframes expandirInline {
  from { max-height: 0; opacity: 0; }
  to { max-height: 600px; opacity: 1; }
}
.pieza-expandida-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: #FFF9F4;
  border-bottom: 1px solid var(--cerrado-borde);
}
.pieza-expandida-head .pieza-icono {
  border-color: var(--orange);
}
.pieza-expandida-head .pieza-icono::before {
  border-color: var(--orange);
}
.pieza-expandida-info {
  flex: 1;
  min-width: 0;
}
.pieza-expandida-nombre {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 4px;
}
.pieza-expandida-fecha {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--orange);
  letter-spacing: 0.04em;
}
.pieza-expandida-close {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--grey);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s var(--ease);
}
.pieza-expandida-close:hover { color: var(--orange); }
.pieza-expandida-body {
  padding: 18px 18px 16px;
}
.pieza-expandida-contexto {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
  font-weight: 500;
}
.pieza-expandida-contexto-text {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--grey);
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 14px;
}
.pieza-expandida-separador {
  height: 1px;
  background: var(--cerrado-borde);
  margin-bottom: 14px;
  opacity: 0.6;
}
.pieza-expandida-contenido {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  line-height: 1.65;
}
.pieza-expandida-contenido p { margin-bottom: 10px; }

/* ============================================
   EFECTO E — Lectura pantalla completa
   Marcas técnicas en esquinas + lenguaje editorial
   ============================================ */

.lectura-fullscreen {
  position: fixed;
  inset: 0;
  background: var(--paper);
  z-index: 120;
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  pointer-events: none;
}
.lectura-fullscreen.active {
  opacity: 1;
  pointer-events: all;
}
/* Cuadrícula sutil de fondo */
.lectura-fullscreen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.5;
  pointer-events: none;
}

/* Marcas técnicas en las cuatro esquinas (estilo imprenta) */
.lectura-fullscreen-marca {
  position: fixed;
  width: 32px;
  height: 32px;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s var(--ease) 0.3s;
}
.lectura-fullscreen.active .lectura-fullscreen-marca {
  opacity: 1;
}
.lectura-fullscreen-marca.tl { top: 30px; left: 40px; border-top: 1.5px solid var(--orange); border-left: 1.5px solid var(--orange); }
.lectura-fullscreen-marca.tr { top: 30px; right: 40px; border-top: 1.5px solid var(--orange); border-right: 1.5px solid var(--orange); }
.lectura-fullscreen-marca.bl { bottom: 30px; left: 40px; border-bottom: 1.5px solid var(--orange); border-left: 1.5px solid var(--orange); }
.lectura-fullscreen-marca.br { bottom: 30px; right: 40px; border-bottom: 1.5px solid var(--orange); border-right: 1.5px solid var(--orange); }

.lectura-fullscreen-inner {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
  padding: 80px 40px 60px;
  transform: translateY(20px);
  transition: transform 0.5s var(--ease);
  z-index: 2;
}
.lectura-fullscreen.active .lectura-fullscreen-inner {
  transform: translateY(0);
}

.lectura-fullscreen-close {
  position: fixed;
  top: 30px;
  right: 40px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--ink);
  background: var(--interior);
  color: var(--ink);
  font-size: 20px;
  cursor: pointer;
  z-index: 3;
  line-height: 1;
  transition: all 0.2s var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lectura-fullscreen-close:hover {
  background: var(--ink);
  color: var(--interior);
}

/* Referencia editorial arriba: // PIEZA / 04 — INFORME EXTERNO */
.lectura-fullscreen-ref {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
  font-weight: 500;
}

.lectura-fullscreen-titulo {
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 42px;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 22px;
}
.lectura-fullscreen-contexto {
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--grey);
  font-style: italic;
  line-height: 1.6;
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--cerrado-borde);
}
.lectura-fullscreen-contenido {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.8;
  color: var(--ink);
}
.lectura-fullscreen-contenido p {
  margin-bottom: 20px;
}

/* Bloque de cierre del documento + acciones */
.lectura-fullscreen-cierre {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--cerrado-borde);
}
.lectura-fullscreen-fin {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
  font-weight: 500;
}
.lectura-fullscreen-opciones {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 14px;
  font-weight: 500;
}
.lectura-fullscreen-acciones {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.lectura-fullscreen-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 14px;
  border: 1px solid var(--ink);
  background: var(--interior);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.lectura-fullscreen-btn:hover {
  background: var(--ink);
  color: var(--interior);
}
.lectura-fullscreen-btn:disabled {
  border-color: var(--cerrado-borde);
  color: var(--light-grey);
  cursor: not-allowed;
}
.lectura-fullscreen-btn:disabled:hover {
  background: var(--interior);
  color: var(--light-grey);
}
/* Toast de "copiado" */
.lectura-fullscreen-toast {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: var(--interior);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 18px;
  opacity: 0;
  transition: all 0.25s var(--ease);
  pointer-events: none;
  z-index: 4;
}
.lectura-fullscreen-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Icono sobre — SVG inline simple */
.sobre-icono {
  width: 28px;
  height: 22px;
  flex-shrink: 0;
  position: relative;
  display: block;
}
.sobre-icono svg {
  width: 100%;
  height: 100%;
  display: block;
  color: var(--ink);
  transition: color 0.2s var(--ease);
}

/* Leído: sobre en gris */
.mensaje.leido .sobre-icono svg {
  color: var(--light-grey);
}

/* Hover: sobre en naranja */
.mensaje:hover .sobre-icono svg {
  color: var(--orange);
}

/* Pulse del sobre cuando llega un email nuevo */
.sobre-icono.pulse svg {
  animation: pulseSobre 0.7s var(--ease) 2;
}
@keyframes pulseSobre {
  0%, 100% { transform: scale(1); color: var(--orange); }
  50% { transform: scale(1.18); color: var(--orange); }
}

/* Leído: ligera atenuación */
.mensaje.leido {
  opacity: 0.7;
}
.mensaje.leido:hover {
  opacity: 1;
}

.mensaje-info {
  flex: 1;
  min-width: 0;
}
.mensaje-remitente {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--grey);
  line-height: 1.3;
  margin-bottom: 2px;
  letter-spacing: 0.01em;
}
.mensaje.no-leido .mensaje-remitente {
  color: var(--ink);
  font-weight: 500;
}
.mensaje-asunto {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  line-height: 1.3;
}
.mensaje.no-leido .mensaje-asunto {
  font-weight: 500;
}

.mensaje-fecha {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--light-grey);
  letter-spacing: 0.04em;
  flex-shrink: 0;
  white-space: nowrap;
}
.mensaje.no-leido .mensaje-fecha {
  color: var(--orange);
}


/* ============================================
   VENTANA FLOTANTE (Modal)
   ============================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 26, 43, 0.4);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.modal-backdrop.active {
  display: flex;
  opacity: 1;
}

.modal {
  background: var(--interior);
  border: 1px solid var(--ink);
  max-width: 720px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.96);
  opacity: 0;
  transition: all 0.3s var(--ease);
  box-shadow: 0 20px 60px rgba(14, 26, 43, 0.25);
}
.modal-backdrop.active .modal {
  transform: scale(1);
  opacity: 1;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--cerrado-borde);
  gap: 14px;
}
.modal-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.modal-head-icono {
  width: 22px;
  height: 26px;
  flex-shrink: 0;
  border: 1px solid var(--grey);
  border-radius: 2px;
  position: relative;
}
.modal-head-icono::before {
  content: '';
  position: absolute;
  top: -1px;
  right: -1px;
  width: 6px;
  height: 6px;
  background: var(--interior);
  border-left: 1px solid var(--grey);
  border-bottom: 1px solid var(--grey);
}
.modal-head-title {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 16px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.modal-close {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--grey);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s var(--ease);
  font-family: var(--font-sans);
  font-size: 20px;
  line-height: 1;
}
.modal-close:hover { color: var(--orange); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

.modal-contexto {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  font-weight: 500;
}
.modal-contexto-text {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--grey);
  line-height: 1.55;
  margin-bottom: 22px;
  font-style: italic;
}

.modal-separator {
  height: 1px;
  background: var(--cerrado-borde);
  margin: 22px 0;
  opacity: 0.5;
}

.modal-contenido {
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--ink);
  line-height: 1.65;
}
.modal-contenido p {
  margin-bottom: 14px;
}
.modal-contenido p:last-child { margin-bottom: 0; }

.modal-foot {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--cerrado-borde);
  background: var(--interior-soft);
}
.modal-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 14px;
  border: 1px solid var(--ink);
  background: var(--interior);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.modal-btn:hover {
  background: var(--ink);
  color: var(--interior);
}
.modal-btn:disabled {
  border-color: var(--cerrado-borde);
  color: var(--light-grey);
  background: var(--interior);
  cursor: not-allowed;
}
.modal-btn:disabled:hover {
  background: var(--interior);
  color: var(--light-grey);
}

/* Toast de "copiado" */
.modal-toast {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: var(--interior);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 16px;
  opacity: 0;
  transition: all 0.25s var(--ease);
  pointer-events: none;
}
.modal-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ============================================
   CHAT CENTRAL — protagonista
   ============================================ */
.chat-frame {
  border: 1px solid var(--ink);
  background: var(--interior);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  /* Más presencia: sombra más definida */
  box-shadow:
    0 1px 0 rgba(14, 26, 43, 0.06),
    0 8px 32px rgba(14, 26, 43, 0.08);
}
.chat-head {
  padding: 20px 28px 16px;
  border-bottom: 1px solid var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.chat-head-title {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.chat-head-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--orange);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-head-meta .pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  animation: pulse 2s var(--ease) infinite;
}
.chat-body {
  flex: 1;
  padding: 32px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.msg {
  max-width: 92%;
  animation: msgIn 0.6s var(--ease) both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg.naos { align-self: flex-start; }
.msg.user { align-self: flex-end; text-align: right; }
.msg-from {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 8px;
  font-weight: 500;
}
.msg.user .msg-from { color: var(--orange); }
.msg-body {
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink);
}
.msg.naos .msg-body {
  padding-left: 16px;
  border-left: 2px solid var(--ink);
}
.msg.user .msg-body {
  padding-right: 16px;
  border-right: 2px solid var(--orange);
  color: var(--grey);
}

/* Tarjeta de email dentro del chat */
.chat-card {
  margin-top: 12px;
  border: 1px solid var(--cerrado-borde);
  background: var(--interior-soft);
  padding: 14px 18px;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
}
.chat-card-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--orange);
  text-transform: uppercase;
  margin-bottom: 10px;
  font-weight: 500;
}
.chat-card-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--grey);
  letter-spacing: 0.03em;
  line-height: 1.7;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--cerrado-borde);
}
.chat-card-meta strong { color: var(--ink); font-weight: 500; }
.chat-card-body { font-size: 13px; line-height: 1.55; }
.chat-card-body p { margin: 0 0 8px; }
.chat-card-body p:last-child { margin-bottom: 0; }
.chat-card-quote {
  padding-left: 12px;
  border-left: 2px solid var(--cerrado-borde);
  color: var(--grey);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 14px;
}
.chat-card-quote p { margin: 0 0 6px; }
.chat-card-sep {
  border-top: 1px solid var(--cerrado-borde);
  margin: 14px 0;
}
.chat-card-draft { color: var(--ink); font-size: 13px; line-height: 1.6; }
.chat-card-draft p { margin: 0 0 8px; }
.chat-card-draft p:last-child { margin-bottom: 0; }

.chat-input-wrap {
  border-top: 1px solid var(--ink);
  padding: 16px 22px;
  background: var(--interior-soft);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.4s var(--ease);
}
/* Cuando NAOS está esperando respuesta del usuario */
.chat-input-wrap.esperando {
  background: #FFF9F4;
}
.chat-input-wrap.esperando .chat-input {
  border-color: var(--orange);
  animation: inputPulse 2s var(--ease) infinite;
}
@keyframes inputPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 90, 26, 0.0); }
  50% { box-shadow: 0 0 0 4px rgba(232, 90, 26, 0.08); }
}
.chat-input {
  flex: 1;
  background: var(--interior);
  border: 1px solid var(--light-grey);
  padding: 13px 16px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s var(--ease);
}
.chat-input:focus { border-color: var(--orange); }
.chat-input::placeholder { color: var(--light-grey); }
.send-btn {
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  padding: 0;
  transition: color 0.2s var(--ease);
}
.send-btn svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s var(--ease);
}
.send-btn:hover {
  color: var(--orange);
}
.send-btn:hover svg {
  transform: translateX(3px);
}
.send-btn.snap svg {
  animation: snapRight 0.4s var(--ease);
}
@keyframes snapRight {
  0% { transform: translateX(0); }
  40% { transform: translateX(12px); opacity: 0.3; }
  50% { transform: translateX(-8px); opacity: 1; }
  100% { transform: translateX(0); }
}

/* FOOTER del frame */
.frame-footer {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--light-grey);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  pointer-events: none;
  flex-shrink: 0;
}

/* ============================================
   ANIMACIONES DE ENTRADA
   (Solo se disparan cuando el deck tiene .animate)
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(8px);
}
.animate .reveal {
  animation: revealUp 0.6s var(--ease) forwards;
}
@keyframes revealUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.animate .reveal.d1 { animation-delay: 0.10s; } /* header */
.animate .reveal.d4 { animation-delay: 0.25s; } /* caja 03 - der arriba */
.animate .reveal.d2 { animation-delay: 0.35s; } /* chat */
.animate .reveal.d3 { animation-delay: 0.45s; } /* caja 01 - izq arriba */
.animate .reveal.d5 { animation-delay: 0.55s; } /* caja 04 + caja 02 - der medio / izq abajo */
.animate .reveal.d6 { animation-delay: 0.70s; } /* caja 05 - der abajo */
.animate .reveal.d7 { animation-delay: 0.85s; } /* footer */

/* ============================================
   LOGIN OVERLAY
   ============================================ */

.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--paper);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s var(--ease) 0.2s;
}
.login-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}
.login-overlay.hide {
  opacity: 0;
  pointer-events: none;
}

.login-card {
  position: relative;
  background: var(--interior);
  border: 1px solid var(--ink);
  padding: 48px 56px 40px;
  width: 460px;
  max-width: 90vw;
  box-shadow:
    0 1px 0 rgba(14, 26, 43, 0.04),
    0 12px 40px rgba(14, 26, 43, 0.1);
  z-index: 1;
  transition: transform 0.8s var(--ease), opacity 0.6s var(--ease);
}
.login-overlay.hide .login-card {
  transform: scale(0.98) translateY(-8px);
  opacity: 0;
}

/* Logo dentro del login */
.login-logo {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-bottom: 30px;
}
.login-logo .logo {
  font-size: 48px;
  letter-spacing: -0.04em;
}
.login-logo .logo-cursor {
  width: 22px;
  height: 6px;
  margin-left: 3px;
  margin-bottom: 4px;
}

.login-titulo {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 20px;
  color: var(--ink);
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: -0.015em;
}
.login-subtitulo {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  margin-bottom: 36px;
  font-weight: 500;
}

.login-instruccion {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--grey);
  text-align: center;
  margin-bottom: 18px;
  line-height: 1.5;
}

/* Botón cuenta tipo Google */
.login-cuenta {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--cerrado-borde);
  background: var(--interior);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  margin-bottom: 8px;
  text-align: left;
  font-family: var(--font-sans);
}
.login-cuenta.auto-hover,
.login-cuenta:hover {
  border-color: var(--orange);
  background: #FFF9F4;
}

.login-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--orange);
  color: var(--interior);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.login-cuenta-info {
  flex: 1;
  min-width: 0;
}
.login-cuenta-nombre {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 3px;
}
.login-cuenta-email {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--grey);
  letter-spacing: 0.01em;
}
.login-cuenta-arrow {
  color: var(--light-grey);
  transition: color 0.2s var(--ease), transform 0.2s var(--ease);
  flex-shrink: 0;
}
.login-cuenta.auto-hover .login-cuenta-arrow,
.login-cuenta:hover .login-cuenta-arrow {
  color: var(--orange);
  transform: translateX(3px);
}

.login-otra {
  width: 100%;
  text-align: center;
  background: transparent;
  border: none;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--light-grey);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.2s var(--ease);
  margin-top: 4px;
}
.login-otra:hover {
  color: var(--orange);
}

/* Animación de entrada del dashboard:
   después del login, todas las cajas aparecen escalonadas
   desde arriba-derecha hacia abajo-izquierda */
.animate .reveal {
  transform: translate(15px, -15px);
}

@media (max-width: 1100px) {
  .deck {
    height: auto;
    min-height: 100vh;
    padding: 16px;
    overflow: visible;
  }
  .frame {
    height: auto;
    padding: 20px;
  }
  .dashboard { grid-template-columns: 1fr; }
  .col .compuerta { flex: none; }
  .compuerta.altura-alta { min-height: 320px; }
  .compuerta.altura-media { min-height: 220px; }
  .compuerta.altura-baja { min-height: 180px; }
  .col-chat .chat-frame { min-height: 480px; }
}
