/* Chat IRC de EGV */
.chat-conectar{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:20px;max-width:900px;}
.chat-conectar h2{font-size:18px;margin-bottom:12px;}
.chat-campos{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:12px 16px;margin-bottom:12px;}
.chat-campos label{display:flex;flex-direction:column;gap:5px;font-size:13.5px;font-weight:700;color:var(--text-muted);}
.chat-campos input[type=text],.chat-campos input[type=number],.chat-campos input[type=password],.chat-campos select{
  padding:10px 12px;border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:var(--radius-sm);font:inherit;font-weight:400;min-height:44px;}
.chat-campos .chat-check{flex-direction:row;align-items:center;gap:8px;align-self:end;min-height:44px;}
.chat-nota{font-size:13px;margin-bottom:14px;}
.chat-error{margin-top:12px;color:var(--danger,#dc2626);font-weight:700;}

.chat-app{display:flex;flex-direction:column;gap:10px;}
.chat-app[hidden],.chat-conectar[hidden]{display:none;}
.chat-menu{display:flex;gap:18px;flex-wrap:wrap;padding:4px 52px 8px 2px;position:relative;z-index:5;}
.chat-menu-g{position:relative;}
.chat-menu-b{background:none;border:0;padding:4px 2px;font:inherit;font-size:15px;color:var(--text);cursor:pointer;}
.chat-menu-b:hover,.chat-menu-b[aria-expanded="true"]{text-decoration:underline;color:var(--primary);}
.chat-menu-d{position:absolute;top:100%;left:0;min-width:220px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-sm);padding:4px;box-shadow:0 6px 18px rgba(0,0,0,.18);}
.chat-menu-d[hidden]{display:none;}
.chat-menu-d button{display:block;width:100%;text-align:left;background:none;border:0;padding:7px 10px;font:inherit;font-size:14px;color:var(--text);cursor:pointer;border-radius:4px;}
.chat-menu-d button:hover,.chat-menu-d button:focus-visible{background:var(--surface-2);}
.chat-menu-d .is-actual{font-weight:700;}
.chat-x{margin-left:8px;opacity:.7;font-weight:700;}
.chat-x:hover{opacity:1;}
.chat-sin-hora .chat-h{display:none;}
.chat-barra{display:flex;gap:10px;align-items:center;justify-content:space-between;flex-wrap:wrap;padding-right:52px;}
.chat-pestanas{display:flex;gap:6px;flex-wrap:wrap;min-width:0;}
.chat-pestana{padding:8px 14px;border-radius:99px;border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;font-size:14px;font-weight:600;cursor:pointer;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.chat-pestana.is-activa{background:var(--primary);border-color:var(--primary);color:#fff;}
.chat-n{display:inline-block;margin-left:6px;padding:0 7px;border-radius:99px;background:var(--warning,#f59e0b);color:#000;font-size:12px;}
.chat-cuerpo{display:flex;gap:12px;min-width:0;}
.chat-centro{flex:1;min-width:0;display:flex;flex-direction:column;gap:6px;}
.chat-tema{font-size:13.5px;color:var(--text-muted);padding:0 4px;overflow-wrap:anywhere;}
.chat-paneles{display:flex;height:min(60vh,560px);min-width:0;}
.chat-paneles.pan-col{flex-direction:column;}
.chat-panel{flex:1 1 0;min-width:0;min-height:0;display:flex;flex-direction:column;}
.chat-panel[hidden],.chat-divisor[hidden]{display:none;}
.chat-panel-t{display:none;font-size:12.5px;font-weight:700;padding:3px 10px;background:var(--surface-2);border:1px solid var(--border);border-bottom:0;border-radius:var(--radius-sm) var(--radius-sm) 0 0;color:var(--text-muted);cursor:pointer;}
.pan-dividido .chat-panel-t{display:block;}
.pan-dividido .chat-panel.is-foco .chat-panel-t{background:var(--primary);border-color:var(--primary);color:#fff;}
.chat-divisor{flex:none;width:8px;cursor:col-resize;border-radius:4px;}
.chat-divisor:hover,.chat-divisor:focus-visible{background:var(--border);}
.pan-col .chat-divisor{width:auto;height:8px;cursor:row-resize;}
.chat-mensajes{flex:1;min-height:0;overflow-y:auto;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-sm);padding:10px 12px;}
.chat-l{color:var(--c-normal,var(--text));margin:0 0 3px;font-size:calc(14.5px * var(--chat-fs,1));line-height:1.45;overflow-wrap:anywhere;}
.chat-h{color:var(--c-hora,var(--text-faint));font-size:calc(12px * var(--chat-fs,1));margin-right:8px;}
.chat-q{margin-right:8px;color:var(--c-nick,var(--primary));}
.chat-l.propio{color:var(--c-propio,var(--c-normal,var(--text)));}
.chat-l.info,.chat-l.aviso{color:var(--c-info,var(--text-muted));font-style:italic;}
.chat-l.entrada{color:var(--c-entrada,#4b9bf5);}
.chat-l.whois{color:var(--c-whois,#1e9e4f);font-style:normal;}
.chat-l.accion{color:var(--c-accion,var(--text-muted));}
.chat-l.error{color:var(--c-error,var(--danger,#dc2626));font-weight:600;}
.chat-l.mencion{color:var(--c-mencion,var(--c-normal,var(--text)));background:rgba(251,191,36,.18);border-radius:4px;}
.chat-colores{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-sm);padding:12px 16px;}
.chat-colores h2{font-size:15px;margin-bottom:8px;}
.chat-colores-g{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:6px 18px;margin-bottom:10px;}
.chat-colores-g label{display:flex;align-items:center;gap:8px;font-size:14px;}
.chat-colores-g input[type=color]{width:36px;height:28px;padding:0;border:1px solid var(--border);background:none;cursor:pointer;}
.chat-colores-g .chat-l{margin:0;}
.chat-colores[hidden]{display:none;}
.chat-lista{width:230px;flex:none;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-sm);padding:10px;height:min(60vh,560px);overflow-y:auto;}
.chat-lista h2{font-size:14px;margin-bottom:8px;}
.chat-lista ul{list-style:none;margin:0;padding:0;}
.chat-lista li{padding:4px 6px;border-radius:4px;cursor:pointer;font-size:14px;overflow-wrap:anywhere;}
.chat-lista li:hover,.chat-lista li:focus-visible{background:var(--surface-2);}
.chat-envio{display:flex;gap:8px;position:relative;}
.chat-comp{position:absolute;left:0;bottom:100%;margin-bottom:4px;min-width:180px;max-width:90%;max-height:190px;overflow-y:auto;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-sm);padding:4px;box-shadow:0 6px 18px rgba(0,0,0,.18);z-index:10;}
.chat-comp[hidden]{display:none;}
.chat-comp button{display:block;width:100%;text-align:left;background:none;border:0;padding:5px 10px;font:inherit;font-size:14px;color:var(--text);cursor:pointer;border-radius:4px;}
.chat-comp button.is-actual,.chat-comp button:hover{background:var(--primary);color:#fff;}
.chat-emo-b{flex:none;width:44px;min-height:44px;font-size:22px;line-height:1;padding:0;border:1px solid var(--border);background:var(--bg);border-radius:var(--radius-sm);cursor:pointer}
.chat-emo-b:hover,.chat-emo-b:focus-visible,.chat-emo-b[aria-expanded="true"]{border-color:var(--primary)}
.chat-emo{position:absolute;left:0;bottom:100%;margin-bottom:4px;z-index:40;width:min(360px,100%);max-height:220px;overflow-y:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(38px,1fr));gap:2px;padding:6px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-sm);box-shadow:0 6px 18px rgba(0,0,0,.18)}
.chat-emo[hidden]{display:none}
.chat-emo button{font-size:22px;line-height:1;padding:6px 0;border:0;background:none;border-radius:6px;cursor:pointer}
.chat-emo button:hover,.chat-emo button:focus-visible{background:var(--surface-2)}
.chat-envio input{flex:1;min-width:0;padding:11px 12px;border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:var(--radius-sm);font:inherit;min-height:44px;}
@media (max-width:700px){
  .chat-cuerpo{flex-direction:column;}
  .chat-lista{width:auto;height:110px;order:2;}
  .chat-paneles{height:50vh;flex-direction:column;}
  .chat-divisor{width:auto;height:8px;cursor:row-resize;}
}
.chat-hispano{margin-bottom:16px;max-width:900px;padding:12px 16px;border-radius:var(--radius-sm);}
.chat-hispano a{font-weight:700;}

.chat-dialogo{background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:var(--radius);padding:16px 20px;width:min(360px,92vw);}
.chat-dialogo::backdrop{background:rgba(0,0,0,.4);}
.chat-dialogo h2{font-size:16px;margin-bottom:6px;}
.chat-dialogo ul{list-style:none;margin:10px 0;padding:0;max-height:240px;overflow-y:auto;}
.chat-dialogo li{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:4px 0;border-bottom:1px solid var(--border);}
.chat-dialogo input[type=text]{padding:8px 10px;border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:var(--radius-sm);font:inherit;min-width:0;width:60%;}

.chat-dialogo-ancho{width:min(680px,94vw);}
.chat-dialogo-ancho input[type=text]{width:100%;box-sizing:border-box;}
.chat-canales-l{max-height:55vh;overflow-y:auto;border-top:1px solid var(--border);margin-top:6px;}
.chat-canales-l button{display:grid;grid-template-columns:minmax(90px,170px) 52px 1fr;gap:10px;width:100%;text-align:left;background:none;border:0;border-bottom:1px solid var(--border);padding:6px 4px;font:inherit;font-size:14px;color:var(--text);cursor:pointer;}
.chat-canales-l button:hover,.chat-canales-l button:focus-visible{background:var(--surface-2);}
.chat-canales-l b{overflow-wrap:anywhere;}
.chat-canales-l i{font-style:normal;color:var(--text-muted);text-align:right;}
.chat-canales-l span{color:var(--text-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}

/* Entradas y salidas por canal: interruptor en la cabecera de cada ventana */
.chat-sin-entradas .chat-l.entrada{display:none}
.chat-panel-t{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
.chat-comandos-l{max-height:60vh;overflow:auto}
.chat-comandos-l h3{margin:14px 0 6px;font-size:1rem}
.chat-comandos-l dl{margin:0;display:grid;grid-template-columns:minmax(150px,max-content) 1fr;gap:6px 14px}
.chat-comandos-l dt{font-family:ui-monospace,Consolas,monospace;font-size:.9rem;overflow-wrap:anywhere}
.chat-comandos-l dd{margin:0}
@media (max-width:600px){.chat-comandos-l dl{grid-template-columns:1fr;gap:0}.chat-comandos-l dd{margin:0 0 8px}}
.chat-modos{font-weight:400;font-size:12.5px;color:var(--text-muted)}
.chat-ent{font:inherit;font-size:12.5px;padding:2px 10px;border:1px solid var(--border);border-radius:999px;background:var(--surface,transparent);color:var(--text-muted);cursor:pointer;max-width:100%}
.chat-ent:hover,.chat-ent:focus-visible{color:var(--text);border-color:var(--primary,currentColor)}
.chat-ent[aria-pressed="true"]{color:var(--text);border-color:var(--c-entrada,#4b9bf5)}
.pan-dividido .chat-panel-t{display:flex}

/* Colores y formato de IRC en los mensajes */
.irc-b{font-weight:700}.irc-i{font-style:italic}.irc-u{text-decoration:underline}.irc-s{text-decoration:line-through}.irc-u.irc-s{text-decoration:underline line-through}
.irc-m{font-family:ui-monospace,Menlo,Consolas,monospace}.irc-c{color:var(--irc-d)}[data-theme="light"] .irc-c{color:var(--irc-l)}.irc-bg{padding:0 2px;border-radius:3px}

/* Apodo pulsado en un mensaje → marcado en la lista de personas */
.chat-l a{color:var(--primary);text-decoration:underline;overflow-wrap:anywhere}
.chat-q{cursor:pointer}.chat-q:hover,.chat-q:focus-visible{text-decoration:underline}
.chat-lista li.seleccionado{background:var(--primary);color:#fff;border-radius:6px;outline:2px solid var(--primary);outline-offset:0}
/* menús del botón derecho escritos por la persona */
.chat-nick-menu{min-width:200px;max-width:min(320px,94vw);max-height:min(70vh,520px);overflow-y:auto}
.chat-menu-sep{height:1px;background:var(--border);margin:4px 2px}
.chat-menu-sub{position:fixed;z-index:51;min-width:200px;max-width:min(320px,94vw);max-height:calc(100vh - 8px);overflow-y:auto;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-sm);padding:4px;box-shadow:0 6px 18px rgba(0,0,0,.18)}
.chat-menu-sub[hidden]{display:none}
.chat-menus-tabs{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0}
.chat-menus-tabs button{padding:6px 10px;border:1px solid var(--border);background:var(--surface-2);color:var(--text);border-radius:var(--radius-sm);font:inherit;font-size:14px;cursor:pointer}
.chat-menus-tabs button[aria-pressed=true]{background:var(--primary);color:#fff;border-color:var(--primary)}
.chat-menus-txt{width:100%;box-sizing:border-box;min-height:200px;padding:10px;border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:var(--radius-sm);font:13px/1.5 ui-monospace,Consolas,monospace;resize:vertical;tab-size:2}
.chat-menus-est{white-space:pre-line;margin:6px 0}
.chat-menus-ayuda{margin:6px 0;font-size:14px}
.chat-menus-ayuda ul{max-height:none;overflow:visible;padding-left:18px;list-style:disc}
.chat-menus-ayuda li{display:list-item;border:0;padding:3px 0}
.chat-menus-botones{display:flex;flex-wrap:wrap;gap:8px}

/* ---------- Cabecera de recurso y avisos (copia de cuenta/css/cuenta.css de la Central, no incluible cruzando dominio) ---------- */
.recurso-cabecera{display:flex;align-items:center;gap:16px;margin-bottom:20px;flex-wrap:wrap;}
.recurso-ico{flex:none;font-size:40px;line-height:1;}
.recurso-cabecera h1{font-size:28px;font-weight:800;margin-bottom:4px;}
.cuenta-aviso{padding:12px 14px;border-radius:var(--radius-sm);font-size:14px;margin-bottom:16px;background:rgba(251,191,36,.12);border:1px solid var(--warning);color:var(--text);max-width:900px;}

/* ---------- Portada pública (sin sesión): presentación del servicio + botones de acceso/registro ----------
   Mismo patrón ".herramienta-hero" que draw/imagen/video/player.egv.es, pero aquí ocupa toda la página (el chat
   exige cuenta, no es de uso anónimo) en vez de ir encima de una herramienta usable sin login. */
.chat-landing,.herramienta-hero{position:relative;display:flex;gap:28px;align-items:flex-start;background:var(--surface-2);border:1px solid var(--border);border-radius:var(--radius);padding:28px 32px;margin:24px 0;}
.chat-landing-texto,.herramienta-hero-texto{flex:1 1 auto;min-width:0;}
.herramienta-hero-eyebrow{margin:0 0 6px;font-size:12.5px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--primary);}
.chat-landing-texto h1,.herramienta-hero-texto h1{margin:0 0 10px;font-size:28px;}
.herramienta-hero-desc{margin:0 0 18px;font-size:15px;line-height:1.55;color:var(--text-muted);max-width:620px;}
.herramienta-hero-cta{display:flex;flex-wrap:wrap;gap:10px;}
.herramienta-hero-card{flex:0 0 240px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:18px 20px;}
.herramienta-hero-card-tit{margin:0 0 8px;font-size:13px;font-weight:700;}
.herramienta-hero-card ul{margin:0;padding-left:18px;font-size:13px;line-height:1.6;color:var(--text-muted);}
@media (max-width:760px){.chat-landing,.herramienta-hero{flex-direction:column;}.herramienta-hero-card{flex:1 1 auto;}}

/* ---------- Barra inferior: estilo vestíbulo (copia del patrón draw-bar-* de draw.egv.es/css/draw.css) ---------- */
body[data-page="chat"]{padding-bottom:46px;}
.chat-bar-unificada{
  position:fixed;left:0;right:0;bottom:0;z-index:190;
  background:var(--surface);border-top:1px solid var(--border);
  backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
  display:flex;align-items:center;gap:10px;flex-wrap:wrap;
  padding:9px 24px;min-height:38px;font-size:12.5px;color:var(--text-muted);
}
.chat-bar-izq{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-width:0;}
.chat-bar-der{display:flex;align-items:center;gap:8px;margin-left:auto;}
.chat-bar-egv,.chat-bar-tiempo,.chat-bar-legal,.chat-bar-reloj{display:none;}
.chat-bar-legal-movil{display:block;}
.scroll-top{bottom:62px;}
@media (max-width:640px){ .scroll-top{bottom:54px;} }

@media (min-width:861px){
  body[data-page="chat"]{padding-bottom:64px;}
  .chat-bar-unificada{
    height:44px;min-height:44px;padding:0 12px;flex-wrap:nowrap;
    display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:16px;
  }
  .chat-bar-izq{flex-wrap:nowrap;}
  .chat-bar-egv{display:flex;align-items:center;gap:8px;height:34px;padding:0 10px;border-radius:var(--radius-sm);font-weight:800;font-size:14px;color:var(--text);}
  .chat-bar-egv:hover,.chat-bar-egv:focus-visible{background:var(--surface-2);}
  .chat-bar-egv .logo-mark{width:22px;height:22px;border-radius:6px;font-size:12px;}
  .chat-bar-tiempo{display:flex;position:relative;}
  .chat-bar-tiempo .tiempo-btn{
    display:flex;align-items:center;gap:8px;height:34px;padding:0 12px;border-radius:var(--radius-sm);
    background:none;border:0;color:var(--text);font:inherit;font-size:13.5px;cursor:pointer;
  }
  .chat-bar-tiempo .tiempo-btn:hover,.chat-bar-tiempo .tiempo-btn[aria-expanded="true"]{background:var(--surface-2);}
  .chat-bar-tiempo .tiempo-ico{font-size:18px;line-height:1;}
  .chat-bar-tiempo .tiempo-grados{font-weight:800;}
  .chat-bar-tiempo .tiempo-ciudad{color:var(--text-muted);}
  .chat-bar-tiempo .tiempo-menu{
    position:absolute;left:0;bottom:calc(100% + 8px);min-width:170px;max-height:60vh;overflow-y:auto;scrollbar-width:none;
    display:flex;flex-direction:column;padding:6px;
    background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);
  }
  .chat-bar-tiempo .tiempo-menu::-webkit-scrollbar{display:none;}
  .chat-bar-tiempo .tiempo-menu[hidden]{display:none;}
  .chat-bar-tiempo .tiempo-menu button{
    text-align:left;padding:8px 10px;border-radius:var(--radius-sm);background:none;border:0;
    color:var(--text);font:inherit;font-size:13.5px;cursor:pointer;
  }
  .chat-bar-tiempo .tiempo-menu button:hover{background:var(--surface-2);}
  .chat-bar-tiempo .tiempo-menu button[aria-checked="true"]{font-weight:800;color:var(--primary-2);}
  .chat-bar-tiempo .tiempo-menu button[aria-checked="true"]::after{content:" ✓";}
  .chat-bar-legal{display:block;margin:0;font-size:12px;color:var(--text-muted);text-align:center;white-space:nowrap;}
  .chat-bar-legal a{color:inherit;}
  .chat-bar-legal a:hover{color:var(--primary-2);text-decoration:underline;}
  .chat-bar-der{justify-self:end;}
  .chat-bar-reloj{display:flex;flex-direction:column;align-items:flex-end;justify-content:center;line-height:1.15;padding:0 6px;}
  .chat-bar-reloj .reloj-hora{font-size:14px;font-weight:800;font-variant-numeric:tabular-nums;}
  .chat-bar-reloj .reloj-fecha{font-size:11.5px;color:var(--text-muted);}
  .chat-bar-legal-movil{display:none;}
}
