/* LIA-S Correo: basalto y una sola señal dorada (ver DESIGN.md) */
@font-face { font-family: 'Archivo'; src: url('/fonts/archivo-var.woff2') format('woff2-variations'); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/fonts/geist-mono-var.woff2') format('woff2-variations'); font-weight: 100 900; font-display: swap; }

:root {
  --bg0: #0b0b0a; --bg1: #121210; --bg2: #1a1a17; --bg3: #23231f;
  --line: #2a2a25; --line2: #3a3a34;
  --text: #ecebe4; --muted: #a9a69b; --faint: #8a877d;
  --accent: #e3b230; --accent2: #f0c449; --accent-bg: rgba(227, 178, 48, .12); --on-accent: #0b0b0a;
  --paper: #f3f2ee;
  --ok: #8fd19a; --danger: #ef7a62; --danger-bg: rgba(239, 122, 98, .08);
  --font: 'Archivo', 'Segoe UI', system-ui, sans-serif;
  --mono: 'Geist Mono', 'Cascadia Code', Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --carril: 232px; --lista: 400px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body { margin: 0; height: 100%; background: var(--bg0); color: var(--text); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 3px; }
::selection { background: rgba(227, 178, 48, .32); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, textarea, [contenteditable] { caret-color: var(--accent); }
* { scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line2); border: 3px solid var(--bg0); }
svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.noscript { padding: 24px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd { font: 500 12px/1 var(--mono); padding: 3px 6px; border: 1px solid var(--line2); background: var(--bg2); color: var(--text); }

.marca { margin: 0; font-weight: 800; font-stretch: 112%; letter-spacing: -.01em; font-size: 19px; color: var(--text); text-decoration: none; white-space: nowrap; }
.marca b { color: var(--accent); font-weight: 800; }
.marca span { font-weight: 400; font-stretch: 100%; color: var(--muted); margin-left: 4px; letter-spacing: 0; }

/* ---------- Controles ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label, .etiqueta { font-size: 14px; font-weight: 600; }
.hint { font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=search], textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--bg1);
  border: 1px solid var(--line2); border-radius: 0; padding: 10px 12px; min-height: 44px;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
textarea { min-height: 96px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, textarea:hover, select:hover { border-color: #4a4a43; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); background: var(--bg2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  font: 600 14px/1 var(--font); color: var(--text); background: var(--bg3); border: 1px solid var(--line2);
  border-radius: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .1s var(--ease);
}
.btn:hover { background: #2c2c27; border-color: #4a4a43; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent2); border-color: var(--accent2); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--text); background: var(--bg2); }
.btn.peligro:hover { color: var(--danger); border-color: rgba(239, 122, 98, .5); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn svg { width: 18px; height: 18px; }

.icono {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; flex: none;
  background: transparent; border: 1px solid transparent; color: var(--muted); cursor: pointer; border-radius: 0;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.icono:hover { background: var(--bg2); color: var(--text); }
.icono[aria-pressed=true] { color: var(--accent); }
.icono[disabled] { opacity: .4; cursor: default; background: none; }

.msg { padding: 10px 12px; font-size: 14px; margin-bottom: 16px; border: 1px solid; }
.msg.error { color: #ffc4b8; border-color: rgba(239, 122, 98, .5); background: var(--danger-bg); }
.msg.ok { color: #cdeed3; border-color: rgba(143, 209, 154, .45); background: rgba(143, 209, 154, .08); }

/* ---------- Acceso ---------- */
.acceso { height: 100%; overflow: auto; display: grid; place-items: center; padding: 32px 16px; }
.acceso-caja { width: min(400px, 100%); }
.acceso-caja .marca { font-size: 22px; margin-bottom: 48px; }
.acceso-form h1 { font-size: 34px; font-weight: 800; font-stretch: 122%; letter-spacing: -.03em; line-height: 1; margin: 0 0 8px; }
.acceso-dir { font-family: var(--mono); font-size: 13px; color: var(--muted); margin: 0 0 32px; }
.acceso-texto { color: var(--muted); margin: 0 0 28px; max-width: 46ch; }
.acceso-form .btn { width: 100%; min-height: 48px; margin-top: 8px; }
.acceso-form input { min-height: 48px; }

/* ---------- Estructura ---------- */
.app { height: 100%; display: grid; grid-template-columns: var(--carril) var(--lista) minmax(0, 1fr); }

.carril { background: var(--bg1); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; padding: 0 12px 16px; overflow-y: auto; }
.carril-cabeza { height: 64px; display: flex; align-items: center; padding: 0 8px; flex: none; }
.redactar { margin: 4px 0 20px; min-height: 44px; justify-content: flex-start; padding: 0 16px; }
.carpetas { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.carpetas a {
  display: flex; align-items: center; gap: 12px; min-height: 38px; padding: 0 10px; color: var(--muted);
  text-decoration: none; font-weight: 500; position: relative;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.carpetas a:hover { background: var(--bg2); color: var(--text); }
.carpetas a[aria-current=page] { background: var(--bg2); color: var(--text); font-weight: 600; }
.carpetas a[aria-current=page]::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 2px; background: var(--accent); }
.carpetas a span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carpetas .cuenta { flex: none; font: 500 12px/1 var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); }
.carpetas .cuenta.nueva { color: var(--accent); font-weight: 700; }
.carpetas-pie { margin-top: auto; padding-top: 24px; }
.carril-buzon { margin: 16px 10px 0; font: 12px/1.4 var(--mono); color: var(--faint); overflow-wrap: anywhere; }

/* ---------- Lista ---------- */
.lista { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
.lista-cabeza { height: 64px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.buscar { flex: 1; position: relative; }
.buscar svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.buscar input { padding-left: 40px; min-height: 40px; background: var(--bg1); border-color: var(--line); }
.buscar input::-webkit-search-cancel-button { filter: grayscale(1) brightness(1.6); }
/* El momento propio: una línea de escaneo dorada cuando llega correo */
.escaner { position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--accent) 40%, var(--accent2) 50%, var(--accent) 60%, transparent); transform: translateX(-100%); opacity: 0; pointer-events: none; }
.escaner.activo { animation: escanear 1.4s var(--ease) forwards; }
@keyframes escanear { 0% { transform: translateX(-100%); opacity: 1; } 80% { opacity: 1; } 100% { transform: translateX(100%); opacity: 0; } }

.lista-barra { flex: none; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 8px 8px 8px 20px; }
.lista-titulo { margin: 0; font-size: 20px; font-weight: 700; font-stretch: 116%; letter-spacing: -.015em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista-acciones { display: flex; gap: 2px; }
.aviso-envio { margin: 0 12px 8px; padding: 10px 12px; font-size: 13px; line-height: 1.45; color: var(--muted); border: 1px solid var(--line2); background: var(--bg1); }
.aviso-envio strong { color: var(--text); }

.hilos { list-style: none; margin: 0; padding: 0 0 96px; overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.hilo {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; column-gap: 10px; row-gap: 1px;
  padding: 12px 16px 13px 12px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative;
  transition: background .12s var(--ease);
}
.hilo:hover { background: var(--bg1); }
.hilo[aria-current=true] { background: var(--bg2); }
.hilo[aria-current=true]::after { content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 2px; background: var(--line2); }
.hilo.foco { box-shadow: inset 0 0 0 1px var(--line2); }
.hilo .marca-nuevo { grid-row: 1; align-self: center; justify-self: center; width: 7px; height: 7px; background: transparent; }
.hilo.no-leido .marca-nuevo { background: var(--accent); }
.hilo .sel { grid-row: 1 / span 3; align-self: start; margin: 1px 0 0; width: 16px; height: 16px; accent-color: var(--accent); display: none; }
.lista.seleccionando .hilo .sel { display: block; }
.lista.seleccionando .hilo .marca-nuevo { display: none; }
@media (hover: hover) {
  .hilo:hover .sel { display: block; }
  .hilo:hover .marca-nuevo { display: none; }
}
.hilo .quien { grid-column: 2; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-weight: 500; }
.hilo .quien .n { font: 500 12px var(--mono); color: var(--faint); margin-left: 6px; }
.hilo .cuando { grid-column: 3; font: 500 12px/1.9 var(--mono); font-variant-numeric: tabular-nums; color: var(--faint); white-space: nowrap; }
.hilo .asunto { grid-column: 2 / span 2; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.hilo .extracto { grid-column: 2 / span 2; min-width: 0; font-size: 14px; color: var(--faint); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.hilo.no-leido .quien, .hilo.no-leido .asunto { color: var(--text); font-weight: 650; }
.hilo .señales { grid-column: 3; grid-row: 2; display: flex; gap: 4px; justify-content: flex-end; align-items: center; color: var(--faint); }
.hilo .señales svg { width: 15px; height: 15px; }
.hilo .señales .est { color: var(--accent); }
.hilo .error-envio { grid-column: 2 / span 2; font-size: 13px; color: var(--danger); }
.hilo .motivo { grid-column: 2 / span 2; font-size: 13px; color: var(--faint); }

.vacio { padding: 64px 28px; text-align: left; color: var(--muted); }
.vacio h2 { margin: 0 0 6px; color: var(--text); font-size: 17px; font-weight: 650; }
.vacio p { margin: 0; max-width: 38ch; font-size: 14px; }
.cargando { padding: 24px 20px; }
.cargando i { display: block; height: 14px; margin: 0 0 10px; background: var(--bg2); animation: latir 1.2s ease-in-out infinite alternate; }
.cargando i:nth-child(3n+1) { width: 40%; } .cargando i:nth-child(3n+2) { width: 85%; } .cargando i:nth-child(3n) { width: 65%; margin-bottom: 26px; }
@keyframes latir { to { opacity: .45; } }
.mas-hilos { margin: 8px 12px 96px; }

.fab { position: absolute; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: 56px; height: 56px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); border: 0; cursor: pointer; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.fab svg { width: 24px; height: 24px; }
.solo-movil { display: none; }

/* ---------- Panel de lectura ---------- */
.panel { min-width: 0; min-height: 0; overflow-y: auto; position: relative; background: var(--bg0); }
.panel-vacio { height: 100%; display: grid; place-items: center; color: var(--faint); padding: 32px; text-align: center; }
.panel-vacio p { margin: 0; max-width: 32ch; }
.panel-vacio .cifra { display: block; font: 600 13px var(--mono); color: var(--muted); margin-bottom: 8px; }

.barra-hilo { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 2px; height: 64px; padding: 0 16px; background: rgba(11, 11, 10, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.barra-hilo .hueco { flex: 1; }
.conversacion { max-width: 920px; padding: 28px 32px 120px; }
.conversacion > h1 { font-size: 26px; font-weight: 700; font-stretch: 116%; letter-spacing: -.02em; line-height: 1.15; margin: 0 0 6px; text-wrap: balance; overflow-wrap: anywhere; }
.conversacion .meta-hilo { font: 12px var(--mono); color: var(--faint); margin: 0 0 24px; }

.mensaje { border-top: 1px solid var(--line); padding: 18px 0 20px; }
.mensaje-cabeza { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 0 12px; align-items: start; }
.avatar { width: 40px; height: 40px; display: grid; place-items: center; background: var(--bg3); color: var(--muted); font: 700 15px var(--font); font-stretch: 112%; text-transform: uppercase; }
.avatar.yo { background: var(--accent-bg); color: var(--accent); }
.de { min-width: 0; }
.de strong { font-weight: 650; }
.de .dir { color: var(--faint); font-size: 13px; margin-left: 6px; overflow-wrap: anywhere; }
.de .para { display: block; font-size: 13px; color: var(--faint); margin-top: 1px; overflow-wrap: anywhere; }
.mensaje-cabeza .cuando { font: 12px/1.8 var(--mono); font-variant-numeric: tabular-nums; color: var(--faint); white-space: nowrap; text-align: right; }
.mensaje-cabeza .acciones-msg { display: flex; justify-content: flex-end; gap: 0; margin-top: 2px; }
.mensaje-cabeza .acciones-msg .icono { width: 34px; height: 34px; }
.mensaje-cabeza .acciones-msg svg { width: 18px; height: 18px; }
.sellos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sello { display: inline-flex; align-items: center; gap: 5px; font: 500 12px/1 var(--font); color: var(--muted); padding: 4px 7px 4px 5px; border: 1px solid var(--line2); }
.sello svg { width: 14px; height: 14px; }
.sello.ok svg { color: var(--ok); }
.sello.malo { color: #ffc4b8; border-color: rgba(239, 122, 98, .45); }
.sello.malo svg { color: var(--danger); }

.mensaje.plegado { cursor: pointer; padding: 12px 0; }
.mensaje.plegado:hover { background: linear-gradient(90deg, var(--bg1), transparent 80%); }
.mensaje.plegado .cuerpo, .mensaje.plegado .adjuntos, .mensaje.plegado .acciones-msg, .mensaje.plegado .sellos, .mensaje.plegado .imagenes, .mensaje.plegado .de .para, .mensaje.plegado .pie-msg { display: none; }
.mensaje.plegado .resumen-plegado { display: block; }
.resumen-plegado { display: none; color: var(--faint); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cuerpo { margin: 16px 0 0 52px; }
.cuerpo-texto { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 72ch; font-size: 15.5px; line-height: 1.6; }
.cuerpo-texto details { color: var(--faint); margin-top: 8px; }
.cuerpo-texto summary { cursor: pointer; list-style: none; display: inline-block; font: 600 13px/1 var(--mono); padding: 2px 8px 6px; background: var(--bg2); color: var(--muted); letter-spacing: .1em; }
.cuerpo-texto summary::-webkit-details-marker { display: none; }
.hoja { display: block; width: 100%; border: 0; background: var(--paper); min-height: 120px; color-scheme: light; }
.imagenes { margin: 14px 0 0 52px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 8px 8px 12px; background: var(--bg1); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.imagenes span { flex: 1 1 260px; }
.imagenes .btn { min-height: 32px; padding: 0 10px; font-size: 13px; }

.adjuntos { margin: 16px 0 0 52px; display: flex; flex-wrap: wrap; gap: 8px; }
.adjunto { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0 10px; width: min(280px, 100%); padding: 8px 6px 8px 10px; border: 1px solid var(--line2); background: var(--bg1); color: var(--text); text-decoration: none; }
.adjunto:hover { border-color: #4a4a43; background: var(--bg2); }
.adjunto svg { color: var(--faint); }
.adjunto .nombre { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adjunto .peso { grid-column: 2; font: 11px var(--mono); color: var(--faint); }
.adjunto .bajar { grid-row: 1 / span 2; grid-column: 3; }
.adjunto .miniatura { grid-row: 1 / span 2; width: 36px; height: 36px; object-fit: cover; background: var(--bg3); }
.adjunto > svg:first-child { grid-row: 1 / span 2; }

.pie-msg { margin: 18px 0 0 52px; display: flex; gap: 8px; flex-wrap: wrap; }
.aviso-msg { margin: 14px 0 0 52px; padding: 10px 12px; font-size: 13.5px; border: 1px solid var(--line2); background: var(--bg1); color: var(--muted); }
.aviso-msg.malo { border-color: rgba(239, 122, 98, .45); background: var(--danger-bg); color: #ffc4b8; }
.aviso-msg .btn { min-height: 32px; font-size: 13px; padding: 0 10px; margin: 8px 8px 0 0; }

/* ---------- Redactar ---------- */
.redactor { border: 1px solid var(--line2); background: var(--bg1); margin-top: 20px; display: flex; flex-direction: column; }
.panel > .redactor { margin: 0; border: 0; min-height: 100%; background: var(--bg0); }
.redactor-cabeza { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 8px 0 20px; border-bottom: 1px solid var(--line); }
.redactor-cabeza h2 { margin: 0; flex: 1; font-size: 16px; font-weight: 650; }
.redactor-cabeza .guardado { font: 12px var(--mono); color: var(--faint); }
.campo { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 46px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--line); }
.campo > label { color: var(--faint); font-size: 14px; }
.campo input, .campo select { border: 0; background: transparent; padding: 8px 0; min-height: 40px; }
.campo input:focus, .campo select:focus { background: transparent; }
.campo:focus-within { box-shadow: inset 0 -1px 0 var(--accent); }
.campo .btn.quiet { min-height: 32px; padding: 0 8px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 4px 0; position: relative; min-width: 0; }
.chips input { flex: 1; min-width: 160px; width: auto; }
.chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 4px 3px 9px; font-size: 13.5px; background: var(--bg3); border: 1px solid var(--line2); border-radius: 2px; }
.chip.malo { border-color: rgba(239, 122, 98, .6); color: #ffc4b8; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { width: 22px; height: 22px; display: grid; place-items: center; background: none; border: 0; color: var(--faint); cursor: pointer; padding: 0; }
.chip button:hover { color: var(--text); }
.chip svg { width: 13px; height: 13px; }
.sugerencias { position: absolute; z-index: 10; left: 0; top: 100%; min-width: 300px; max-width: 100%; list-style: none; margin: 2px 0 0; padding: 4px 0; background: var(--bg2); border: 1px solid var(--line2); box-shadow: 0 12px 32px rgba(0, 0, 0, .5); }
.sugerencias li { padding: 8px 12px; cursor: pointer; display: grid; }
.sugerencias li small { color: var(--faint); font-size: 12.5px; }
.sugerencias li[aria-selected=true], .sugerencias li:hover { background: var(--bg3); }

.herramientas { display: flex; gap: 2px; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.herramientas .icono { width: 34px; height: 34px; }
.herramientas svg { width: 18px; height: 18px; }
.editor { min-height: 220px; padding: 18px 20px 24px; outline: none; font-size: 15.5px; line-height: 1.6; overflow-wrap: anywhere; flex: 1; }
.panel > .redactor .editor { min-height: 320px; }
.editor:empty::before { content: attr(data-placeholder); color: var(--faint); }
.editor blockquote { margin: 8px 0; padding-left: 12px; border-left: 1px solid var(--line2); color: var(--muted); }
.editor a { color: var(--accent); }
.editor .firma { color: var(--muted); }
.cita-original { margin: 0 20px 12px; font-size: 13px; color: var(--faint); }
.cita-original label { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.cita-original input { accent-color: var(--accent); width: 16px; height: 16px; }
.lista-adjuntos { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 12px; }
.lista-adjuntos .chip { font-size: 13px; }
.lista-adjuntos .chip .peso { font: 11px var(--mono); color: var(--faint); margin-left: 4px; }
.redactor-pie { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: inherit; }
.redactor-pie .hueco { flex: 1; }
.redactor.soltar { outline: 1px dashed var(--accent); outline-offset: -6px; }

/* ---------- Páginas (ajustes, direcciones) ---------- */
.pagina { max-width: 760px; padding: 32px 32px 120px; }
.pagina > h1 { font-size: 28px; font-weight: 700; font-stretch: 116%; letter-spacing: -.02em; margin: 0 0 8px; }
.pagina > p { color: var(--muted); max-width: 62ch; margin: 0 0 32px; }
.bloque { border-top: 1px solid var(--line); padding: 24px 0 28px; }
.bloque h2 { font-size: 17px; font-weight: 650; margin: 0 0 4px; }
.bloque > p { color: var(--muted); font-size: 14px; margin: 0 0 16px; max-width: 62ch; }
.bloque .fila { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.bloque .fila .field { flex: 1 1 220px; margin: 0; }
.opciones { display: grid; gap: 8px; }
.opcion { display: grid; grid-template-columns: 18px 1fr; gap: 2px 10px; align-items: start; padding: 12px; border: 1px solid var(--line); cursor: pointer; }
.opcion:hover { border-color: var(--line2); }
.opcion:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.opcion input { margin: 3px 0 0; accent-color: var(--accent); width: 16px; height: 16px; }
.opcion small { grid-column: 2; color: var(--muted); font-size: 13px; }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; font-weight: 600; color: var(--faint); font-size: 12px; padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line2); }
.tabla td { padding: 10px 8px 10px 0; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.tabla td.mono { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.tabla .acc { text-align: right; white-space: nowrap; }
.tabla .apagado { color: var(--faint); text-decoration: line-through; }
.etiquetas { display: flex; flex-wrap: wrap; gap: 6px; }
.pasos { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; display: grid; gap: 6px; max-width: 62ch; }
.estado { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.estado::before { content: ''; width: 7px; height: 7px; background: currentColor; }
.estado.ok { color: var(--ok); } .estado.pendiente { color: var(--accent); }

/* ---------- Avisos y diálogos ---------- */
.avisos { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); translate: -50% 0; z-index: 50; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: min(560px, calc(100% - 32px)); }
.aviso { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; background: var(--text); color: var(--bg0); font-size: 14px; font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); animation: subir .3s var(--ease); max-width: 100%; }
.aviso.error { background: #3a1c16; color: #ffd6cc; border: 1px solid rgba(239, 122, 98, .5); }
.aviso button { background: none; border: 0; color: inherit; font: 700 14px var(--font); cursor: pointer; padding: 6px 8px; text-decoration: underline; text-underline-offset: 3px; }
@keyframes subir { from { transform: translateY(12px); opacity: 0; } }

.atajos { border: 1px solid var(--line2); background: var(--bg1); color: var(--text); padding: 24px 28px; width: min(420px, calc(100% - 32px)); }
.atajos::backdrop { background: rgba(0, 0, 0, .6); }
.atajos h2 { margin: 0 0 16px; font-size: 18px; }
.atajos dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 20px; align-items: center; }
.atajos dt { display: flex; gap: 4px; } .atajos dd { margin: 0; color: var(--muted); }

.velo { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 19; }

/* ---------- Tablet: carril de iconos ---------- */
@media (max-width: 1099px) {
  :root { --carril: 64px; --lista: 340px; }
  .carril { padding: 0 8px 12px; align-items: center; }
  .carril .marca span { display: none; }
  .carril .marca { font-size: 15px; }
  .redactar { width: 44px; padding: 0; justify-content: center; }
  .redactar span, .carpetas a span, .carril-buzon { display: none; }
  .carpetas { width: 100%; }
  .carpetas a { justify-content: center; padding: 0; min-height: 44px; }
  .carpetas .cuenta { position: absolute; top: 4px; right: 4px; font-size: 10px; }
  .carpetas .cuenta:not(.nueva) { display: none; }
}

/* ---------- Móvil: una columna ---------- */
@media (max-width: 759px) {
  :root { --carril: 280px; }
  body { font-size: 16px; }
  .app { grid-template-columns: 100%; grid-template-rows: 100%; }
  .solo-movil { display: inline-grid; }
  .fab.solo-movil { display: grid; }
  .carril { position: fixed; z-index: 20; top: 0; bottom: 0; left: 0; width: var(--carril); padding: 0 12px 16px; align-items: stretch; transform: translateX(-100%); transition: transform .3s var(--ease); padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .app.menu-abierto .carril { transform: none; }
  .carril .marca { font-size: 19px; }
  .carril .marca span { display: inline; }
  .redactar { width: auto; padding: 0 16px; justify-content: flex-start; }
  .redactar span, .carpetas a span, .carril-buzon { display: block; }
  .carpetas a { justify-content: flex-start; padding: 0 10px; min-height: 46px; }
  .carpetas .cuenta { position: static; font-size: 12px; }
  .carpetas .cuenta:not(.nueva) { display: inline; }
  .lista { grid-column: 1; grid-row: 1; border-right: 0; }
  .lista-cabeza { padding: 0 8px; padding-top: env(safe-area-inset-top); height: calc(60px + env(safe-area-inset-top)); }
  .panel { grid-column: 1; grid-row: 1; z-index: 5; transform: translateX(100%); transition: transform .3s var(--ease); visibility: hidden; }
  .app.leyendo .panel { transform: none; visibility: visible; }
  .barra-hilo { padding: env(safe-area-inset-top) 4px 0; height: calc(56px + env(safe-area-inset-top)); }
  .conversacion, .pagina { padding: 20px 16px 120px; }
  .conversacion > h1 { font-size: 22px; }
  .cuerpo, .adjuntos, .imagenes, .pie-msg, .aviso-msg { margin-left: 0; }
  .mensaje-cabeza { grid-template-columns: 36px minmax(0, 1fr); }
  .mensaje-cabeza > div:last-child { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
  .mensaje.plegado .mensaje-cabeza > div:last-child { margin: 0 0 0 48px; }
  .avatar { width: 36px; height: 36px; }
  .de .dir { display: block; margin: 0; }
  .hilo { padding: 13px 14px 14px 8px; }
  .campo { padding-left: 16px; grid-template-columns: 52px minmax(0, 1fr) auto; }
  .redactor-cabeza { padding-top: env(safe-area-inset-top); }
  .redactor-pie { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .tabla .ocultable { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
