/* StarChat · estilo. Marca Star, tema claro/oscuro, diseño tipo mensajería pulido. */
:root {
  color-scheme: light dark;
  /* Tokens de espaciado, radio, control táctil y estados (v1.3, contraste AA verificado) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s6: 24px; --s8: 32px; --r: 14px; --ctl: 44px;
  --focus: #1a73e8; --ok: #0b7a4b; --warn: #8a5a00; --bad: #c62f4a; --verde-txt: #0b7a4b;
  --verde: #1fab6d; --verde-osc: #0b7a4b; --verde-tinte: #d9fdd3;
  --fondo: #eae6df; --panel: #ffffff; --panel-2: #f0f2f5; --barra: #f0f2f5;
  --texto: #111b21; --suave: #5b6b75; --linea: #e9edef; --burbuja-in: #ffffff; --burbuja-out: #d9fdd3;
  --azul: #53bdeb; --rojo: #e4536b; --sombra: 0 1px 2px rgba(11,20,26,.08);
  --dev-bg: #fff6d6; --dev-ink: #7a5b00; --tinte: rgba(0,0,0,.05);
  /* Nombres estándar del ecosistema (alias de los propios de StarChat) */
  --bg: var(--fondo); --card: var(--panel); --ink: var(--texto); --mut: var(--suave); --line: var(--linea);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --fondo: #0b141a; --panel: #111b21; --panel-2: #202c33; --barra: #202c33;
    --texto: #e9edef; --suave: #8696a0; --linea: #222d34; --burbuja-in: #202c33; --burbuja-out: #005c4b;
    --verde-tinte: #025144; --sombra: 0 1px 2px rgba(0,0,0,.3);
    --verde-txt: #1fab6d; --focus: #8ab4f8; --ok: #1fab6d; --warn: #ffd166; --bad: #f07a8c;
    --dev-bg: #3a3410; --dev-ink: #ffe08a; --tinte: rgba(255,255,255,.06);
  }
}
:root[data-tema="oscuro"] {
  --fondo: #0b141a; --panel: #111b21; --panel-2: #202c33; --barra: #202c33;
  --texto: #e9edef; --suave: #8696a0; --linea: #222d34; --burbuja-in: #202c33; --burbuja-out: #005c4b;
  --verde-tinte: #025144; --sombra: 0 1px 2px rgba(0,0,0,.3);
  --verde-txt: #1fab6d; --focus: #8ab4f8; --ok: #1fab6d; --warn: #ffd166; --bad: #f07a8c;
  --dev-bg: #3a3410; --dev-ink: #ffe08a; --tinte: rgba(255,255,255,.06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--fondo); color: var(--texto); overflow: hidden;
}
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea { font: inherit; color: var(--texto); }
.oculto { display: none !important; }
.cargando { position: fixed; inset: 0; display: grid; place-items: center; background: var(--fondo); z-index: 100; }
.spin { width: 42px; height: 42px; border: 4px solid var(--linea); border-top-color: var(--verde); border-radius: 50%; animation: giro .8s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }

/* ---------- Acceso (login) ---------- */
#acceso { position: fixed; inset: 0; display: grid; place-items: center; background: linear-gradient(135deg, var(--verde-osc), #063); padding: 20px; z-index: 50; }
.tarjeta { background: var(--panel); border-radius: 16px; padding: 28px 24px; width: 100%; max-width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.marca { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.marca img { width: 48px; height: 48px; }
.marca h1 { font-size: 24px; margin: 0; }
.marca .estrella { color: var(--verde); }
#acceso label { display: block; font-size: 13px; color: var(--suave); margin: 14px 0 6px; }
#acceso input { width: 100%; padding: 12px 14px; border: 1px solid var(--linea); border-radius: 10px; background: var(--panel-2); }
#acceso input:focus { outline: 2px solid var(--verde); border-color: transparent; }
.btn { background: var(--verde-osc); color: #fff; padding: 12px; border-radius: 10px; width: 100%; font-weight: 600; margin-top: 18px; }
.btn:active { transform: scale(.99); }
.btn.sec { background: var(--panel-2); color: var(--texto); }
.aviso { font-size: 12.5px; color: var(--suave); margin-top: 14px; }
.dev { background: var(--dev-bg); color: var(--dev-ink); padding: 8px 10px; border-radius: 8px; font-size: 13px; margin-top: 12px; text-align: center; }
.error { color: var(--bad); font-size: 13px; margin-top: 8px; min-height: 16px; }

/* ---------- Estructura ---------- */
#app { display: grid; grid-template-columns: minmax(320px, 400px) 1fr; height: 100%; }
#lateral { background: var(--panel); border-right: 1px solid var(--linea); display: flex; flex-direction: column; min-width: 0; }
#conversacion { display: flex; flex-direction: column; min-width: 0; background: var(--fondo); background-image: radial-gradient(var(--linea) .5px, transparent .5px); background-size: 22px 22px; }
.vacio { flex: 1; display: grid; place-items: center; text-align: center; color: var(--suave); padding: 30px; }
.vacio img { width: 80px; opacity: .4; margin-bottom: 14px; }

/* ---------- Barra superior lateral ---------- */
.barra-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--barra); min-height: 56px; }
.barra-top .yo-foto { width: 40px; height: 40px; }
.barra-top .crece { flex: 1; font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ico-btn { width: var(--ctl); height: var(--ctl); border-radius: 50%; display: grid; place-items: center; color: var(--suave); font-size: 20px; }
.ico-btn:hover { background: var(--panel-2); }
.tabs { display: flex; background: var(--panel); border-bottom: 1px solid var(--linea); }
.tabs button { flex: 1; padding: 11px; color: var(--suave); font-weight: 600; font-size: 13.5px; border-bottom: 3px solid transparent; }
.tabs button.activa { color: var(--verde-txt); border-color: var(--verde-txt); }
.buscador { padding: 8px 12px; background: var(--panel); }
.buscador input { width: 100%; padding: 9px 14px; border-radius: 10px; border: 0; background: var(--panel-2); }

/* ---------- Lista de chats ---------- */
.lista { flex: 1; overflow-y: auto; }
.fila { display: flex; gap: 12px; padding: 11px 14px; cursor: pointer; align-items: center; border-bottom: 1px solid var(--linea); }
.fila:hover { background: var(--panel-2); }
.fila.sel { background: var(--panel-2); }
.avatar { width: 48px; height: 48px; border-radius: 50%; flex: none; object-fit: cover; background: var(--verde-osc); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 18px; overflow: hidden; }
.avatar.ch { width: 40px; height: 40px; font-size: 15px; }
.fila .med { flex: 1; min-width: 0; }
.fila .lin1 { display: flex; justify-content: space-between; gap: 8px; }
.fila .nom { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila .hora { font-size: 12px; color: var(--suave); flex: none; }
.fila .lin2 { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.fila .prev { color: var(--suave); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.globo { background: var(--verde-osc); color: #fff; border-radius: 12px; min-width: 20px; height: 20px; padding: 0 6px; font-size: 12px; display: grid; place-items: center; font-weight: 600; }
.fila .iconos { color: var(--suave); font-size: 15px; display: flex; gap: 4px; }

/* ---------- Conversación ---------- */
.conv-top { display: flex; align-items: center; gap: 12px; padding: 9px 14px; background: var(--barra); min-height: 58px; }
.conv-top .info { flex: 1; min-width: 0; cursor: pointer; }
.conv-top .nom { font-weight: 600; font-size: 16px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-top .sub { font-size: 12.5px; color: var(--suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-top .sub.enlinea { color: var(--verde-txt); }
.mensajes { flex: 1; overflow-y: auto; padding: 14px 6% 6px; display: flex; flex-direction: column; gap: 3px; }
.msg { max-width: 72%; padding: 6px 9px 8px; border-radius: 9px; position: relative; box-shadow: var(--sombra); word-wrap: break-word; }
.msg.in { background: var(--burbuja-in); align-self: flex-start; border-top-left-radius: 2px; }
.msg.out { background: var(--burbuja-out); align-self: flex-end; border-top-right-radius: 2px; }
.msg.sis { align-self: center; background: var(--verde-tinte); color: var(--texto); font-size: 12.5px; padding: 5px 12px; border-radius: 8px; max-width: 85%; text-align: center; }
.msg .autor { font-size: 12.5px; font-weight: 600; color: var(--verde-txt); margin-bottom: 2px; }
.msg .texto { white-space: pre-wrap; }
.msg .meta { font-size: 11px; color: var(--suave); float: right; margin: 4px 0 -2px 10px; display: flex; align-items: center; gap: 3px; }
.msg .palomita { color: var(--suave); font-size: 13px; }
.msg .palomita.leido { color: var(--azul); }
.msg.destacado::after { content: "★"; position: absolute; top: -6px; right: 4px; color: #f2c200; font-size: 12px; }
.msg .cita { border-left: 3px solid var(--verde); background: var(--tinte); border-radius: 4px; padding: 3px 7px; margin-bottom: 4px; font-size: 13px; }
.msg .cita .q { color: var(--verde); font-weight: 600; font-size: 12px; }
.msg img.foto, .msg video { max-width: 260px; max-height: 320px; border-radius: 6px; display: block; cursor: pointer; }
.msg .doc { display: flex; gap: 10px; align-items: center; background: rgba(0,0,0,.05); padding: 9px; border-radius: 8px; min-width: 180px; }
.msg .doc .ic { font-size: 26px; }
.audio { display: flex; align-items: center; gap: 8px; min-width: 200px; }
.audio button { font-size: 22px; color: var(--verde-osc); }
.audio .barra { flex: 1; height: 4px; background: var(--suave); border-radius: 2px; position: relative; }
.audio .barra i { position: absolute; left: 0; top: 0; height: 100%; background: var(--verde); border-radius: 2px; width: 0; }
.audio .t { font-size: 11px; color: var(--suave); }
.reacc { display: flex; gap: 2px; position: absolute; bottom: -12px; right: 6px; background: var(--panel); border-radius: 12px; padding: 1px 5px; box-shadow: var(--sombra); font-size: 13px; }
.msg .ubic { display: block; }
.msg .ubic img { width: 240px; border-radius: 6px; }

/* ---------- Barra de redacción ---------- */
.redactar { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px; background: var(--barra); }
.redactar .campo { flex: 1; display: flex; align-items: flex-end; background: var(--panel); border-radius: 22px; padding: 6px 12px; gap: 6px; }
.redactar textarea { flex: 1; border: 0; background: none; resize: none; max-height: 120px; outline: none; padding: 5px 0; }
.redactar .env { width: 46px; height: 46px; border-radius: 50%; background: var(--verde-osc); color: #fff; display: grid; place-items: center; font-size: 20px; flex: none; }
.grabando { display: flex; align-items: center; gap: 10px; flex: 1; color: var(--rojo); padding: 10px 14px; background: var(--panel); border-radius: 22px; }
.grabando .pt { width: 11px; height: 11px; background: var(--rojo); border-radius: 50%; animation: pulso 1s infinite; }
@keyframes pulso { 50% { opacity: .3; } }
.resp-barra { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--panel); border-left: 4px solid var(--verde); margin: 0 12px; border-radius: 6px; }
.resp-barra .crece { flex: 1; min-width: 0; font-size: 13px; }
.resp-barra .q { color: var(--verde); font-weight: 600; }

/* ---------- Menú contextual ---------- */
.menu-ctx { position: fixed; background: var(--panel); border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.25); padding: 6px 0; z-index: 40; min-width: 180px; }
.menu-ctx button { display: block; width: 100%; text-align: left; padding: 10px 18px; font-size: 14px; }
.menu-ctx button:hover { background: var(--panel-2); }
.menu-ctx button.peligro { color: var(--bad); } /* 1.14.0: --rojo daba 3.9:1 sobre blanco; --bad pasa AA en claro y oscuro */
/* 1.14.0: botón «⋯» de acciones del mensaje (visible al pasar, al enfocar y siempre en pantallas táctiles) */
.msg:not(.sis) { outline-offset: 2px; }
.msg:not(.sis):focus-visible { outline: 2px solid var(--focus); }
.msg .msg-acc { position: absolute; top: 2px; right: 2px; width: 28px; height: 24px; min-height: 0; border-radius: 12px; line-height: 1; font-size: 16px; color: var(--suave); background: var(--tinte); opacity: 0; }
.msg:hover .msg-acc, .msg:focus-within .msg-acc, .msg .msg-acc:focus-visible { opacity: 1; }
.msg .msg-acc:focus-visible { outline: 2px solid var(--focus); }
@media (hover: none) { .msg .msg-acc { opacity: .75; } .msg:not(.sis) { padding-right: 40px; } }
.emoji-fila { display: flex; gap: 4px; padding: 6px 10px; border-bottom: 1px solid var(--linea); }
.emoji-fila button { font-size: 22px; padding: 2px; border-radius: 50%; }

/* ---------- Paneles / modales ---------- */
.capa { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border-radius: 14px; width: 100%; max-width: 440px; max-height: 88vh; overflow-y: auto; }
.modal h2 { margin: 0; padding: 18px 20px; font-size: 18px; background: var(--barra); border-radius: 14px 14px 0 0; display: flex; align-items: center; gap: 10px; }
.modal .cuerpo { padding: 18px 20px; }
.modal label { display: block; font-size: 13px; color: var(--suave); margin: 12px 0 5px; }
.modal input, .modal textarea, .modal select { width: 100%; padding: 10px 12px; border: 1px solid var(--linea); border-radius: 9px; background: var(--panel-2); }
.modal .acc { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 20px 18px; }
.modal .acc .btn { white-space: nowrap; }
.modal .acc .btn { margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--verde-tinte); color: var(--texto); border-radius: 16px; padding: 4px 10px; font-size: 13px; margin: 3px; }
.sel-fila { display: flex; gap: 10px; align-items: center; padding: 9px 6px; cursor: pointer; border-radius: 8px; }
.sel-fila:hover { background: var(--panel-2); }
.sel-fila input { width: auto; }

/* ---------- Estados / historias ---------- */
.estado-fila { display: flex; gap: 12px; align-items: center; padding: 11px 14px; cursor: pointer; }
.estado-fila:hover { background: var(--panel-2); }
.aro { padding: 2px; border-radius: 50%; background: var(--verde); }
.aro.visto { background: var(--suave); }
.visor { position: fixed; inset: 0; background: #000; z-index: 70; display: flex; flex-direction: column; }
.visor .prog { display: flex; gap: 4px; padding: 10px; }
.visor .prog i { flex: 1; height: 3px; background: rgba(255,255,255,.3); border-radius: 2px; overflow: hidden; }
.visor .prog i b { display: block; height: 100%; background: #fff; width: 0; }
.visor .top { display: flex; gap: 12px; align-items: center; padding: 4px 14px; color: #fff; }
.visor .cont { flex: 1; display: grid; place-items: center; padding: 20px; }
.visor .cont .texto-estado { font-size: 26px; color: #fff; text-align: center; padding: 30px; border-radius: 12px; max-width: 90%; }
.visor img, .visor video { max-width: 100%; max-height: 80vh; }

/* ---------- Llamada ---------- */
.llamada { position: fixed; inset: 0; background: #0b141a; z-index: 80; display: flex; flex-direction: column; color: #fff; }
.llamada .remoto { flex: 1; object-fit: cover; background: #000; width: 100%; }
.llamada .local { position: absolute; right: 16px; top: 70px; width: 110px; height: 150px; object-fit: cover; border-radius: 10px; border: 2px solid #fff3; background: #000; }
.llamada .cab { text-align: center; padding: 30px 20px; position: absolute; top: 0; width: 100%; }
.llamada .cab .n { font-size: 22px; font-weight: 600; }
.llamada .cab .s { color: #8696a0; margin-top: 6px; }
.llamada .ctrls { display: flex; justify-content: center; gap: 18px; padding: 28px; position: absolute; bottom: 0; width: 100%; }
.llamada .ctrls button { width: 58px; height: 58px; border-radius: 50%; background: #ffffff22; display: grid; place-items: center; font-size: 22px; }
.llamada .ctrls button.colgar { background: var(--rojo); }
.llamada .ctrls button.aceptar { background: var(--verde); }
.llamada .mosaico { flex: 1; display: grid; gap: 6px; padding: 70px 8px 110px; align-content: center; }
.llamada .mosaico .tile { position: relative; background: #000; border-radius: 10px; overflow: hidden; min-height: 130px; }
.llamada .mosaico .tile video { width: 100%; height: 100%; object-fit: cover; }
.llamada .mosaico .tile .etq { position: absolute; left: 8px; bottom: 6px; font-size: 12px; background: #0008; color: #fff; padding: 2px 8px; border-radius: 10px; }

/* Carpetas (pestañas) */
.carpetas { display: flex; gap: 6px; padding: 8px 12px 4px; overflow-x: auto; background: var(--panel); }
.carpetas.oculto { display: none; }
.chip-tab { padding: 5px 14px; border-radius: 16px; background: var(--panel-2); color: var(--suave); font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip-tab.activa { background: var(--verde); color: #fff; }

/* Encuestas */
.encuesta { min-width: 230px; }
.enc-q { font-weight: 600; margin-bottom: 8px; }
.enc-op { position: relative; padding: 9px 36px 9px 10px; border-radius: 8px; background: var(--tinte); margin-bottom: 6px; cursor: pointer; overflow: hidden; }
.enc-op.mio { outline: 1.5px solid var(--verde); }
.enc-barra { position: absolute; left: 0; top: 0; height: 100%; background: var(--verde-tinte); z-index: 0; transition: width .4s; }
.enc-txt { position: relative; z-index: 1; }
.enc-n { position: absolute; right: 10px; top: 9px; z-index: 1; color: var(--suave); font-size: 13px; }
.enc-tot { font-size: 12px; color: var(--suave); margin-top: 2px; }

/* ---------- Toast ---------- */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #333; color: #fff; padding: 11px 20px; border-radius: 22px; z-index: 90; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.3); }

.volver { display: none; }
@media (max-width: 820px) {
  #app { grid-template-columns: 1fr; }
  #conversacion { display: none; position: fixed; inset: 0; z-index: 20; }
  body.en-chat #lateral { display: none; }
  body.en-chat #conversacion { display: flex; }
  .volver { display: grid; }
  .msg { max-width: 82%; }
}

/* ================= v1.3 · diseño tipo Apple: accesibilidad, estados vacíos y herramientas ================= */
.solo-lector { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.saltar { position: fixed; left: var(--s2); top: -60px; z-index: 200; background: var(--verde-osc); color: #fff; padding: var(--s2) var(--s4); border-radius: var(--r); text-decoration: none; font-weight: 600; }
.saltar:focus { top: var(--s2); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }
.tabs button, .chip-tab, .menu-ctx button, .btn { min-height: var(--ctl); }
.fila { min-height: 64px; }
.msg.out .meta, .msg.out .palomita:not(.leido) { color: #4a5a63; }
@media (prefers-color-scheme: dark) { :root:not([data-tema="claro"]) .msg.out .meta, :root:not([data-tema="claro"]) .msg.out .palomita:not(.leido) { color: #c5d6d0; } }
:root[data-tema="oscuro"] .msg.out .meta, :root[data-tema="oscuro"] .msg.out .palomita:not(.leido) { color: #c5d6d0; }
.mut { color: var(--suave); font-size: 13px; }
kbd { font: 600 11.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--panel-2); border: 1px solid var(--linea); border-bottom-width: 2px; border-radius: 6px; padding: 3px 6px; color: var(--texto); }
.chk { display:flex; gap:8px; align-items:flex-start; font-size:14px; margin:8px 0; }
.chk input { width:20px; height:20px; flex:none; }
.fijado-barra { display:block; width:100%; text-align:left; border:0; border-bottom:1px solid var(--linea); background:var(--barra); color:var(--ink, inherit); padding:10px 14px; min-height:44px; font:inherit; font-size:14px; cursor:pointer; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.fijado-barra:focus-visible { outline:2px solid currentColor; outline-offset:-2px; }
.lim-item { border-bottom:1px solid var(--linea); padding:10px 0; }
.lim-tit { display:flex; gap:8px; align-items:center; font-size:15px; }
.lim-tit input { width:22px; height:22px; }
.resalta { outline:2px solid var(--verde); }
.etq-sim { display: inline-block; background: #fff3c4; color: #6b4a00; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; margin-right: 4px; }
.sub-acceso { color: var(--suave); font-size: 14px; margin: -6px 0 4px; }
.atajo-hint { margin-top: var(--s4); font-size: 13px; }

/* Toast con acción (Deshacer) */
#toast { display: flex; align-items: center; gap: var(--s3); max-width: calc(100vw - 32px); animation: aparecer .2s ease-out; }
#toast .toast-acc { color: #8ef0b8; font-weight: 700; min-height: 32px; padding: 0 var(--s2); border-radius: 8px; }
@keyframes aparecer { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Estados vacíos útiles */
.estado-vacio { padding: var(--s8) var(--s6); text-align: center; color: var(--suave); display: block; }
.estado-vacio .ev-ico { font-size: 40px; margin-bottom: var(--s2); }
.estado-vacio .ev-tit { color: var(--texto); font-weight: 600; font-size: 16px; margin: 0 0 var(--s1); }
.estado-vacio p { margin: 0 0 var(--s3); font-size: 14px; }
.estado-vacio .ev-btn { width: auto; padding: 0 var(--s6); margin: var(--s2) auto 0; display: block; }

/* Modales: título, ancho y animación */
.modal { animation: subir .2s ease-out; border-radius: var(--r); }
@keyframes subir { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.modal.modal-ancho { max-width: 640px; }
.modal h3 { font-size: 14px; margin: var(--s4) 0 var(--s2); }
.ac-ver { font-size: 13px; color: var(--suave); margin-bottom: var(--s3); }
.ac-hubs h3 { margin-top: 0; }
.ac-lista { list-style: none; padding: 0; margin: 0 0 var(--s2); font-size: 14px; }
.ac-lista li { padding: var(--s1) 0; }
.pt.ok { color: var(--ok); } .pt.off { color: var(--suave); }

/* Paleta de comandos */
.capa-paleta { place-items: start center; padding-top: 12vh; }
.paleta { background: var(--panel); width: 100%; max-width: 560px; border-radius: var(--r); box-shadow: 0 20px 60px rgba(0,0,0,.35); overflow: hidden; animation: subir .15s ease-out; }
.paleta input { width: 100%; border: 0; border-bottom: 1px solid var(--linea); padding: var(--s4); font-size: 17px; background: transparent; outline: none; }
.paleta ul { list-style: none; margin: 0; padding: var(--s2); max-height: 52vh; overflow-y: auto; }
.pal-grupo { font-size: 11.5px; font-weight: 700; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; padding: var(--s2) var(--s3) var(--s1); }
.pal-op { display: flex; align-items: center; gap: var(--s3); min-height: var(--ctl); padding: 0 var(--s3); border-radius: 10px; cursor: pointer; }
.pal-op.sel { background: var(--verde-osc); color: #fff; }
.pal-op.sel .pal-sub { color: #d9fdd3; }
.pal-op.sel kbd { background: transparent; color: #fff; border-color: #ffffff66; }
.pal-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-sub { font-size: 12px; color: var(--suave); }
.pal-pie { display: flex; gap: var(--s4); padding: var(--s2) var(--s4); border-top: 1px solid var(--linea); font-size: 12px; color: var(--suave); }
.tabla-atajos { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla-atajos td { padding: var(--s2) var(--s1); border-bottom: 1px solid var(--linea); }
.tabla-atajos td:first-child { white-space: nowrap; color: var(--suave); }

/* Bienvenida */
.modal-onb h2 { justify-content: space-between; }
.onb-saltar { font-size: 14px; font-weight: 600; color: var(--verde-txt); min-height: var(--ctl); padding: 0 var(--s2); }
.onb-pasos { display: flex; gap: var(--s1); margin-bottom: var(--s4); }
.onb-pasos i { flex: 1; height: 4px; border-radius: 2px; background: var(--linea); }
.onb-pasos i.on { background: var(--verde-osc); }
.onb-hero { font-size: 48px; text-align: center; }
.onb-lead { font-size: 16px; font-weight: 600; text-align: center; margin: var(--s2) 0 var(--s3); }
.onb-lista { padding-left: 20px; margin: 0; line-height: 1.6; }
.onb-opciones { display: grid; gap: var(--s2); }
.onb-opciones .btn { margin-top: 0; }
.onb-tip { margin-top: var(--s4); }

/* Mi actividad */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--s2); margin: var(--s3) 0; }
.kpi { background: var(--panel-2); border-radius: var(--r); padding: var(--s3); display: flex; flex-direction: column; }
.kpi-n { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-t { font-size: 12px; color: var(--suave); }
.graf { width: 100%; height: auto; display: block; }
.graf .b-env { fill: var(--verde-osc); } .graf .b-rec { fill: #9fb3bd; }
.graf .g-et { fill: var(--suave); font-size: 10px; }
.leyenda { display: flex; gap: var(--s4); font-size: 12px; color: var(--suave); margin-top: var(--s1); }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; }
.l-env { background: var(--verde-osc); } .l-rec { background: #9fb3bd; }
.dos-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.lista-simple { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.lista-simple li { display: flex; justify-content: space-between; gap: var(--s3); padding: var(--s2) 0; border-bottom: 1px solid var(--linea); }
.lista-simple b, .pron b { font-variant-numeric: tabular-nums; }
.pron { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s1); text-align: center; font-size: 12px; }
.pron li { background: var(--panel-2); border-radius: 10px; padding: var(--s2) var(--s1); display: flex; flex-direction: column; }
.pron b { font-size: 15px; }
.nota-honesta { font-size: 13px; background: var(--panel-2); border-left: 3px solid var(--verde-osc); padding: var(--s2) var(--s3); border-radius: 6px; }
.acc-linea { display: flex; gap: var(--s2); flex-wrap: wrap; }
.acc-linea .btn { width: auto; padding: 0 var(--s4); margin-top: var(--s2); }
.exp { background: var(--panel-2); border-radius: var(--r); padding: var(--s3); margin-top: var(--s3); }
.exp-t { white-space: pre-wrap; font-size: 14px; }
.fuente { font-size: 12px; color: var(--suave); margin-top: var(--s2); }
.aud small { color: var(--suave); white-space: nowrap; }

/* Ayuda */
.ayuda-sug { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s3) 0; }
.chip-btn { background: var(--panel-2); border: 1px solid var(--linea); border-radius: 999px; padding: 0 var(--s3); min-height: 36px; font-size: 13px; }
.ayuda-form { display: flex; gap: var(--s2); }
.ayuda-form input { flex: 1; }
.ayuda-form .btn { width: auto; margin-top: 0; padding: 0 var(--s4); }

/* Esqueletos de carga */
.esqueleto i { display: block; height: 14px; border-radius: 7px; background: var(--panel-2); margin: var(--s3) 0; animation: brillo 1.2s ease-in-out infinite; }
.esqueleto i:nth-child(2) { width: 80%; } .esqueleto i:nth-child(3) { width: 60%; }
@keyframes brillo { 50% { opacity: .5; } }

/* Fila de acceso a Archivados (v1.3.1) */
.fila-archivados { width: 100%; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; display: flex; align-items: center; gap: var(--s3); min-height: var(--ctl); }
.fila-archivados .arch-ico { width: 49px; text-align: center; font-size: 20px; color: var(--verde-txt); }
.fila-archivados .med { display: flex; flex-direction: column; }
.fila-archivados .nom { font-weight: 600; }
.globo-arch { margin-left: auto; color: var(--verde-txt); font-weight: 600; font-size: 13px; padding-right: var(--s4); }
.et-arch { font-size: 11px; font-weight: 600; color: var(--mut); border: 1px solid var(--linea); border-radius: var(--r); padding: 0 var(--s2); margin-left: var(--s1); }

/* Widget de quejas (automejora): no tapar la barra de redacción en el teléfono */
@media (max-width: 820px) {
  body { font-size: 16px; }
  body.en-chat .qs-fab { display: none !important; }
  .qs-fab { bottom: 16px; }
  .dos-col { grid-template-columns: 1fr; }
  .pron { grid-template-columns: repeat(4, 1fr); }
  .capa-paleta { padding-top: var(--s4); }
  .barra-top { gap: var(--s1); padding: var(--s2) var(--s3); }
  #b-buscar-todo { display: none; }
  .conv-top { gap: var(--s1); padding: var(--s2); }
  .conv-top #b-buscar-chat { display: none; } /* en el teléfono vive en el menú ⋮ del chat */
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Cifrado de extremo a extremo (v1.4) ---------- */
.msg.sis.e2e-aviso, .msg.sis.e2e-cambio, .msg.sis.e2e-legado { border: 0; cursor: pointer; font: inherit; font-size: 12.5px; line-height: 1.35; }
.msg.sis.e2e-aviso:disabled { cursor: default; }
.msg.sis.e2e-cambio.grave { background: var(--tinte); outline: 1px solid var(--bad); color: var(--texto); }
.msg.sis.e2e-legado { background: var(--tinte); }
.e2e-err { color: var(--suave); font-style: italic; }
.e2e-sin { display: inline-block; font-size: 10.5px; padding: 0 5px; border-radius: 6px; border: 1px solid var(--suave); color: var(--suave); }
.e2e-ok { color: var(--verde-txt); font-weight: 600; }
.e2e-alerta { color: var(--bad); }
.e2e-codigo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; text-align: center; }
.e2e-codigo span { background: var(--panel-2); border-radius: 8px; padding: 8px 0; letter-spacing: 1px; }
.e2e-disps, .e2e-prev { margin: 4px 0 8px; padding-left: 18px; font-size: 14px; }
.e2e-prev { max-height: 180px; overflow: auto; }
.e2e-botones { display: flex; flex-wrap: wrap; gap: 8px; }
.e2e-botones .btn { width: auto; margin-top: 4px; padding: 0 14px; }
.llamada .ll-e2e { font-size: 12.5px; opacity: .9; margin-top: 4px; }
@media (max-width: 420px) { .e2e-codigo { grid-template-columns: repeat(3, 1fr); font-size: 16px; } }
.e2e-dir { display: inline-block; font-size: 10.5px; padding: 0 5px; border-radius: 6px; background: var(--verde-osc); color: #fff; }

/* Novedades por versión y códigos de acceso (solo dueño) */
.ver-nov { background:none; border:0; padding:4px 0; min-height:32px; color:var(--verde-txt, inherit); font:inherit; font-size:13px; text-decoration:underline; cursor:pointer; }
.ver-nov:focus-visible { outline:2px solid currentColor; outline-offset:2px; }
.ac-otp { margin:8px 0 12px; } .ac-otp summary { cursor:pointer; min-height:32px; }
.nov-lista { max-height:60vh; overflow:auto; }
.nov-ver h3 { margin:12px 0 4px; font-size:15px; } .nov-ver ul { margin:0 0 8px; padding-left:1.2em; }

.modal.modal-ancho { max-width: min(960px, 96vw); width: 96vw; max-height: 90vh; overflow: auto; }

/* 1.13.0 · revisión: filas de selección en modales, tablas y bitácora sin desborde a 390 px, contraste del nombre en citas */
.modal .sel-fila { display: flex; align-items: center; gap: 10px; }
.modal-ancho #an-admin, #an-admin { overflow-x: auto; max-width: 100%; }
.bitacora, .bitacora li, .modal li { overflow-wrap: anywhere; min-width: 0; }
.cita > .q { color: var(--verde-osc, #0b6b42); }
@media (prefers-color-scheme: dark) { :root:not([data-tema="claro"]) .cita > .q { color: #7fe0b0; } }
:root[data-tema="oscuro"] .cita > .q { color: #7fe0b0; }
@media (min-width: 900px) { .vh-pill { bottom: 74px !important; } }
.ac-ver { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; min-height: 44px; padding: 0 4px; text-decoration: underline dotted; }
.lista-simple.aud li { display: flex; flex-wrap: wrap; gap: 2px 8px; }
.lista-simple.aud li > * { min-width: 0; overflow-wrap: anywhere; }
