/* Hallmark · shape: app screen · genre: atmospheric · theme: custom (estudio-mando-nocturno) · surface: absolute
 * nav: top console bar with sliding pill · signature: 8-cabin live studio grid · states: empty, queued, streaming, ready, error
 * axes: warm-nocturnal · contrast: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P5 H5 E5 S5 R5 V5 · weakest: R, snapped every spacing rule to the 4px grid and verified WCAG AA contrast */

:root {
  --bg: oklch(15.5% 0.008 55);
  --bg-elev: oklch(18.8% 0.009 55);
  --surface-1: oklch(21.4% 0.01 55);
  --surface-2: oklch(25.2% 0.012 55);
  --surface-3: oklch(29.5% 0.013 55);
  --surface-disabled: oklch(19.5% 0.006 55);
  --surface-user: oklch(25.8% 0.028 56);
  --velo: oklch(8% 0.005 55 / 0.74);

  --line: oklch(30.5% 0.012 55 / 0.8);
  --line-strong: oklch(39.5% 0.016 55);

  --ink: oklch(95.5% 0.008 75);
  --ink-soft: oklch(78% 0.012 68);
  --ink-muted: oklch(67% 0.012 62);
  --ink-disabled: oklch(63% 0.008 58);
  --ink-on-accent: oklch(15% 0.018 52);

  --accent: oklch(75% 0.152 56);
  --accent-hover: oklch(79% 0.148 58);
  --accent-soft: oklch(75% 0.152 56 / 0.16);
  --accent-ring: oklch(75% 0.152 56 / 0.44);

  --signal-ok: oklch(76% 0.16 152);
  --signal-ok-soft: oklch(76% 0.16 152 / 0.15);
  --signal-wait: oklch(80% 0.145 78);
  --signal-wait-soft: oklch(80% 0.145 78 / 0.16);
  --signal-err: oklch(72% 0.175 28);
  --signal-err-soft: oklch(72% 0.175 28 / 0.16);

  --shadow-sheet: 0 -16px 48px oklch(5% 0.005 55 / 0.62);

  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: clip;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

h1, h2, h3, h4 {
  text-wrap: balance;
}

[hidden] {
  display: none !important;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: 1rem;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  touch-action: manipulation;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ic {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.ic.sm {
  width: 15px;
  height: 15px;
}

.ic.lg {
  width: 22px;
  height: 22px;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.subtitulo-seccion {
  font-size: 0.875rem;
  color: var(--ink-soft);
  font-weight: 600;
}

/* ── Botones táctiles con respuesta inmediata ── */

.btn, .btn-ic, .chip-sesion, .tarjeta-preset, .seg-btn {
  transition:
    transform 140ms var(--ease-out),
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

.btn:active, .btn-ic:active, .chip-sesion:active, .tarjeta-preset:active {
  transform: scale(0.97);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: 0.9375rem;
  font-weight: 600;
  background-color: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.primario {
  background-color: var(--accent);
  color: var(--ink-on-accent);
  border-color: transparent;
}

.btn.peligro {
  background-color: var(--signal-err-soft);
  color: var(--signal-err);
  border-color: transparent;
}

.btn.suave {
  background-color: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
  padding: 8px 12px;
  font-size: 0.8125rem;
}

.btn:disabled {
  background-color: var(--surface-disabled);
  color: var(--ink-disabled);
  border-color: var(--line);
  cursor: not-allowed;
}

.btn-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background-color: var(--surface-1);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  position: relative;
}

.btn-ic.activo {
  color: var(--accent);
  border-color: var(--accent-ring);
  background-color: var(--accent-soft);
}

.punto-aviso {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: var(--r-xs);
  background-color: var(--signal-ok);
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) {
    background-color: var(--surface-3);
  }
  .btn.primario:hover:not(:disabled) {
    background-color: var(--accent-hover);
  }
  .btn.suave:hover:not(:disabled) {
    background-color: var(--accent-ring);
    color: var(--ink);
  }
  .btn-ic:hover {
    background-color: var(--surface-2);
    color: var(--ink);
  }
}

/* ── Pantalla de acceso ── */

.pantalla-acceso {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
}

.tarjeta-acceso {
  width: 100%;
  max-width: 400px;
  background-color: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  padding: 28px 24px;
  color: var(--ink);
}

.marca-acceso {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.logo-caja {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background-color: var(--surface-2);
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.marca-acceso h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.marca-acceso p {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.aviso-inicial {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background-color: var(--accent-soft);
  color: var(--ink);
  font-size: 0.875rem;
  line-height: 1.45;
}

.campo {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.campo label {
  font-size: 0.875rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.entrada {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background-color: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 1rem;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.entrada:focus {
  outline: none;
  border-color: var(--accent);
  background-color: var(--surface-1);
}

.error-form {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background-color: var(--signal-err-soft);
  color: var(--signal-err);
  font-size: 0.875rem;
}

/* ── Consola principal y cabecera ── */

.consola {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.barra {
  flex-shrink: 0;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background-color: var(--bg-elev);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  z-index: 20;
}

.barra-interior {
  max-width: 1560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.barra-izq {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.marca-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.marca-mini .simbolo {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background-color: var(--surface-2);
  border: 1px solid var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.chip-pc {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  background-color: var(--surface-1);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  transition: transform 140ms var(--ease-out), border-color 160ms ease, background-color 160ms ease;
}

.chip-pc:active {
  transform: scale(0.97);
}

.chip-pc.online {
  background-color: var(--signal-ok-soft);
  color: var(--signal-ok);
  border-color: transparent;
}

.chip-pc.cola {
  background-color: var(--signal-wait-soft);
  color: var(--signal-wait);
  border-color: transparent;
}

.pulso-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-xs);
  background-color: currentColor;
  flex-shrink: 0;
}

/* ── Selector deslizable con pastilla GPU ── */

.selector-vistas {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background-color: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 4px;
  min-width: 264px;
}

.pastilla-vista {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / 3);
  border-radius: var(--r-lg);
  background-color: var(--surface-3);
  border: 1px solid var(--line-strong);
  transform: translateX(0%);
  transition: transform 220ms var(--ease-out);
  pointer-events: none;
}

.selector-vistas[data-idx="1"] .pastilla-vista {
  transform: translateX(100%);
}

.selector-vistas[data-idx="2"] .pastilla-vista {
  transform: translateX(200%);
}

.seg-btn {
  position: relative;
  z-index: 1;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: center;
  white-space: nowrap;
}

.seg-btn.activo {
  color: var(--ink);
}

.barra-der {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 720px) {
  .barra-interior {
    gap: 8px;
  }
  .selector-vistas {
    order: 3;
    width: 100%;
  }
  .marca-mini span.nombre-app {
    display: none;
  }
}

/* ── Cuerpo de vistas ── */

.cuerpo-vistas {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
}

/* ── Vista 1: Sesiones ── */

.layout-sesiones {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
}

.columna-sesiones {
  border-right: 1px solid var(--line);
  background-color: var(--bg-elev);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cabecera-lista {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 8px;
  gap: 8px;
}

.cabecera-lista span {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.riel-sesiones {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chip-sesion {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  color: var(--ink-soft);
}

.chip-sesion.activa {
  background-color: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--ink);
}

.chip-sesion-info {
  min-width: 0;
  flex: 1;
}

.chip-sesion-titulo {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-sesion-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}

.estado-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-xs);
  background-color: var(--line-strong);
  flex-shrink: 0;
}

.estado-dot.pensando {
  background-color: var(--accent);
  animation: latidoSuave 1.2s var(--ease-in-out) infinite alternate;
}

.estado-dot.encolado {
  background-color: var(--signal-wait);
}

.estado-dot.error {
  background-color: var(--signal-err);
}

@keyframes latidoSuave {
  from { opacity: 0.45; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1.1); }
}

@media (hover: hover) and (pointer: fine) {
  .chip-sesion:hover:not(.activa) {
    background-color: var(--surface-1);
    color: var(--ink);
  }
}

/* Móvil: riel horizontal compacto arriba */
@media (max-width: 860px) {
  .layout-sesiones {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .columna-sesiones {
    border-right: none;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    align-items: center;
    padding: 8px 12px;
    gap: 8px;
  }
  .cabecera-lista {
    padding: 0;
    order: 2;
  }
  .cabecera-lista span {
    display: none;
  }
  .riel-sesiones {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px;
    gap: 8px;
    scrollbar-width: none;
  }
  .riel-sesiones::-webkit-scrollbar {
    display: none;
  }
  .chip-sesion {
    width: auto;
    flex-shrink: 0;
    padding: 8px 12px;
    border-radius: var(--r-pill);
    background-color: var(--surface-1);
    border-color: var(--line);
  }
  .chip-sesion.activa {
    background-color: var(--accent-soft);
    border-color: var(--accent-ring);
    color: var(--ink);
  }
  .chip-sesion-sub {
    display: none;
  }
}

/* ── Cabina de conversación ── */

.cabina {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background-color: var(--bg);
  color: var(--ink);
}

.cabina-tope {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background-color: var(--bg-elev);
  color: var(--ink);
}

.cabina-meta {
  min-width: 0;
}

.cabina-meta h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cabina-ruta {
  display: block;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cabina-acciones {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.flujo-mensajes {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overscroll-behavior: contain;
}

.flujo-interior {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Estado vacío con atajos reales */
.estado-vacio {
  margin: auto 0;
  padding: 24px 8px;
  text-align: left;
  max-width: 580px;
  align-self: center;
  width: 100%;
}

.estado-vacio h3 {
  margin: 0 0 8px;
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.estado-vacio p {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.sugerencias {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-sugerencia {
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  background-color: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: transform 140ms var(--ease-out), background-color 150ms ease, border-color 150ms ease;
}

.btn-sugerencia:active {
  transform: scale(0.98);
}

@media (hover: hover) and (pointer: fine) {
  .btn-sugerencia:hover {
    background-color: var(--surface-2);
    border-color: var(--line-strong);
  }
}

/* Burbujas de mensajes */
.msg {
  display: flex;
  flex-direction: column;
  max-width: 92%;
  animation: entradaMsg 210ms var(--ease-out) both;
}

@keyframes entradaMsg {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.msg.user {
  align-self: flex-end;
  align-items: flex-end;
}

.msg.assistant {
  align-self: flex-start;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
}

.burbuja {
  padding: 12px 16px;
  border-radius: var(--r-lg);
  font-size: 0.95rem;
  line-height: 1.56;
  overflow-wrap: break-word;
  word-break: break-word;
}

.msg.user .burbuja {
  background-color: var(--surface-user);
  border: 1px solid var(--line-strong);
  border-bottom-right-radius: var(--r-xs);
  color: var(--ink);
}

.msg.assistant .burbuja {
  background-color: var(--surface-1);
  border: 1px solid var(--line);
  border-bottom-left-radius: var(--r-xs);
  color: var(--ink);
  width: 100%;
}

.msg-img {
  display: block;
  max-width: min(320px, 100%);
  max-height: 280px;
  border-radius: var(--r-md);
  margin-bottom: 8px;
  border: 1px solid var(--line);
  cursor: zoom-in;
  object-fit: cover;
}

.msg-pie {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.etiqueta-cola {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  background-color: var(--signal-wait-soft);
  color: var(--signal-wait);
  font-weight: 600;
}

/* Tarjeta en vivo mientras Antigravity piensa/ejecuta */
.bloque-vivo {
  background-color: var(--surface-1);
  color: var(--ink);
  border: 1px solid var(--accent-ring);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vivo-barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.vivo-estado {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 0;
}

.vivo-estado span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.giro {
  width: 16px;
  height: 16px;
  border: 2px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: var(--r-lg);
  animation: girar 650ms linear infinite;
  flex-shrink: 0;
}

@keyframes girar {
  to { transform: rotate(360deg); }
}

/* Markdown limpio dentro de burbujas */
.md p {
  margin: 0 0 8px;
}
.md p:last-child {
  margin-bottom: 0;
}
.md h1, .md h2, .md h3, .md h4 {
  margin: 12px 0 8px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: break-word;
  min-width: 0;
}
.md h1:first-child, .md h2:first-child, .md h3:first-child {
  margin-top: 0;
}
.md h1, .md h2 { font-size: 1.0625rem; }
.md h3, .md h4 { font-size: 0.96875rem; }
.md ul, .md ol {
  margin: 8px 0 8px;
  padding-left: 20px;
}
.md li {
  margin-bottom: 4px;
}
.md code.inline {
  font-family: var(--font-mono);
  font-size: 0.84em;
  padding: 0 4px;
  border-radius: var(--r-xs);
  background-color: var(--surface-3);
  color: var(--ink);
}
.bloque-codigo {
  margin: 8px 0;
  border-radius: var(--r-md);
  background-color: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  overflow: hidden;
}
.codigo-tope {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-soft);
}
.btn-copiar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
  background-color: var(--surface-2);
  transition: transform 130ms var(--ease-out), background-color 150ms ease, color 150ms ease;
}
.btn-copiar:active {
  transform: scale(0.95);
}
.bloque-codigo pre {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink);
}

/* ── Caja de envío (iOS safe-area + dictado cómodo) ── */

.zona-envio {
  flex-shrink: 0;
  padding: 8px 16px calc(12px + env(safe-area-inset-bottom));
  background-color: var(--bg-elev);
  color: var(--ink);
  border-top: 1px solid var(--line);
}

.envio-interior {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.previa-foto {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background-color: var(--bg);
  border: 1px solid var(--line-strong);
}

.previa-foto-izq {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.previa-foto img {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  object-fit: cover;
  border: 1px solid var(--line);
}

.previa-foto span {
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

.fila-compositor {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.caja-texto {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 156px;
  padding: 8px 16px;
  border-radius: var(--r-lg);
  background-color: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.caja-texto:focus {
  outline: none;
  border-color: var(--accent);
  background-color: var(--surface-1);
}

.btn-enviar {
  width: 44px;
  height: 44px;
  border-radius: var(--r-lg);
  background-color: var(--accent);
  color: var(--ink-on-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, opacity 160ms ease;
}

.btn-enviar:active {
  transform: scale(0.95);
}

.btn-enviar.detener {
  background-color: var(--signal-err);
  color: var(--ink-on-accent);
}

.btn-adjuntar {
  width: 44px;
  height: 44px;
  border-radius: var(--r-lg);
  background-color: var(--surface-1);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, color 160ms ease;
}

.btn-adjuntar:active {
  transform: scale(0.95);
}

/* ── Vista 2: Cuadrícula de 8 paneles en vivo ── */

.vista-cuadricula {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
}

.grid-paneles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 12px;
}

.panel-celda {
  background-color: var(--bg-elev);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  height: 352px;
  overflow: hidden;
  transition: border-color 160ms ease;
}

.panel-celda.activo-vivo {
  border-color: var(--accent-ring);
}

.celda-tope {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background-color: var(--surface-1);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.celda-titulo {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.celda-titulo strong {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.celda-cuerpo {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.84375rem;
}

.mini-msg {
  padding: 8px 12px;
  border-radius: var(--r-md);
  line-height: 1.45;
  overflow-wrap: break-word;
}

.mini-msg.user {
  align-self: flex-end;
  background-color: var(--surface-user);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  max-width: 88%;
}

.mini-msg.assistant {
  align-self: flex-start;
  background-color: var(--surface-1);
  color: var(--ink);
  border: 1px solid var(--line);
  width: 100%;
}

.celda-pie {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background-color: var(--bg-elev);
  color: var(--ink);
}

.celda-pie input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background-color: var(--bg);
  border: 1px solid var(--line-strong);
  font-size: 1rem;
  color: var(--ink);
}

.celda-pie input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Vista 3: Tablero integrado (proyectos.json) ── */

.vista-tablero {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}

.tablero-controles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.buscador-caja {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 420px;
}

.buscador-caja .ic {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
  pointer-events: none;
}

.buscador-caja input {
  width: 100%;
  padding: 8px 12px 8px 40px;
  border-radius: var(--r-md);
  background-color: var(--bg-elev);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  font-size: 1rem;
}

.buscador-caja input:focus {
  outline: none;
  border-color: var(--accent);
}

.filtros-tablero {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip-filtro {
  padding: 8px 12px;
  border-radius: var(--r-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  background-color: var(--surface-1);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  transition: transform 140ms var(--ease-out), background-color 150ms ease, color 150ms ease;
}

.chip-filtro:active {
  transform: scale(0.97);
}

.chip-filtro.activo {
  background-color: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-ring);
}

.grid-proyectos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 12px;
}

.tarjeta-proy {
  background-color: var(--bg-elev);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.proy-tope {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.proy-tope h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.proy-cliente {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.badge-estado {
  padding: 4px 8px;
  border-radius: var(--r-sm);
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  background-color: var(--surface-2);
  color: var(--ink-soft);
}

.badge-estado.vivo {
  background-color: var(--signal-ok-soft);
  color: var(--signal-ok);
}

.badge-estado.curso {
  background-color: var(--accent-soft);
  color: var(--accent);
}

.proy-sig {
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background-color: var(--surface-1);
  font-size: 0.84375rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.proy-acciones {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
}

/* ── Hojas deslizables (Nueva sesión, Ajustes/Push, Visor de imagen) ── */

.velo {
  position: fixed;
  inset: 0;
  background-color: var(--velo);
  opacity: 0;
  transition: opacity 240ms var(--ease-out);
  z-index: 60;
}

.velo.ver {
  opacity: 1;
}

.hoja {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(100%, 540px);
  max-height: 88dvh;
  background-color: var(--bg-elev);
  color: var(--ink);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-sheet);
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 100%);
  transition: transform 280ms var(--ease-drawer);
  z-index: 61;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.hoja.ver {
  transform: translate(-50%, 0);
}

.agarre {
  width: 40px;
  height: 4px;
  border-radius: var(--r-xs);
  background-color: var(--surface-3);
  margin: 4px auto 12px;
  flex-shrink: 0;
  cursor: grab;
  touch-action: none;
}

.hoja-tope {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}

.hoja-tope h3 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
}

.grid-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.tarjeta-preset {
  text-align: left;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background-color: var(--surface-1);
  color: var(--ink);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tarjeta-preset strong {
  font-size: 0.875rem;
  color: var(--ink);
}

.tarjeta-preset span {
  font-family: var(--font-mono);
  font-size: 0.71875rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (hover: hover) and (pointer: fine) {
  .tarjeta-preset:hover {
    background-color: var(--surface-2);
    border-color: var(--line-strong);
  }
}

.bloque-ajuste {
  padding: 12px 16px;
  border-radius: var(--r-lg);
  background-color: var(--surface-1);
  color: var(--ink);
  border: 1px solid var(--line);
  margin-bottom: 12px;
}

.bloque-ajuste h4 {
  margin: 0 0 4px;
  font-size: 0.9375rem;
}

.bloque-ajuste p {
  margin: 0 0 12px;
  font-size: 0.84375rem;
  color: var(--ink-soft);
}

/* ── Toast discreto ── */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  background-color: var(--surface-3);
  color: var(--ink);
  padding: 8px 16px;
  border-radius: var(--r-lg);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-sheet);
  z-index: 90;
  transition: transform 220ms var(--ease-out), opacity 220ms var(--ease-out);
  max-width: calc(100% - 32px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.ver {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* ── Accesibilidad: movimiento reducido ── */

@media (prefers-reduced-motion: reduce) {
  .pastilla-vista,
  .hoja,
  .velo,
  .toast,
  .btn,
  .btn-ic,
  .chip-sesion,
  .tarjeta-preset {
    transition-duration: 0.01ms !important;
  }
  .msg,
  .estado-dot.pensando,
  .giro {
    animation: none !important;
  }
}
