:root {
  --fondo: #EEF2F5; --lat: #E3E9EE; --papel: #FBFCFD; --tinta: #14253A; --tinta-suave: #5A6B7D;
  --linea: #CBD5DE; --linea-suave: #DCE3E9; --senal: #2457D6; --senal-suave: rgba(36,87,214,.10);
  --ahorro: #2E7D5B; --alerta: #B4531A; --burbuja: #14253A; --burbuja-texto: #FAFBFC;
  --codigo: #E6ECF1; --hover: rgba(20,37,58,.06); --sombra: 0 10px 30px rgba(20,37,58,.16);
  --ui: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --texto: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}
@media (prefers-color-scheme: dark) {
  :root { --fondo: #0F1824; --lat: #0B131D; --papel: #172232; --tinta: #E6ECF2; --tinta-suave: #9AA9BA;
          --linea: #2B3A4D; --linea-suave: #223042; --senal: #6B95FF; --senal-suave: rgba(107,149,255,.14);
          --ahorro: #5BC28F; --alerta: #E6895A; --burbuja: #2457D6; --burbuja-texto: #FFFFFF;
          --codigo: #0C141E; --hover: rgba(230,236,242,.07); --sombra: 0 10px 30px rgba(0,0,0,.5); }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--fondo); }
body { font-family: var(--ui); color: var(--tinta); line-height: 1.45; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
input[type=file] { display: none; }
:focus-visible { outline: 3px solid var(--senal); outline-offset: 2px; }
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i.relleno { fill: currentColor; stroke: none; }
.i.chico { width: 16px; height: 16px; }

.app { height: 100vh; height: 100dvh; display: flex; }

/* ---------- Barra lateral ---------- */
.lateral { width: 284px; flex: none; display: flex; flex-direction: column; gap: 8px; background: var(--lat); border-right: 1px solid var(--linea-suave); padding: 12px 10px calc(10px + var(--sab)); }
.lat-cab { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 4px; }
.marca { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--burbuja); color: var(--burbuja-texto); display: grid; place-items: center; font-weight: 700; font-size: 17px; }
.logo.grande { width: 56px; height: 56px; border-radius: 16px; font-size: 30px; }
.btn-nueva { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--linea); background: var(--papel); cursor: pointer; font-weight: 600; font-size: 15px; }
.btn-nueva:hover { border-color: var(--senal); }
.buscar { display: flex; align-items: center; gap: 8px; padding: 0 10px; border-radius: 10px; background: var(--hover); color: var(--tinta-suave); }
.buscar input { flex: 1; min-width: 0; border: 0; background: none; outline: 0; font: inherit; font-size: 15px; color: var(--tinta); padding: 9px 0; }
.buscar input::-webkit-search-cancel-button { filter: grayscale(1); }
.lista { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px; }
.grupo { font-size: 12px; font-weight: 600; color: var(--tinta-suave); padding: 14px 10px 4px; text-transform: uppercase; letter-spacing: .04em; }
.item { display: flex; align-items: center; border-radius: 10px; position: relative; }
.item:hover, .item.activo { background: var(--hover); }
.item.activo { background: var(--senal-suave); }
.item-abrir { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 9px 4px 9px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.item-tit { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.item-tit .i { width: 13px; height: 13px; color: var(--tinta-suave); }
.item-snip { font-size: 12.5px; color: var(--tinta-suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-snip mark { background: rgba(36,87,214,.18); color: inherit; border-radius: 2px; }
.item-mas { opacity: 0; }
.item:hover .item-mas, .item.activo .item-mas, .item-mas:focus-visible { opacity: 1; }
@media (hover: none) { .item-mas { opacity: .7; } }
.vacio { color: var(--tinta-suave); font-size: 14px; padding: 16px 10px; }
.lat-pie { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--linea-suave); padding-top: 8px; }
.lat-btn { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 9px 10px; border-radius: 10px; cursor: pointer; font-size: 14.5px; text-align: left; }
.lat-btn:hover { background: var(--hover); }

/* ---------- Columna principal ---------- */
main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
header { flex: none; display: flex; align-items: center; gap: 4px; padding: calc(8px + var(--sat)) 10px 8px; border-bottom: 1px solid var(--linea-suave); }
.titulo { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 16px; padding: 0 4px; }
.titulo #titulo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.candado { color: var(--alerta); display: inline-flex; }
.ico { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--tinta-suave); cursor: pointer; display: grid; place-items: center; flex: none; padding: 0; }
.ico:hover { background: var(--hover); color: var(--tinta); }
.ico.activo { color: var(--alerta); background: var(--hover); }
.solo-pc { display: none; }

.hilo { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.hilo-in { max-width: 780px; margin: 0 auto; padding: 16px 14px 12px; display: flex; flex-direction: column; gap: 20px; }

/* Bienvenida */
.bienvenida { padding: 8vh 4px 0; display: flex; flex-direction: column; gap: 18px; }
.bienvenida h2 { font-size: clamp(26px, 6vw, 34px); font-weight: 600; margin: 0; letter-spacing: -0.02em; line-height: 1.15; }
.bienvenida p { margin: 0; color: var(--tinta-suave); font-size: 15.5px; max-width: 54ch; }
.tarjetas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tarjeta { text-align: left; border: 1px solid var(--linea); background: var(--papel); border-radius: 14px; padding: 12px 13px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; min-height: 86px; }
.tarjeta:hover { border-color: var(--senal); }
.tarjeta .i { color: var(--senal); }
.tarjeta strong { font-size: 14.5px; font-weight: 600; }
.tarjeta span { font-size: 12.5px; color: var(--tinta-suave); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 13px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--linea); background: var(--papel); cursor: pointer; }
.chip:hover { border-color: var(--senal); }

/* Mensajes */
.msg-user { align-self: flex-end; max-width: 86%; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.burbuja { background: var(--burbuja); color: var(--burbuja-texto); padding: 9px 14px; border-radius: 18px 18px 5px 18px; white-space: pre-wrap; word-break: break-word; font-size: 16px; }
.adj { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.adj img { width: 92px; height: 92px; object-fit: cover; border-radius: 12px; display: block; cursor: zoom-in; border: 1px solid var(--linea-suave); }
.adj a, .adj span.archivo { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 7px 10px; border-radius: 10px; background: var(--papel); border: 1px solid var(--linea); color: var(--tinta); text-decoration: none; max-width: 220px; }
.adj a span, .adj span.archivo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor { width: min(560px, 86vw); display: flex; flex-direction: column; gap: 8px; }
.editor textarea { width: 100%; min-height: 80px; border: 1px solid var(--senal); border-radius: 14px; padding: 10px 12px; font: inherit; font-size: 16px; background: var(--papel); color: var(--tinta); resize: vertical; }
.editor .fila { justify-content: flex-end; }

.msg-ia { max-width: 100%; display: flex; flex-direction: column; gap: 8px; }
.cuerpo-md { font-family: var(--texto); font-size: 17.5px; line-height: 1.55; word-break: break-word; }
.cuerpo-md > :first-child { margin-top: 0; } .cuerpo-md > :last-child { margin-bottom: 0; }
.cuerpo-md p { margin: 0 0 .75em; }
.cuerpo-md h1, .cuerpo-md h2, .cuerpo-md h3, .cuerpo-md h4 { font-family: var(--ui); font-size: 16.5px; font-weight: 600; margin: 1.1em 0 .4em; }
.cuerpo-md ul, .cuerpo-md ol { padding-left: 1.35em; margin: .3em 0 .75em; }
.cuerpo-md li { margin: .2em 0; }
.cuerpo-md a { color: var(--senal); }
.cuerpo-md code { font-family: var(--mono); font-size: 13.5px; background: var(--codigo); padding: 1px 5px; border-radius: 4px; }
.cuerpo-md pre { margin: .6em 0 .9em; border-radius: 12px; overflow: hidden; background: var(--codigo); border: 1px solid var(--linea-suave); }
.cuerpo-md pre code { display: block; padding: 12px 14px; overflow-x: auto; background: none; font-size: 13px; line-height: 1.5; }
.code-cab { display: flex; justify-content: space-between; align-items: center; font-family: var(--ui); font-size: 12px; color: var(--tinta-suave); padding: 5px 8px 5px 14px; border-bottom: 1px solid var(--linea-suave); }
.code-cab button { border: 0; background: none; cursor: pointer; color: var(--tinta-suave); display: inline-flex; gap: 5px; align-items: center; font-size: 12px; padding: 4px 6px; border-radius: 6px; }
.code-cab button:hover { background: var(--hover); color: var(--tinta); }
.cuerpo-md table { border-collapse: collapse; font-family: var(--ui); font-size: 14px; display: block; overflow-x: auto; margin: .5em 0 .9em; }
.cuerpo-md th, .cuerpo-md td { border: 1px solid var(--linea); padding: 6px 10px; text-align: left; }
.cuerpo-md th { background: var(--hover); }
.cuerpo-md blockquote { margin: .5em 0; padding-left: 12px; border-left: 3px solid var(--linea); color: var(--tinta-suave); }
.cuerpo-md hr { border: 0; border-top: 1px solid var(--linea); margin: 1em 0; }
.cursor { display: inline-block; width: .55em; height: 1.05em; vertical-align: -0.15em; background: var(--senal); border-radius: 2px; margin-left: 2px; animation: parpadeo 1s steps(2) infinite; }
@keyframes parpadeo { 50% { opacity: 0; } }
.estado { display: flex; align-items: center; gap: 9px; color: var(--tinta-suave); font-size: 14.5px; }
.estado .punto { width: 9px; height: 9px; border-radius: 50%; background: var(--senal); animation: pulso 1.2s ease-in-out infinite; }
@keyframes pulso { 0%, 100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1.15); opacity: 1; } }
.imagenes { display: flex; flex-wrap: wrap; gap: 8px; }
.imagenes:empty, .fuentes:empty { display: none; }
.imagenes img { max-width: min(100%, 512px); border-radius: 14px; display: block; cursor: zoom-in; border: 1px solid var(--linea-suave); background: var(--hover); }
.fuentes { display: flex; flex-direction: column; gap: 6px; }
.fuentes-tit { font-size: 12.5px; font-weight: 600; color: var(--tinta-suave); text-transform: uppercase; letter-spacing: .04em; }
.fuentes-lista { display: flex; gap: 6px; flex-wrap: wrap; }
.fuente { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; font-size: 13px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--linea); background: var(--papel); color: var(--tinta); text-decoration: none; }
.fuente:hover { border-color: var(--senal); }
.fuente b { font-weight: 600; color: var(--senal); }
.fuente span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.meta { font-size: 12.5px; color: var(--tinta-suave); display: flex; gap: 2px 10px; flex-wrap: wrap; align-items: center; }
.etiqueta { display: inline-block; font-size: 11.5px; font-weight: 600; border: 1px solid currentColor; border-radius: 5px; padding: 0 5px; }
.etiqueta.gratis { color: var(--ahorro); }
.etiqueta.web { color: var(--senal); }
.etiqueta.alerta { color: var(--alerta); }
.acciones { display: flex; gap: 2px; flex-wrap: wrap; margin-left: -8px; }
.msg-user .acciones { margin: 0 -6px 0 0; }
.accion { border: 0; background: none; color: var(--tinta-suave); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; padding: 6px 8px; border-radius: 8px; }
.accion:hover { background: var(--hover); color: var(--tinta); }
.accion .i { width: 17px; height: 17px; }
.accion.activo { color: var(--senal); }
@media (max-width: 599px) { .msg-ia .accion span { display: none; } .msg-ia .accion { padding: 8px 9px; } }
@media (hover: hover) and (min-width: 900px) {
  .msg-user .acciones { opacity: 0; transition: opacity .15s; }
  .msg-user:hover .acciones, .msg-user .acciones:focus-within { opacity: 1; }
}
.error { color: var(--alerta); font-size: 15px; }
.nota { font-size: 13px; color: var(--tinta-suave); font-style: italic; }

/* ---------- Escritura ---------- */
.compositor { flex: none; width: 100%; max-width: 780px; margin: 0 auto; padding: 6px 12px calc(8px + var(--sab)); position: relative; }
.modos, .previews { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 0 6px; }
.modos:empty, .previews:empty { display: none; }
.modo { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 5px 6px 5px 10px; border-radius: 999px; background: var(--senal-suave); color: var(--senal); border: 0; cursor: pointer; }
.modo.conf { background: rgba(180,83,26,.12); color: var(--alerta); }
.modo .i { width: 15px; height: 15px; }
.prev { position: relative; display: flex; align-items: center; gap: 8px; background: var(--papel); border: 1px solid var(--linea); border-radius: 12px; padding: 6px 30px 6px 6px; font-size: 13px; max-width: 100%; }
.prev img { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; }
.prev .tipo { width: 42px; height: 42px; border-radius: 8px; background: var(--codigo); display: grid; place-items: center; font-weight: 700; font-size: 10px; color: var(--tinta-suave); }
.prev .nombre { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prev .quitar { position: absolute; right: 3px; top: 3px; border: 0; background: none; color: var(--tinta-suave); cursor: pointer; padding: 3px; display: grid; }
.caja { background: var(--papel); border: 1px solid var(--linea); border-radius: 24px; padding: 5px; display: flex; gap: 2px; align-items: flex-end; box-shadow: 0 1px 2px rgba(20,37,58,.05); }
.caja:focus-within { border-color: var(--senal); box-shadow: 0 0 0 3px var(--senal-suave); }
textarea#prompt { flex: 1; min-width: 0; min-height: 40px; max-height: 34vh; resize: none; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; color: var(--tinta); padding: 9px 6px; line-height: 1.38; }
.enviar { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--senal); color: #fff; cursor: pointer; flex: none; display: grid; place-items: center; padding: 0; }
.enviar:disabled { opacity: .4; cursor: default; }
.enviar.parar { background: var(--tinta); color: var(--papel); }
.ayuda { font-size: 11.5px; color: var(--tinta-suave); padding: 5px 6px 0; text-align: center; }

/* ---------- Menús, paneles y ventanas ---------- */
.telon { position: fixed; inset: 0; background: rgba(8,14,22,.42); z-index: 25; display: none; }
.telon.abierto { display: block; }
.menu { position: fixed; z-index: 60; min-width: 230px; max-width: calc(100vw - 20px); background: var(--papel); border: 1px solid var(--linea); border-radius: 14px; box-shadow: var(--sombra); padding: 6px; display: flex; flex-direction: column; }
.menu button { display: flex; align-items: center; gap: 11px; border: 0; background: none; padding: 10px 11px; border-radius: 9px; cursor: pointer; font-size: 15px; text-align: left; }
.menu button:hover, .menu button:focus-visible { background: var(--hover); }
.menu button.peligro { color: var(--alerta); }
.menu button .marca-on { margin-left: auto; color: var(--senal); }
.menu hr { border: 0; border-top: 1px solid var(--linea-suave); margin: 4px 6px; }
.menu small { display: block; font-size: 12px; color: var(--tinta-suave); }

.panel { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; max-height: 82vh; max-height: 82dvh; overflow-y: auto; background: var(--papel); border-radius: 18px 18px 0 0; padding: 12px 18px calc(18px + var(--sab)); transform: translateY(105%); transition: transform .25s ease; box-shadow: var(--sombra); }
.panel.abierto { transform: none; }
.panel-cab { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.panel-cab h2 { font-size: 17px; font-weight: 600; margin: 0; }
.panel h3, .modal h3 { font-size: 12.5px; font-weight: 600; color: var(--tinta-suave); text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 8px; }
.claves { font-size: 13px; color: var(--tinta-suave); display: flex; gap: 12px; flex-wrap: wrap; }
.claves span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--linea); }
.claves .si::before { background: var(--ahorro); } .claves .no::before { background: var(--alerta); }
.escalera { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.escalera li { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--linea); color: var(--tinta-suave); }
.escalera li strong { display: block; font-weight: 600; font-size: 14px; color: var(--tinta); }
.escalera li small { font-size: 12px; }
.escalera li.activo { background: var(--senal); border-color: var(--senal); color: #fff; }
.escalera li.activo strong { color: #fff; }
dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
dt { color: var(--tinta-suave); } dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; word-break: break-word; }
.motivo { font-size: 14px; margin: 10px 0 0; color: var(--tinta-suave); }
.total, .presupuesto { font-size: 14px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--linea-suave); }
.total .ahorro { color: var(--ahorro); font-weight: 600; }
.barra { height: 6px; border-radius: 3px; background: var(--linea); margin-top: 6px; overflow: hidden; }
.barra div { height: 100%; background: var(--ahorro); }
.barra.aviso div { background: var(--alerta); }

.modal { position: fixed; inset: 0; z-index: 50; background: rgba(8,14,22,.45); display: flex; align-items: flex-end; justify-content: center; }
.modal-caja { background: var(--papel); width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 14px 18px calc(18px + var(--sab)); display: flex; flex-direction: column; gap: 12px; box-shadow: var(--sombra); }
.campo { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.campo textarea, .campo input, .fila input { font: inherit; font-size: 16px; font-weight: 400; color: var(--tinta); background: var(--fondo); border: 1px solid var(--linea); border-radius: 12px; padding: 10px 12px; resize: vertical; width: 100%; }
.campo textarea:focus, .campo input:focus, .fila input:focus { outline: 0; border-color: var(--senal); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--tinta-suave); }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--senal); flex: none; }
.check strong { color: var(--tinta); }
.memorias { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 32vh; overflow-y: auto; }
.memorias li { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 6px 4px 6px 10px; border-radius: 10px; background: var(--fondo); }
.memorias li span { flex: 1; }
.memorias .vacio { background: none; padding: 4px 0; }
.fila { display: flex; gap: 8px; align-items: center; }
.fila.fin { margin-top: 4px; }
.sep { flex: 1; }
.btn { font-size: 15px; font-weight: 600; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--linea); background: var(--papel); color: var(--tinta); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--senal); }
.btn.primario { background: var(--senal); border-color: var(--senal); color: #fff; }
.btn-txt { border: 0; background: none; color: var(--tinta-suave); font-size: 13.5px; cursor: pointer; padding: 6px 0; text-align: left; text-decoration: underline; }
.btn-txt.peligro { color: var(--alerta); }

.pin { position: fixed; inset: 0; z-index: 80; background: var(--fondo); display: grid; place-items: center; padding: 20px; }
.pin-caja { width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.pin-caja h2 { margin: 4px 0 0; font-size: 24px; }
.pin-caja p { margin: 0; color: var(--tinta-suave); font-size: 15px; }
.pin-caja input { width: 100%; font: inherit; font-size: 24px; letter-spacing: .3em; text-align: center; padding: 12px; border-radius: 14px; border: 1px solid var(--linea); background: var(--papel); color: var(--tinta); }
.pin-caja .btn { width: 100%; }
.pin-error { color: var(--alerta) !important; min-height: 1.2em; }

.visor { position: fixed; inset: 0; z-index: 70; background: rgba(5,9,14,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: calc(16px + var(--sat)) 16px calc(16px + var(--sab)); }
.visor img { max-width: 100%; max-height: calc(100% - 70px); border-radius: 10px; object-fit: contain; }
.visor-barra { display: flex; gap: 10px; }

.aviso { position: fixed; left: 50%; bottom: calc(100px + var(--sab)); transform: translateX(-50%); z-index: 90; background: var(--tinta); color: var(--papel); padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--sombra); max-width: calc(100vw - 32px); text-align: center; }

/* Resaltado de código */
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-type { color: #7C3AED; }
.hljs-string, .hljs-attr, .hljs-template-variable, .hljs-regexp { color: #15803D; }
.hljs-number, .hljs-literal, .hljs-symbol { color: #B45309; }
.hljs-comment, .hljs-quote { color: #6B7A8C; font-style: italic; }
.hljs-title, .hljs-section, .hljs-function .hljs-title, .hljs-name { color: #1D4ED8; }
.hljs-meta, .hljs-attribute, .hljs-variable { color: #BE185D; }
@media (prefers-color-scheme: dark) {
  .hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-type { color: #C4A5FF; }
  .hljs-string, .hljs-attr, .hljs-template-variable, .hljs-regexp { color: #7EE2A8; }
  .hljs-number, .hljs-literal, .hljs-symbol { color: #F5B971; }
  .hljs-comment, .hljs-quote { color: #8796A8; }
  .hljs-title, .hljs-section, .hljs-function .hljs-title, .hljs-name { color: #8DB4FF; }
  .hljs-meta, .hljs-attribute, .hljs-variable { color: #F59AC4; }
}

/* ---------- Celular ---------- */
@media (max-width: 899px) {
  .lateral { position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: min(86vw, 330px); padding-top: calc(12px + var(--sat)); padding-left: calc(10px + var(--sal)); transform: translateX(-104%); transition: transform .25s ease; box-shadow: var(--sombra); }
  .lateral.abierto { transform: none; }
  #telon-lat { z-index: 35; }
}
/* ---------- Computador ---------- */
@media (min-width: 900px) {
  .solo-movil { display: none !important; }
  .solo-pc { display: inline; }
  header { padding: 10px 18px; }
  .hilo-in { padding: 24px 24px 12px; gap: 24px; }
  .compositor { padding: 6px 24px 18px; }
  .bienvenida { padding-top: 12vh; }
  .tarjetas { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .panel { left: auto; top: 0; right: 0; bottom: 0; width: 360px; max-height: none; border-radius: 0; transform: translateX(105%); padding: 16px 20px; }
  .panel.abierto { transform: none; }
  .modal { align-items: center; }
  .modal-caja { border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Personas especiales */
.nota-aj { margin: -4px 0 0; font-size: 13px; color: var(--tinta-suave); }
.personas { display: flex; flex-direction: column; gap: 10px; }
.persona { border: 1px solid var(--linea); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--fondo); }
.persona .fila input { background: var(--papel); }
.persona textarea { font: inherit; font-size: 15px; color: var(--tinta); background: var(--papel); border: 1px solid var(--linea); border-radius: 10px; padding: 8px 10px; resize: vertical; min-height: 56px; }
.persona .checks { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--tinta-suave); }
.persona .checks label { display: flex; align-items: center; gap: 6px; }
.persona .checks input { width: 18px; height: 18px; accent-color: var(--senal); }
.modal-caja > * { flex-shrink: 0; }

/* Personalización, perfil y consentimiento */
.aj-sec { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--linea-suave); }
.aj-sec:first-of-type { border-top: 0; padding-top: 0; }
.aj-sec h3 { margin: 0; }
.aj-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--hover); color: var(--tinta-suave); }
.pill.on { background: rgba(46,125,91,.14); color: var(--ahorro); }
.fila.envolver { flex-wrap: wrap; }
.aj-pie { position: sticky; bottom: calc(-18px - var(--sab)); background: var(--papel); padding: 12px 0 calc(4px + var(--sab)); display: flex; justify-content: flex-end; border-top: 1px solid var(--linea-suave); }
.perfil-vista { display: flex; flex-direction: column; gap: 10px; }
.perfil-grupo h4 { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--tinta); }
.perfil-grupo ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.perfil-grupo li { display: flex; align-items: center; gap: 6px; font-size: 14px; padding: 4px 4px 4px 10px; border-radius: 9px; background: var(--fondo); }
.perfil-grupo li span { flex: 1; }
.perfil-grupo li .ico { width: 30px; height: 30px; }
.perfil-estilo { font-size: 14px; color: var(--tinta-suave); }
.eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--tinta-suave); }
.c-tit { margin: 2px 0 0; font-size: 23px; letter-spacing: -.02em; }
.caja-check { border: 1px solid var(--linea); border-radius: 12px; padding: 12px; cursor: pointer; }
.caja-check:has(input:checked) { border-color: var(--senal); background: var(--senal-suave); }
.nota.mem { font-style: normal; display: inline-flex; align-items: center; gap: 6px; color: var(--senal); cursor: pointer; border: 0; background: none; padding: 0; font-size: 13px; }
.nota.mem .i { width: 15px; height: 15px; }
#consent { z-index: 75; }

/* v9: llaves de acceso, invitados y aparatos */
.nota-chica { font-size: 13px !important; color: var(--tinta-suave); }
.aparatos, .invitados { list-style: none; margin: 8px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.aparatos li, .invitados li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--linea); border-radius: 12px; background: var(--papel); }
.aparatos li > div, .invitados li > .inv-datos { flex: 1; min-width: 0; }
.aparatos small, .invitados small { display: block; color: var(--tinta-suave); font-size: 12.5px; }
.invitados li { flex-wrap: wrap; }
.inv-acciones { display: flex; gap: 6px; flex-wrap: wrap; }
.inv-acciones .btn-txt { font-size: 13px; }
.etiqueta { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--linea); color: var(--tinta-suave); margin-left: 6px; vertical-align: 1px; }
.etiqueta.ok { border-color: transparent; background: color-mix(in srgb, var(--acento, #2f7d5b) 16%, transparent); color: var(--tinta); }
.enlace-caja { margin-top: 12px; padding: 14px; border: 1px dashed var(--linea); border-radius: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.enlace-caja .qr { width: 190px; height: 190px; background: #fff; border-radius: 10px; padding: 6px; }
.enlace-caja .qr svg { width: 100%; height: 100%; display: block; }
.enlace-caja code { font-size: 12px; word-break: break-all; color: var(--tinta-suave); }
.enlace-caja .fila { justify-content: center; }
