/* tema por variables: dark default */

/* Deshabilitar selección y menú de long-press en toda la app */
html, body {
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  user-select: none;
}

/* IMPORTANTe: volver a habilitar en campos editables */
input, textarea, [contenteditable="true"] {
  -webkit-user-select: text;
  -webkit-touch-callout: default;
  user-select: text;
}


:root{
  --bg:#111; --panel:#2b2b2b; --panel-2:#1e1e1e;
  --text:#fff; --muted:#ccc; --stroke:#444; --accent:#00f0ff;
}
/* overrides light */
:root[data-theme="light"]{
  --bg:#f5f5f5; --panel:#ffffff; --panel-2:#ffffff;
  --text:#111; --muted:#555; --stroke:#ddd; --accent:#007aff;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{ margin:0; color:var(--text); background:var(--bg); font-family:'Roboto', system-ui, -apple-system, Segoe UI, sans-serif; }

.chat-container{ display:flex; flex-direction:column; height:100dvh; max-height:100dvh; width:100vw; max-width:100vw; padding:10px; overflow:hidden; }

.topbar{ display:flex; align-items:center; justify-content:space-between; padding:10px 15px; }
.topbar-left{ display:flex; align-items:center; gap:12px; }
.icon-btn{ background:transparent; border:0; padding:4px; color:var(--text); display:inline-flex; }
.icon{ color:var(--text); width:20px; height:20px; }
.brand{ font-weight:600; font-size:16px; color:var(--text); font-family:'Inter', sans-serif; }

/* switch visual */
.switch-theme{ position:relative; display:inline-flex; align-items:center; gap:8px; }
.switch-theme input{ position:absolute; inset:0; opacity:0; cursor:pointer; }
.switch-theme .slider{
  width:46px; height:24px; border-radius:999px; background:var(--panel-2);
  border:1px solid var(--stroke); display:inline-block; position:relative; transition:.2s;
}
.switch-theme .slider::after{
  content:""; position:absolute; top:2px; left:2px; width:20px; height:20px;
  background:var(--text); border-radius:50%; transition:.2s;
}
.switch-theme input:checked + .slider::after{ transform:translateX(22px); }
.switch-theme .sun, .switch-theme .moon{ font-size:14px; line-height:1; opacity:.8; }

.chat-header{ text-align:center; padding:15px 10px; }
.chat-header img{ width:70px; height:70px; object-fit:contain; margin-bottom:10px; }
.chat-header h5{ margin:5px 0 0; font-weight:700; font-size:20px; }
.chat-header p{ margin:6px 0 0; color:var(--muted); font-size:14px; }

/* sidenav dark por defecto; en light se quita con JS la clase dark-sidenav */
.dark-sidenav{ background:#212121; }
.dark-sidenav a{ color:#fff !important; }
:root[data-theme="light"] .sidenav{ background:#ffffff; }
:root[data-theme="light"] .sidenav a{ color:#111 !important; }

/* 4 sugerencias: grid 2x2 responsive */
.suggestions{
  display:flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  grid-template-columns: 1fr 1fr;
   
  margin-top:20px;
  overflow: scroll;
  flex-direction: column;
}

.suggestion-btn{
  padding:12px 10px; background:var(--panel-2); color:var(--text);
  border:1px solid var(--stroke); border-radius:8px; font-size:14px; text-align:center;
  width: 70%;
  height: 44%;
      margin-right: 3%;
      margin-bottom: 3%;
}

@media (min-width: 720px){
  .suggestions{ grid-template-columns: repeat(4, 1fr); }
}

.chat-input{ margin-top:auto; padding-top:20px; }
.input-bar{
  display:flex; align-items:flex-end; gap:6px; flex-wrap:nowrap;
  background:var(--panel); border-radius:15px; padding:10px; max-height:220px;
  border:1px solid var(--stroke);
}
.fab{
  flex:0 0 auto; width:35px; height:35px; border-radius:50%;
  display:flex; align-items:center; justify-content:center; border:0;
  background:var(--panel-2); color:var(--text); cursor:pointer;
}
#userInput{
  flex:1 1 auto; min-height:24px; max-height:180px; width:100%;
  background:transparent; border:0; outline:0; resize:none; color:var(--text);
  font-size:14px; line-height:1.5; padding:10px 0; overflow-y:auto;
}

/* --- Switch dark/light con iconos --- */
.topbar-right{ display:flex; align-items:center; gap:10px; }
.theme-toggle{ border:0; background:transparent; padding:0; cursor:pointer; }
.theme-toggle .track{
  position:relative; width:52px; height:28px; border-radius:999px;
  background:var(--panel-2); border:1px solid var(--stroke);
  display:flex; align-items:center; justify-content:space-between;
  padding:0 8px; transition:background .25s, border-color .25s;
}
.theme-toggle .icon{ font-size:16px; line-height:1; opacity:.7; pointer-events:none; color:var(--muted); }
.theme-toggle .thumb{
  position:absolute; top:2px; left:2px; width:24px; height:24px; border-radius:50%;
  background:var(--text); box-shadow:0 2px 6px rgba(0,0,0,.35); transition:transform .25s;
}

/* estados por tema */
:root[data-theme="dark"] .theme-toggle .icon.sun{ opacity:.45; }
:root[data-theme="dark"] .theme-toggle .icon.moon{ opacity:1; color:#9ec1ff; }

:root[data-theme="light"] .theme-toggle .track{ background:#f1f1f1; }
:root[data-theme="light"] .theme-toggle .icon.sun{ opacity:1; color:#f5a623; }
:root[data-theme="light"] .theme-toggle .icon.moon{ opacity:.35; }
:root[data-theme="light"] .theme-toggle .thumb{ transform:translateX(24px); }

/* Evitar que todos los botones cambien de color en :focus */
button:focus {
  outline: none !important;
  background-color: inherit !important;
}

/* Contenedor y layout */
.sidenav-custom{
  width:320px; background:var(--panel-2);
  display:flex; flex-direction:column; padding:0;
}
:root[data-theme="light"] .sidenav-custom{ background:#fff; }

/* Search compacto y lindo */
.sidenav-pad{ padding:10px 12px; }
.sidenav-search{
  display:flex; align-items:center; gap:8px;
  height:36px; border-radius:999px;
  background:var(--panel); border:1px solid var(--stroke);
  padding:0 12px;
}
.sidenav-search i{ color:var(--muted); font-size:18px; }
.sidenav-search input{
  background:transparent; border:0; outline:0; width:100%;
  color:var(--text); font-size:14px;
}
.sidenav-search input::placeholder{ color:var(--muted); opacity:.8; }

.sidenav-divider{ height:1px; background:var(--stroke); margin:6px 0; list-style:none; }
.sidenav-section-title{
  font-size:11px; letter-spacing:.08em; color:var(--muted);
  padding:4px 16px; list-style:none; text-transform:uppercase;
}

/* Items */
.sidenav-item{
  display:flex; align-items:center; gap:10px;
  padding:10px 14px; margin:4px 8px; border-radius:10px; color:var(--text);
}
.sidenav-item.bold{ font-weight:600; }
.sidenav-item i{ color:var(--text); } /* blanco en dark / negro en light */

/* Área scroll para recientes */
.sidenav-scroll{ flex:1 1 auto; overflow:auto; padding:2px 0 6px; }
.recent-list{ display:flex; flex-direction:column; padding:0 4px; }
.recent-item{
  display:block; color:var(--text);
  padding:8px 10px; margin:2px 8px; border-radius:8px;
  line-height:1.25; font-size:14px;
}
.recent-item:hover{ background:rgba(255,255,255,.06); }
:root[data-theme="light"] .recent-item:hover{ background:rgba(0,0,0,.06); }

/* Footer fijo abajo */



/* Quita el dot anterior por si quedó */
.recent-item .dot{ display:none; }

/* Iconos blancos en modo dark */
[data-theme="dark"] .sidenav i.material-icons {
  color: #fff !important;
}

/* Espaciado entre ítems del recent */
.recent-item {
  padding-top: 13px !important;
  padding-bottom: 13px !important;
}


/* Asegura layout vertical del sidenav */
.sidenav-custom{ display:flex; flex-direction:column; height:100%; }
.sidenav-scroll{ flex:1 1 auto; overflow:auto; }

/* Footer dividido en dos filas visibles */
.sidenav-footer.two-rows{
  position: sticky;
  bottom: 0;
  background: inherit;
  border-top: 1px solid var(--stroke);
  padding: 10px 12px;
  list-style: none;

  display: grid;
  grid-template-rows: 44px 44px;   /* altura de cada fila */
  gap: 8px;
  z-index: 2;
}

.sidenav-footer .footer-cell{ display:flex; align-items:center; }
.sidenav-footer .sidenav-item{ margin:0; width:100%; }
.sidenav-footer .sidenav-item i{ color: var(--text); } /* blanco en dark, negro en light */

/* Botón invite bonito y de ancho completo */
.sidenav-footer .invite-btn{ width:100%; border-radius:12px; padding:10px 14px; 
  border:1px solid var(--stroke); background:var(--panel); color:var(--text); font-weight:600; 
  box-shadow:0 4px 12px rgba(0,0,0,.18); }
:root[data-theme="light"] .sidenav-footer .invite-btn{ background:#e9edf6; border-color:#d9deea; color:#0f172a; }
:root[data-theme="dark"]  .sidenav-footer .invite-btn{ background:#1f2430; border-color:#2b3240; color:#e8eaf1; }

.sidenav-footer .invite-btn .spark {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  margin-right: 10px;
  display: inline-block;
  background-image: url('/img/iconoMagic.png');
  background-size: cover;       /* Ajusta para que se vea completo */
  background-position: center;  /* Centra la imagen */
 
  box-shadow: none !important;
}


:root[data-theme="dark"] .sidenav-footer .invite-btn .spark{ box-shadow: inset 0 0 0 2px rgba(0,0,0,.35); }

.invite-btn{
  padding: 2% !important;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 60% !important;
}

/* === Selector compacto en topbar === */
.model-selector-btn{
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 13px;
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid; cursor: pointer; transition: filter .15s ease;
}
.model-selector-btn:hover{ filter: brightness(1.05); }

/* Light */
:root[data-theme="light"] .model-selector-btn{
  background:#eef2f6; color:#0f172a; border-color:#d7dee9;
}
/* Dark */
:root[data-theme="dark"] .model-selector-btn{
  background:#2a2f3a; color:#e8eaf1; border-color:#3b4252;
}

/* === Modal inferior estilo Gemini === */
.model-selector-modal{
  position: fixed; left:0; right:0; bottom:-100%;
  border-top-left-radius: 12px; border-top-right-radius: 12px;
  box-shadow: 0 -8px 24px rgba(0,0,0,.35);
  transition: bottom .28s ease; z-index: 9999;
  padding: 12px 0;
}
/* Light */
:root[data-theme="light"] .model-selector-modal{
  background:#f5f7fb; color:#0f172a; border-top:1px solid #e1e6ef;
}
/* Dark */
:root[data-theme="dark"] .model-selector-modal{
  background:#1e1e1e; color:#e8eaf1; border-top:1px solid #2b3240; 
}
.model-selector-modal.show{ bottom:0; }

.selector-title{
  margin: 0 16px 8px; font-size:13px; opacity:.85;
}

/* Opciones */
.model-option{
  padding:12px 16px; border-radius:10px; margin:0 2%;
  transition: background .15s ease, filter .15s ease;
}



.model-option strong{ font-size:15px; }
.model-option small{ opacity:.8; }

/* Asegura que el modal quede sobre el input-bar en móviles */
@media (max-width:600px){
  .model-selector-modal{ padding-bottom: calc(env(safe-area-inset-bottom) + 12px); }
}


.model-option {
  width: 96%;
}



/* Contenedor general */
.credit-badge{
  display:inline-flex; align-items:center; gap:0;
  border-radius:999px; overflow:hidden;
  border:1px solid var(--stroke);
  margin-left:8px;
  height:28px;
}

/* Lado de créditos */
.credit-count{
  display:inline-flex; align-items:center; gap:6px;
  padding:0 10px; line-height:1; font-weight:600;
  color:var(--text);
  background: var(--panel);
}
:root[data-theme="light"] .credit-count{ background:#eef2f6; }
:root[data-theme="dark"]  .credit-count{ background:#1f2430; }

/* Icono tipo “moneda/estrella” (usá tu imagen) */
.credits-coin{
  width:14px; height:14px; border-radius:4px; flex:0 0 14px;
  background-image: url('/img/iconoMagic.png');
  background-size: cover; background-position:center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.6);
}
:root[data-theme="dark"] .credits-coin{
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.35);
}

/* Botón Upgrade (gradiente) */
.upgrade-btn{
  border:0; cursor:pointer; height:100%;
  padding:0 12px; font-weight:700; color:#fff;
  display:inline-flex; align-items:center; justify-content:center;
  background: linear-gradient(90deg,#9b5cff,#6f9bff);
  transition: filter .15s ease, transform .06s ease;
}
.upgrade-btn:hover{ filter:brightness(1.05); }
.upgrade-btn:active{ transform:translateY(1px); }

/* Bordes y altura coherentes con header */
.model-selector-btn{ margin-right:8px; }



/* === Overrides: Theme toggle integrado en el footer del sidenav === */

/* Footer con 2 filas: 
   1) settings + toggle   2) invite a lo ancho */
.sidenav-footer.two-rows{
  display: grid;
  grid-template-areas:
    "settings theme"
    "invite   invite";
  grid-template-columns: 1fr auto;
  grid-template-rows: 48px 48px;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: inherit;
  border-top: 1px solid var(--stroke);
  padding: 10px 12px;
  list-style: none;
  z-index: 2;
}

/* Áreas del grid */
.sidenav-footer .footer-cell.settings{ grid-area: settings; }
.sidenav-footer .footer-cell.theme-toggle-cell{ grid-area: theme; }
.sidenav-footer .footer-cell.invite{ grid-area: invite; }

/* Ajustes visuales del item settings */
.sidenav-footer .sidenav-item{ 
  margin: 0; width: 100%;
}

/* Toggle compacto en el footer */
.sidenav-footer .theme-toggle{
  background: transparent; border: 0; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidenav-footer .theme-toggle .track{
  width: 50px; height: 26px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--stroke);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px; transition: background .25s, border-color .25s;
}
:root[data-theme="light"] .sidenav-footer .theme-toggle .track{ background:#eef2f6; }
:root[data-theme="dark"]  .sidenav-footer .theme-toggle .track{ background:#1f2430; }

.sidenav-footer .theme-toggle .icon{
  font-size: 16px; line-height: 1; opacity: .75; color: var(--muted);
}
.sidenav-footer .theme-toggle .thumb{
  position: absolute; top: 2px; left: 2px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--text); box-shadow: 0 2px 6px rgba(0,0,0,.35);
  transition: transform .25s;
}
/* Estado en light: mueve el thumb */
:root[data-theme="light"] .sidenav-footer .theme-toggle .thumb{ transform: translateX(24px); }

/* Botón Invite a lo ancho (se mantiene tu estilo actual) */
.sidenav-footer .invite-btn{
  width:100%; border-radius:12px; padding:10px 14px;
  border:1px solid var(--stroke); font-weight:600;
  display:flex; align-items:center; justify-content:center;
}


/* Aviso bajo el input */
.disclaimer{
  margin: 8px 4px 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
  pointer-events: none;
  user-select: none;
}

/* un poco más de respiración en pantallas chicas con home indicator */
@media (max-width:600px){
  .disclaimer{ padding-bottom: env(safe-area-inset-bottom, 0); }
}



/* ===== Attach Bottom Sheet ===== */
.attach-sheet {
  position: fixed; inset: 0; z-index: 10000;
  pointer-events: none; /* solo se activan hijos al abrir */
}
.attach-sheet .attach-scrim {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.0);
  transition: background .2s ease;
}
.attach-sheet .attach-panel {
  position: absolute; left: 0; right: 0; bottom: -100%;
  background: var(--panel-2);
  color: var(--text);
  border-top-left-radius: 14px; border-top-right-radius: 14px;
  border-top: 1px solid var(--stroke);
  box-shadow: 0 -10px 30px rgba(0,0,0,.35);
  padding: 8px 8px calc(env(safe-area-inset-bottom) + 10px);
  transition: bottom .25s ease;
  pointer-events: auto;
}
:root[data-theme="light"] .attach-sheet .attach-panel { background: #fff; }

.attach-sheet.show .attach-scrim { background: rgba(0,0,0,.45); }
.attach-sheet.show .attach-panel { bottom: 0; }

.attach-handle {
  width: 36px; height: 4px; border-radius: 999px;
  background: var(--stroke); opacity: .6; margin: 8px auto 10px;
}

.attach-list { list-style: none; margin: 0; padding: 0; }
.attach-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 10px; margin: 4px 6px;
  transition: background .15s ease;
}
.attach-item i.material-icons {
  font-size: 20px; width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text);
}
.attach-text strong { font-size: 15px; display: block; }
.attach-text small  { opacity: .75; display: block; margin-top: 2px; }

/*:root[data-theme="dark"]  .attach-item:hover { background: rgba(255,255,255,.06); }
:root[data-theme="light"] .attach-item:hover { background: rgba(0,0,0,.06); } */

.attach-close {
  position: absolute; right: 6px; top: 6px;
  border: 0; background: transparent; color: var(--muted);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.attach-close i { font-size: 20px; }
.attach-close:hover { background: rgba(0,0,0,.08); }
:root[data-theme="dark"] .attach-close:hover { background: rgba(255,255,255,.08); }


/* 1) Ocultar la “rayita” (handle) del sheet */
.attach-handle{ display:none; }

/* 2) Scrim clickeable (cerrar tocando fuera) + anim */
.attach-scrim{
  position: fixed; inset: 0;
  background: rgba(0,0,0,.48);
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease;
}
.attach-sheet.show .attach-scrim{
  opacity: 1; pointer-events: auto;
}

/* 3) Evitar que el primer tap dispare una opción al abrir */
.attach-sheet.just-opened *{ pointer-events: none !important; }
.attach-sheet.just-opened .attach-scrim{ pointer-events: none !important; } /* también el scrim */


/* --- Attach sheet: ajustes finos --- */
.attach-handle{ display:none; }                /* oculta la rayita */
.attach-list{ user-select:none; }
.attach-item:focus,
.attach-item:active{ background: inherit !important; outline: none !important; }

/* mientras anima la apertura, bloquea toques para evitar taps fantasmas */
.attach-panel.locked{ pointer-events: none; }


/* ===== More (3-dots) Bottom Sheet ===== */
.more-sheet{
  position: fixed; inset:0; z-index:10000;
  pointer-events:none;
}
.more-sheet .more-scrim{
  position:fixed; inset:0;
  background:rgba(0,0,0,.48);
  opacity:0; pointer-events:none;
  transition:opacity .18s ease;
}
.more-sheet.show .more-scrim{
  opacity:1; pointer-events:auto;
}
.more-sheet .more-panel{
  position:absolute; left:0; right:0; bottom:-100%;
  background:var(--panel-2); color:var(--text);
  border-top-left-radius:14px; border-top-right-radius:14px;
  border-top:1px solid var(--stroke);
  box-shadow:0 -10px 30px rgba(0,0,0,.35);
  padding:8px 8px calc(env(safe-area-inset-bottom) + 10px);
  transition:bottom .25s ease;
  pointer-events:auto;
}
:root[data-theme="light"] .more-sheet .more-panel{ background:#fff; }
.more-sheet.show .more-panel{ bottom:0; }

/* list */
.more-list{ list-style:none; margin:0; padding:6px 0; user-select:none; }
.more-item{
  display:flex; align-items:center; gap:12px;
  padding:12px; margin:4px 6px; border-radius:10px;
}
.more-item i.material-icons{
  font-size:20px; width:28px; height:28px;
  display:inline-flex; align-items:center; justify-content:center;
  color:var(--text);
}
/* sin hovers en mobile */
.more-item:focus,
.more-item:active{ outline:none !important; background:inherit !important; }

/* close button */
.more-close{
  position:absolute; right:6px; top:6px;
  border:0; background:transparent; color:var(--muted);
  width:34px; height:34px; border-radius:50%; cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center;
}
.more-close i{ font-size:20px; display: none;}
.more-close:hover{ background:rgba(0,0,0,.08); }
:root[data-theme="dark"] .more-close:hover{ background:rgba(255,255,255,.08); }

/* bloquear toques durante la animación de apertura */
.more-panel.locked{ pointer-events:none; }


/* ===== Auth modal ===== */
.auth-modal{ position:fixed; inset:0; z-index:11000; display:none; }
.auth-modal.show{ display:block; }

.auth-scrim{
  position:absolute; inset:0; backdrop-filter:saturate(80%) blur(1px);
  background:rgba(0,0,0,.45); opacity:0; transition:opacity .18s ease;
}
.auth-panel{
  position:absolute; left:50%; bottom:-100%;
  transform:translateX(-50%);
  width:min(92vw, 440px);
  border-radius:14px; border:1px solid var(--stroke);
  box-shadow:0 12px 40px rgba(0,0,0,.38);
  padding:18px 16px 16px;
  transition:bottom .22s ease;
  background:var(--panel-2); color:var(--text);
}
:root[data-theme="light"] .auth-panel{ background:#fff; }

.auth-modal.show .auth-scrim{ opacity:1; }
.auth-modal.show .auth-panel{ height: 60%;}

.auth-close{
  position:absolute; top:8px; right:8px;
  width:36px; height:36px; border-radius:50%;
  background:transparent; border:0; color:var(--muted); display:flex; align-items:center; justify-content:center;
}
.auth-close i{ font-size:20px; }
.auth-close:active{ opacity:.8; }

.auth-hero{
  height:70px; border-radius:10px;
  margin:4px 4px 14px;
  background: radial-gradient(120px 60px at 30% 30%, rgba(0,255,200,.35), transparent 60%),
              radial-gradient(120px 60px at 70% 40%, rgba(0,140,255,.35), transparent 60%),
              linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,0));
  border:1px solid var(--stroke);
}

.auth-title{ margin:0 8px 6px; font-size:18px; font-weight:700; }
.auth-sub{ margin:0 8px 16px; font-size:13px; color:var(--muted); }

.auth-actions{ display:flex; gap:10px; padding:0 6px 4px; }
.btn-primary, .btn-ghost{
  flex:1 1 0; height:42px; border-radius:999px; font-weight:700; border:1px solid var(--stroke);
}
.btn-primary{
  color:#fff; border:0;
  background: linear-gradient(90deg,#9b5cff,#6f9bff);
}
.btn-primary:active{ transform:translateY(1px); }
.btn-ghost{
  background:var(--panel); color:var(--text);
}
:root[data-theme="light"] .btn-ghost{ background:#eef2f6; }



/* === AUTH MODAL – estilo GPT con imagen de fondo + animación === */

/* contenedor general */
.auth-modal{ position:fixed; inset:0; z-index:11000; display:none; }
.auth-modal.show{ display:block; }

/* scrim con fade */
.auth-scrim{
  position:absolute; inset:0;
  background:rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
  opacity:0; transition:opacity .22s ease;
}
.auth-modal.show .auth-scrim{ opacity:1; }

/* panel centrado con animación scale+fade */
.auth-panel{
  position:absolute; left:50%; top:50%;
  transform: translate(-50%, -42%) scale(.98);
  width:min(92vw, 480px); max-height: 90vh;
  border-radius:16px; overflow:hidden;
  border:1px solid var(--stroke);
  box-shadow:0 24px 60px rgba(0,0,0,.45);
  background:var(--panel-2); color:var(--text);
  transition: transform .22s ease, opacity .22s ease;
  opacity:0;
  padding:0; /* el padding va en .auth-body */
}
:root[data-theme="light"] .auth-panel{ background:#fff; }
.auth-modal.show .auth-panel{
  transform: translate(-50%, -50%) scale(1);
  opacity:1;
}

/* imagen de fondo difuminada con máscara vertical */
.auth-panel::before{
  content:"";
  position:absolute; inset:-40px 0 0 0;
  background: url("/img/640.webp") center/cover no-repeat;
  filter: blur(24px) saturate(140%);
  opacity:.6;
  pointer-events:none;
  mask-image: linear-gradient(to bottom, white, transparent);
  -webkit-mask-image: linear-gradient(to bottom, white, transparent);
}

/* botón cerrar circular en esquina */
.auth-close{
  position:absolute; top:10px; right:10px; z-index:2;
  width:36px; height:36px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background:rgba(0,0,0,.40);
  border:1px solid rgba(255,255,255,.15);
  color:#fff;
}
.auth-close i{ font-size:20px; }

/* contenido */
.auth-body{
  position:relative; z-index:1;
  display:flex; flex-direction:column; align-items:center; text-align:center;
  padding: 20px 16px 18px;
}

/* espacio superior para dejar ver la “nube” difuminada */
.auth-body::before{
  content:""; display:block; width:100%; height:50px; border-radius:10px;
  margin-bottom:14px;
  border:0px solid var(--stroke);
 
}

/* tipografías */
.auth-title{
  margin: 0 12px 8px;
  font-size: 20px; font-weight: 700; color: var(--text);
}
.auth-sub{
  margin: 18px 12px 18px;
  font-size: 14px; line-height: 1.45; color: var(--muted);
  max-width: 90%;
}

/* acciones */
.auth-actions{ display:flex; gap:10px; justify-content:center; width:100%; padding: 20px 6px 16px; }
.btn-primary, .btn-ghost{
  height:44px; padding:0 20px; border-radius:999px; font-weight:700; font-size:14px;
  border:1px solid var(--stroke);
}
.btn-primary{
  border:0; color:#fff;
  background: linear-gradient(90deg,#9b5cff,#6f9bff);
}
.btn-primary:active{ transform: translateY(1px); }
.btn-ghost{
  background: var(--panel); color: var(--text);
}
:root[data-theme="light"] .btn-ghost{ background:#eef2f6; }




/* === Auth modal – fine-tune overrides (pegar al final) === */

/* 1) Panel: radio un poco mayor y halo más notorio */
.auth-panel{
  border-radius: 18px;
  box-shadow:
    0 26px 70px rgba(0,0,0,.55),
    0 1px 0 rgba(255,255,255,.04) inset;
  border-color: rgba(255,255,255,.08);
}
:root[data-theme="light"] .auth-panel{
  border-color: rgba(0,0,0,.08);
}

/* 2) Más respiración interna */
.auth-body{
  padding: 24px 18px 20px;
}
.auth-body::before{
  height: 10px;                 /* deja ver mejor la “nube” difuminada */
  margin-bottom: 16px;
}

/* 3) Tipografías y contraste */
.auth-title{
  margin: 0 14px 10px;
  font-size: 21px;
  letter-spacing: .2px;
}
.auth-sub{
  margin: 8px 14px 18px;
  font-size: 14px;
  line-height: 1.5;
}
:root[data-theme="dark"]  .auth-sub{ color: rgba(255,255,255,.78); }
:root[data-theme="light"] .auth-sub{ color: rgba(17,17,17,.72); }

/* 4) Botones: proporción y contraste del secundario */
.auth-actions{ gap: 12px; }
.btn-primary, .btn-ghost{
  min-width: 120px;
  height: 44px;
  border-radius: 999px;
  font-weight: 700;
}
.btn-ghost{
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255,255,255,.24);
}
.btn-ghost:active{ transform: translateY(1px); }
:root[data-theme="light"] .btn-ghost{
  color: #0f172a;
  border-color: rgba(0,0,0,.18);
  background: #eef2f6;
}

/* 5) Close: sutil mejora de visibilidad */
.auth-close{
  background: rgba(0,0,0,.42);
  border: 1px solid rgba(255,255,255,.18);
}
:root[data-theme="light"] .auth-close{
  background: rgba(0,0,0,.06);
  color: #111;
  border-color: rgba(0,0,0,.12);
}





/* ===== Settings & Help Bottom Sheet ===== */
.settings-sheet{
  position: fixed; inset:0; z-index:10000;
  pointer-events:none;
}
.settings-sheet .settings-scrim{
  position:fixed; inset:0;
  background:rgba(0,0,0,.48);
  opacity:0; pointer-events:none;
  transition:opacity .18s ease;
}
.settings-sheet.show .settings-scrim{
  opacity:1; pointer-events:auto;
}
.settings-sheet .settings-panel{
  position:absolute; left:0; right:0; bottom:-100%;
  background:var(--panel-2); color:var(--text);
  border-top-left-radius:14px; border-top-right-radius:14px;
  border-top:1px solid var(--stroke);
  box-shadow:0 -10px 30px rgba(0,0,0,.35);
  padding:8px 8px calc(env(safe-area-inset-bottom) + 10px);
  transition:bottom .25s ease;
  pointer-events:auto;
}
:root[data-theme="light"] .settings-sheet .settings-panel{ background:#fff; }
.settings-sheet.show .settings-panel{ bottom:0; }

/* lista */
.settings-list{ list-style:none; margin:0; padding:6px 0; user-select:none; }
.settings-item{
  display:flex; align-items:center; gap:12px;
  padding:12px; margin:4px 6px; border-radius:10px;
}
.settings-item i.material-icons{
  font-size:20px; width:28px; height:28px;
  display:inline-flex; align-items:center; justify-content:center;
  color:var(--text);
}
/* sin hover/focus en mobile */
.settings-item:focus,
.settings-item:active{ outline:none !important; background:inherit !important; }

/* botón cerrar (oculto visualmente, por accesibilidad queda) */
.settings-close{
  position:absolute; right:6px; top:6px;
  border:0; background:transparent; color:var(--muted);
  width:34px; height:34px; border-radius:50%; cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center;
}
.settings-close i{ font-size:20px; display:none; }

/* bloqueo de toques durante la animación de apertura */
.settings-panel.locked{ pointer-events:none; }


/* ===== Contenedor de mensajes ===== */
.chat-stream {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: calc(100dvh - 330px); /* ajusta según tu layout */
  overflow: auto;
  padding: 4px 0 8px;
}

/* ===== Burbujas de chat ===== */
.msg {
  max-width: 88%;
  margin: 6px 12px;
}

.msg .msg-body {
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1.35;
  border: 1px solid var(--stroke);
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.user {
  margin-left: auto;
}
.msg.user .msg-body {
  background: var(--panel);
}
.msg.assistant .msg-body {
  
      background: none;
    border: none;
}

/* ===== Acciones (copiar texto, etc.) ===== */
.msg .msg-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding-left: 6px;
}

.copy-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--muted);
}
.copy-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}
:root[data-theme="dark"] .copy-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}
.copy-btn i {
  font-size: 18px;
}

/* ===== Mensaje de "escribiendo" ===== */
.msg.typing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  
}
.msg.typing .typing-body {
  display: flex;
  align-items: center;
  gap: 10px;
}
.typing-dots {
  display: inline-flex;
  gap: 6px;
}
.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.7;
  display: inline-block;
  animation: typingBlink 1s infinite ease-in-out;
}
.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-dot:nth-child(3) {
  animation-delay: 0.30s;
}
.typing-label {
  font-size: 13px;
  opacity: 0.8;
}

/* ===== Animación de puntos ===== */
@keyframes typingBlink {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-3px); opacity: 1; }
}




/* ----- Header compacto al iniciar el chat ----- */
.chat-header{
  transition: padding .18s ease, margin .18s ease;
}
.chat-header img{
  transition: width .18s ease, height .18s ease, margin .18s ease;
}
.chat-header h5{
  transition: font-size .18s ease, margin .18s ease;
}

/* Altura de stream como variable para que se ajuste con header compacto */
:root{ --streamH: calc(100dvh - 330px); }
.chat-stream{ height: var(--streamH); }

/* Modo compacto: logo chico, solo marca, sin subtítulo */
.chat-container.compact { --streamH: calc(100dvh - 260px); } /* + espacio para el chat */
.chat-container.compact .chat-header{
  padding: 6px 10px;
  margin-bottom: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.chat-container.compact .chat-header img{
  width: 28px; height: 28px; margin: 0 6px 0 0;
}
.chat-container.compact .chat-header h5{
  display: inline-block;
  font-size: 16px;
  margin: 0;
}
.chat-container.compact .chat-header p{
  display: none; /* ocultamos el subtítulo */
}




/* Mic grabando (rojo + pulso) */
.input-bar .fab[aria-label="Micrófono"].recording {
  background: #b00020;
  color: #fff;
  border: 1px solid rgba(255,0,0,.35);
}
.input-bar .fab[aria-label="Micrófono"].recording i {
  animation: pulseMic 1s infinite ease-in-out;
}
@keyframes pulseMic {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.12); }
}

/* Timer de grabación */

/* Timer de grabación (diseño mejorado) */
.rec-indicator {
  margin-left: 10px;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 71, 87, 0.5);
  color: #fff;
  align-self: center;
  opacity: 0.95;
  user-select: none;
  pointer-events: none; /* no bloquea clics */
  box-shadow: 0 2px 6px rgba(255, 71, 87, 0.2);
  backdrop-filter: blur(4px);
  letter-spacing: 0.3px;
}

/* Puntito en rojo animado */
.rec-indicator::first-letter {
  color: #ff4757;
  font-weight: bold;
  animation: pulseDot 1.2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}



/* La barra debe ser referencia para posicionar el timer */
.input-bar{ position: relative; }

/* Timer flotante sobre la barra, arriba a la derecha, sin mover el mic */
.rec-indicator{
  position: absolute;
  right: 10px;                /* alinear sobre el mic */
  bottom: calc(100% + 6px);   /* por encima de la barra */
  z-index: 5;

  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 4px 10px;
  font-size: 12px;
  line-height: 1;
  border-radius: 999px;

  background: var(--panel);
  border: 1px solid var(--stroke);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0,0,0,.25);

  user-select: none;
  pointer-events: none;       /* no bloquea clicks */
  opacity: .95;
  transform: translateY(4px);
  animation: recSlideUp .18s ease-out forwards;
}

/* puntito “●” rojo */
.rec-indicator::first-letter{ color:#ff4757; }

/* Mic grabando (sin cambios) */
.input-bar .fab[aria-label="Micrófono"].recording{
  background:#b00020; color:#fff; border:1px solid rgba(255,0,0,.35);
}
.input-bar .fab[aria-label="Micrófono"].recording i{
  animation:pulseMic 1s infinite ease-in-out;
}
@keyframes pulseMic{0%,100%{transform:scale(1)}50%{transform:scale(1.12)}}

@keyframes recSlideUp{
  to{ transform: translateY(0); }
}




/* Fila de reciente + botón ⋮ */
.recent-row{
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-right: 8px;
}
.recent-row .recent-item{
  flex: 1 1 auto;
}
.recent-kebab{
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  width: 34px; height: 34px;
  border-radius: 8px;
  color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.recent-kebab:hover{ background: rgba(0,0,0,.06); }
:root[data-theme="dark"] .recent-kebab:hover{ background: rgba(255,255,255,.08); }

/* Popover de acciones */
.recent-menu{
  position: absolute;
  z-index: 3000;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,.22);
}
.recent-menu .recent-act{
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}
.recent-menu .recent-act:hover{
  background: rgba(0,0,0,.06);
}
:root[data-theme="dark"] .recent-menu .recent-act:hover{
  background: rgba(255,255,255,.08);
}
.recent-menu .recent-act.danger{ color: #e53935; }



/* Popover (ya lo tenés) … */

/* Sheets de confirm/rename */
.confirm-sheet{
  position: fixed; inset: 0; z-index: 4000;
  display: grid; grid-template-rows: 1fr auto;
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.confirm-sheet.show{ opacity: 1; pointer-events: auto; }
.confirm-sheet .cs-scrim{
   background: rgba(0,0,0,.35);
}
.confirm-sheet .cs-panel{
  grid-row: 2; background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 18px 18px 0 0;
  padding: 16px; box-shadow: 0 -8px 30px rgba(0,0,0,.25);
  transform: translateY(100%); transition: transform .22s ease;
}
.confirm-sheet.show .cs-panel{ transform: translateY(0); }

.cs-title{ font-weight:600; margin-bottom: 8px; }
.cs-text{ opacity:.8; margin-bottom: 14px; }
.cs-field{ margin: 8px 0 12px; }
.cs-field input{
  width:100%; padding:10px 12px; border-radius:10px;
  border:1px solid var(--stroke); background: var(--panel-2); color: var(--text);
}
.cs-actions{ display:flex; gap:10px; justify-content:flex-end; }

.btn-ghost{
  border:1px solid var(--stroke); background: transparent; color: var(--text);
  padding:8px 12px; border-radius:10px;
}
.btn-primary{
  border:0; background:#3b82f6; color:#fff; padding:8px 12px; border-radius:10px;
}
.btn-danger{
  border:0; background:#e53935; color:#fff; padding:8px 12px; border-radius:10px;
}








/* ===== Input bar siempre compacta ===== */
.input-bar{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:nowrap;            /* <- evita que crezca por wraps */
  padding:8px 10px;
}
.input-bar #userInput{
  flex:1 1 auto;
  min-height:44px;
  max-height:180px;
  margin:0;
  resize:none;
}

/* ===== Bandeja de adjuntos (carrusel) ===== */
.attach-tray{
  display:none;                /* se muestra al tener items */
  width:100%;
  padding:6px 6px 0;
  margin:0 0 6px;
  overflow-x:auto;
  overflow-y:hidden;
  white-space:nowrap;
  scrollbar-width: thin;
}
.attach-tray::-webkit-scrollbar{ height:6px; }
.attach-tray::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,.2);
  border-radius:6px;
}

/* Tarjeta base */
.tray-item{
  position:relative;
  display:inline-flex;
  flex-direction:column;
  justify-content:flex-end;
  width:120px; height:88px;
  margin-right:8px;
  background:var(--panel);
  border:1px solid var(--stroke);
  border-radius:12px;
  overflow:hidden;
}
.tray-item .thumb{
  position:absolute; inset:0;
  background:#111 center/cover no-repeat;
  opacity:.95;
}
.tray-item .meta{
  position:relative;
  z-index:1;
  padding:6px 8px;
  font-size:11px; line-height:1.2;
  color:var(--text);
  background:linear-gradient(transparent, rgba(0,0,0,.25));
  text-shadow:0 1px 1px rgba(0,0,0,.4);
  white-space:normal;
}
.tray-item .badge{
  position:absolute; left:8px; top:8px;
  font-size:10px; padding:2px 6px;
  border-radius:999px;
  background:rgba(0,0,0,.5); color:#fff;
  border:1px solid rgba(255,255,255,.15);
}
.tray-item .close{
  position:absolute; right:6px; top:6px;
  width:22px; height:22px; border-radius:999px;
  border:0; cursor:pointer; color:#fff;
  background:rgba(0,0,0,.45);
}
.tray-item .close:hover{ background:rgba(0,0,0,.6); }





/* Asegura columna: bandeja arriba, input-bar abajo */
.chat-input{
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: visible;          /* nada queda recortado */
}

/* La input-bar se mantiene compacta (como antes) */
.input-bar{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:nowrap;
  padding:8px 10px;
}
.input-bar #userInput{
  flex:1 1 auto;
  min-height:44px;
  max-height:180px;
  margin:0;
  resize:none;
}

/* Bandeja (carrusel) */
.attach-tray{
  display:none;               /* se muestra al tener items */
  width:100%;
  padding:6px 6px 0;
  margin:0 0 2px;
  overflow-x:auto;
  overflow-y:hidden;
  white-space:nowrap;
  scrollbar-width: thin;
}
.attach-tray::-webkit-scrollbar{ height:6px; }
.attach-tray::-webkit-scrollbar-thumb{ background:rgba(255,255,255,.2); border-radius:6px; }

/* Tarjetas */
.tray-item{ position:relative; display:inline-flex; flex-direction:column; justify-content:flex-end;
  width:120px; height:88px; margin-right:8px; background:var(--panel);
  border:1px solid var(--stroke); border-radius:12px; overflow:hidden; }
.tray-item .thumb{ position:absolute; inset:0; background:#111 center/cover no-repeat; opacity:.95; }
.tray-item .meta{ position:relative; z-index:1; padding:6px 8px; font-size:11px; line-height:1.2;
  color:var(--text); background:linear-gradient(transparent, rgba(0,0,0,.25)); }
.tray-item .badge{ position:absolute; left:8px; top:8px; font-size:10px; padding:2px 6px;
  border-radius:999px; background:rgba(0,0,0,.5); color:#fff; border:1px solid rgba(255,255,255,.15); }
.tray-item .close{ position:absolute; right:6px; top:6px; width:22px; height:22px; border-radius:999px;
  border:0; cursor:pointer; color:#fff; background:rgba(0,0,0,.45); }
.tray-item .close:hover{ background:rgba(0,0,0,.6); }



/* Bandeja + input en columna (bandeja encima, barra igual de compacta) */
.chat-input{ display:flex; flex-direction:column; gap:6px; overflow:visible; }

.input-bar{
  display:flex; align-items:center; gap:8px;
  flex-wrap:nowrap; padding:8px 10px;
}
.input-bar #userInput{ flex:1 1 auto; min-height:44px; max-height:180px; margin:0; resize:none; }

/* Bandeja carrusel */
.attach-tray{
  display:none; width:100%;
  padding:6px 6px 0; margin:0 0 6px;
  overflow-x:auto; overflow-y:hidden; white-space:nowrap;
  scrollbar-width:thin;
}
.attach-tray::-webkit-scrollbar{ height:6px; }
.attach-tray::-webkit-scrollbar-thumb{ background:rgba(255,255,255,.2); border-radius:6px; }

/* Tarjeta */
.tray-item{
  position:relative; display:inline-flex; flex-direction:column; justify-content:flex-end;
  width:120px; height:88px; margin-right:8px;
  background:var(--panel); border:1px solid var(--stroke); border-radius:12px; overflow:hidden;
}
.tray-item .thumb{ position:absolute; inset:0; background:#111 center/cover no-repeat; opacity:.95; }
.tray-item .meta{
  position:relative; z-index:1; padding:6px 8px; font-size:11px; line-height:1.2;
  color:var(--text); background:linear-gradient(transparent, rgba(0,0,0,.25));
}
.tray-item .badge{
  position:absolute; left:8px; top:8px; font-size:10px; padding:2px 6px;
  border-radius:999px; background:rgba(0,0,0,.5); color:#fff; border:1px solid rgba(255,255,255,.15);
}
.tray-item .close{
  position:absolute; right:6px; top:6px; width:22px; height:22px; border-radius:999px;
  border:0; cursor:pointer; color:#fff; background:rgba(0,0,0,.45);
}
.tray-item .close:hover{ background:rgba(0,0,0,.6); }



.cursor {
  display: inline-block;
  width: 8px;
  height: 1em;
  background: linear-gradient(180deg, #0ff, #09f);
  border-radius: 2px;
  margin-left: 2px;
  animation: bounce 0.6s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}




/* resultados con snippet */
.recent-item { display:flex; flex-direction:column; padding-right:36px; }
.recent-title   { font-size:14px; line-height:1.25; color:var(--text); }
.recent-snippet { font-size:12px; color:var(--text-dim,#bbb); margin-top:4px; }
.recent-snippet mark { background:transparent; color:var(--brand,#76ff03); font-weight:600; }

/* loading y vacíos */
.recent-loading, .recent-empty {
  padding:12px 16px; font-size:13px; color:var(--text-dim,#aaa);
  display:flex; align-items:center; gap:10px;
}
.spinner {
  width:16px; height:16px; border:2px solid rgba(255,255,255,.25);
  border-top-color: rgba(255,255,255,.9); border-radius:50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }



.msg-footer{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; margin-top:8px;
}
.msg-meta{
  display:flex; align-items:center; gap:6px;
  font-size:12px; opacity:.7;
}
.msg-meta .clock{ font-size:16px; opacity:.8; }

.msg-actions{
  display:flex; gap:8px;
}
.msg-actions .copy-btn,
.msg-actions .share-btn, .msg-actions .speak-btn{
  display:inline-flex; align-items:center; justify-content:center;
  width:32px; height:32px; border-radius:8px;
  border:1px solid var(--stroke); background:transparent; color:var(--text);
}
.msg-actions .copy-btn i,
.msg-actions .share-btn i, .msg-actions  .speak-btn i{ font-size:18px; line-height:18px; }



/* Agregar estos estilos */
 

/* ===== Timezone modal (bottom sheet) ===== */
.timezone-modal{ position:fixed; inset:0; z-index:12000; display:none; }
.timezone-modal.show{ display:block; }

.timezone-modal .timezone-scrim{
  position:fixed; inset:0;
  background:rgba(0,0,0,.48);
  opacity:0; transition:opacity .18s ease;
}
.timezone-modal.show .timezone-scrim{ opacity:1; }

.timezone-modal .timezone-panel{
  position:absolute; left:0; right:0; bottom:-100%;
  background:var(--panel-2); color:var(--text);
  border-top:1px solid var(--stroke);
  border-top-left-radius:16px; border-top-right-radius:16px;
  box-shadow:0 -12px 36px rgba(0,0,0,.45);
  padding:10px 10px calc(env(safe-area-inset-bottom) + 12px);
  transition:bottom .22s ease;
}
:root[data-theme="light"] .timezone-modal .timezone-panel{ background:#fff; }
.timezone-modal.show .timezone-panel{ bottom:0; }

/* header */
.tz-header{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.tz-title{ font-weight:700; font-size:16px; }
.timezone-close{
  border:0; background:transparent; color:var(--muted);
  width:34px; height:34px; border-radius:50%;
  display:inline-flex; align-items:center; justify-content:center;
}
.timezone-close:hover{ background:rgba(0,0,0,.06); }
:root[data-theme="dark"] .timezone-close:hover{ background:rgba(255,255,255,.08); }

/* search */
.tz-search{
  display:flex; align-items:center; gap:8px;
  height:38px; margin:10px 0; padding:0 12px;
  border-radius:999px; background:var(--panel);
  border:1px solid var(--stroke);
}
.tz-search i{ color:var(--muted); font-size:18px; }
.tz-search input{
  flex:1; min-width:0; border:0; outline:0; background:transparent;
  color:var(--text); font-size:14px;
}
.tz-search input::placeholder{ color:var(--muted); opacity:.85; }

/* list */
.tz-list{ list-style:none; margin:6px 0 0; padding:0; max-height:45vh; overflow:auto; }
.timezone-item{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:10px 12px; margin:3px 0; border-radius:10px;
  border:1px solid transparent; cursor:pointer;
}
.timezone-item:hover{ background:rgba(0,0,0,.06); }
:root[data-theme="dark"] .timezone-item:hover{ background:rgba(255,255,255,.06); }

.timezone-item.selected{
  border-color:var(--accent);
  box-shadow:0 0 0 2px color-mix(in oklab, var(--accent) 30%, transparent);
}
.tz-name{ font-size:14px; }
.tz-time{ font-variant-numeric:tabular-nums; opacity:.85; }

/* en pantallas chicas, dejá más aire abajo */
@media (max-width:600px){
  .timezone-modal .timezone-panel{ padding-bottom: calc(env(safe-area-inset-bottom) + 14px); }
}



/* Selección de zona en verde */
:root{ --tz-accent:#21d07a; } /* verde */

.timezone-item.selected{
  border-color: var(--tz-accent);
  box-shadow:
    0 0 0 2px color-mix(in oklab, var(--tz-accent) 40%, transparent) inset,
    0 2px 10px rgba(0,0,0,.18);
  background: color-mix(in oklab, var(--tz-accent) 14%, transparent);
}

.timezone-item .tz-name{ display:flex; align-items:center; gap:8px; }
.timezone-item .tz-check{
  display:none; font-size:18px; line-height:1; color:var(--tz-accent);
}
.timezone-item.selected .tz-check{ display:inline-block; }



/* ==== Timezone modal (dark / light) ==== */
.timezone-modal{
  position: fixed; inset:0; z-index: 10000; display:none;
}
.timezone-modal.show{ display:block; }

.timezone-scrim{
  position:absolute; inset:0; background:rgba(0,0,0,.5);
}

.timezone-panel{
  position:absolute; left:0; right:0; bottom:0;
  border-top-left-radius:16px; border-top-right-radius:16px;
  background: var(--panel-2); color: var(--text);
  border-top: 1px solid var(--stroke);
  box-shadow: 0 -12px 32px rgba(0,0,0,.35);
  padding: 10px 10px calc(env(safe-area-inset-bottom) + 12px);
}
:root[data-theme="light"] .timezone-panel{ background:#fff; }

.tz-header{
  display:flex; align-items:center; justify-content:space-between;
  padding: 6px 6px 10px;
}
.tz-title{ font-weight:700; }
.timezone-close{
  border:0; background:transparent; color:var(--muted);
  width:34px; height:34px; border-radius:50%;
}
.timezone-close:hover{ background:rgba(0,0,0,.06); }
:root[data-theme="dark"] .timezone-close:hover{ background:rgba(255,255,255,.08); }

.tz-search{
  display:flex; align-items:center; gap:8px;
  height:38px; border-radius:10px; margin:0 4px 8px;
  background:var(--panel); border:1px solid var(--stroke); padding:0 10px;
}
.tz-search i{ color:var(--muted); }
.tz-search input{
  flex:1; border:0; outline:0; background:transparent; color:var(--text);
}

.tz-list{ list-style:none; margin:6px 0 0; padding:0; max-height:45vh; overflow:auto; }
.timezone-item{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px; border-radius:10px; margin:2px 2px;
  border:1px solid transparent;
}
.timezone-item:hover{
  background: rgba(0,0,0,.06);
}
:root[data-theme="dark"] .timezone-item:hover{
  background: rgba(255,255,255,.06);
}

/* seleccionado: borde y foco verde */
:root{ --brand:#76ff03; }
.timezone-item.selected{
  border-color: var(--brand);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--brand) 35%, transparent);
}
.tz-name{ font-weight:600; }
.tz-time{ opacity:.9; font-variant-numeric: tabular-nums; }



/* --- Estilos para la barra de progreso en miniaturas --- */

/* Contenedor principal de la miniatura debe ser relativo */
.tray-item {
  position: relative;
  overflow: hidden; /* Oculta lo que se salga de los bordes redondeados */
}

/* Capa oscura semitransparente sobre la miniatura */
.tray-item-loading-overlay {
  position: absolute;
  inset: 0; /* Ocupa todo el espacio de la miniatura */
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1;
}

/* La barra de progreso */
.tray-item-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px; /* Grosor de la barra */
  width: 0%;   /* Inicia con 0 de ancho */
  background-color: #2998ff; /* Color moderno (puedes cambiarlo) */
  z-index: 2;
  /* Transición suave para la animación de llenado */
  transition: width 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}


.msg-actions .moment-btn {
background: transparent; /* El fondo del botón debe ser transparente /
border: 1px solid var(--stroke); / Añadimos un borde similar a los otros iconos (opcional, puedes quitarlo si prefieres sin borde) /
border-radius: 8px; / Para que coincida con los otros botones /
padding: 6px; / Ajusta el padding si es necesario para el tamaño del icono */
}

.msg-actions .moment-btn i {
color: var(--text);
opacity: 0.7;
transition: color 0.2s ease;
}

.msg-actions .moment-btn:hover {
background: rgba(255, 255, 255, 0.08); /* Efecto hover como los otros botones en dark mode */
}


.chat-container.compact .chat-header {
      gap: 8px;
    }



    .neurafit-toast {
      border-radius: 12px !important; /* Bordes más redondeados */
      box-shadow: 0 4px 12px rgba(0,0,0,0.25) !important;
      background-color: #323232; /* Un fondo oscuro estándar */
    }

    /* En pantallas grandes (tablets y más), lo centramos arriba */
    @media (min-width: 601px) {
      .neurafit-toast {
        top: 15%;
        left: 50%;
        transform: translateX(-50%);
      }
    } 




    /* Unificamos el estilo para TODOS los botones de acción */
.msg-actions .copy-btn,
.msg-actions .share-btn,
.msg-actions .speak-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

/* Unificamos el estilo para TODOS los iconos dentro de los botones */
.msg-actions .copy-btn i,
.msg-actions .share-btn i,
.msg-actions .speak-btn i {
  font-size: 18px;
  line-height: 1;
}



/* ===== Modal "Mis momentos" ===== */
/* ===== Modal "Mis momentos" ===== */
.mmodal {position:fixed; inset:0; z-index:9998; display:none;}
.mmodal.show{display:block;}
.mmodal .mm-scrim{position:absolute; inset:0; background:rgba(0,0,0,.5); backdrop-filter: blur(2px);}

/* PANEL flex para que el canvas crezca */
.mmodal .mm-panel{
  position:absolute; inset:auto 10px 10px 10px; top:8%;
  background:var(--panel, #121212); color:var(--text, #eee);
  border:1px solid var(--stroke, rgba(255,255,255,.12));
  border-radius:22px; box-shadow:0 20px 80px rgba(0,0,0,.45);
  max-width:920px; margin:0 auto; left:0; right:0;
  padding:14px; display:flex; flex-direction:column; min-height:60vh;
}

.mmodal .mm-close{
  position:absolute; right:8px; top:8px; border:0; background:transparent;
  width:40px; height:40px; border-radius:999px; display:grid; place-items:center;
}

.mmodal .mm-header{padding:6px 6px 10px 10px; flex-shrink:0;}
.mmodal .mm-header h3{margin:4px 0 2px; font:600 18px/1.2 system-ui;}
.mmodal .mm-header small{opacity:.75;}

/* CANVAS: ocupa todo el resto del panel */
.mmodal .mm-canvas-wrap{
  flex:1 1 auto; width:100%; height:100%; min-height:0;
  background:linear-gradient(180deg, rgba(255,255,255,.03), transparent);
  border-radius:16px; overflow:hidden; border:1px solid var(--stroke, rgba(255,255,255,.08));
  margin:6px 0 0 0; display:flex;
}

/* El SVG rellena el contenedor */
#mindmapSvg{ flex:1 1 auto; width:100%; height:100%; display:block; touch-action:none; }

/* ===== Nodos y líneas ===== */
.mmind-node circle{
  stroke:rgba(0,0,0,.35); stroke-width:1.5;
  filter:drop-shadow(0 4px 16px rgba(0,0,0,.35));
}
.mmind-node text{font:500 12px/1.1 system-ui; fill:#fff; text-shadow:0 1px 2px rgba(0,0,0,.45);}
.mmind-node.active circle{stroke:#fff; stroke-width:2.2;}

/* LÍNEAS: blancas en dark, negras en light (según <html data-theme="...">) */
html[data-theme="dark"]  .mmind-link{ stroke:rgba(255,255,255,.28); stroke-width:1.5; }
html[data-theme="dark"]  .mmind-link-arrow{ fill:rgba(255,255,255,.38); }

html[data-theme="light"] .mmind-link{ stroke:rgba(0,0,0,.28); stroke-width:1.5; }
html[data-theme="light"] .mmind-link-arrow{ fill:rgba(0,0,0,.38); }

/* móvil bajo */
@media (max-height:700px){ .mmodal .mm-panel{ top:4%; } }


 

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 0.2rem; /* Espacio entre campos */
  text-align: left;
}
.settings-label {
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  margin: 0 0 8px 0;
}
.settings-photo-upload {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto;
}
.ia-photo-preview {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.2);
}
#uploadPhotoBtn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 32px;
  height: 32px;
}
#uploadPhotoBtn i {
  font-size: 18px;
  line-height: 32px;
}
.file-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.05);
  padding: 8px 12px;
  border-radius: 8px;
}
#trainingFileName {
  font-style: italic;
  opacity: 0.8;
}
.temperature-value {
  display: inline-block;
  background: rgba(255,255,255,0.1);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: bold;
  margin-left: 8px;
}


#settingsModal  .auth-panel {
    height: 99% !important;
}


#saveConfigBtn{
  margin-top: -10%;
}


#timezoneBtn{
  margin-left: -5px !important;
}


#languageBtn{
  margin-left: -5px !important;
}





/* ===== FIX: Estilos para el modal de Tienda (#infoModal) ===== */

/* 1. Hacemos que el panel se ajuste al contenido y lo centramos */
#infoModal .auth-panel {
  height: auto !important; /* Anula la altura fija para que se adapte al contenido */
  top: 50%;
  bottom: auto; /* Desactivamos la animación desde abajo */
  transform: translate(-50%, -50%); /* Centramos vertical y horizontalmente */
}

/* 2. Alineamos el contenido del formulario */
#infoModal .auth-body {
  text-align: left; /* Alinea las etiquetas a la izquierda */
  align-items: stretch; /* Hace que los elementos internos ocupen todo el ancho */
  padding-bottom: 16px;
}

/* 3. Centramos el título "Tienda" */
#infoModal .auth-title {
  text-align: center;
  margin-bottom: 24px;
}

/* 4. Ocultamos el espacio superior que ya no es necesario */
#infoModal .auth-body::before {
  display: none;
}

/* 5. Ajustamos el espaciado de los campos y botones */
#infoModal .settings-form {
  gap: 1rem; /* Espacio entre los campos de texto */
}

#infoModal .auth-actions {
  padding: 0; /* Quitamos el padding extra de los contenedores de botones */
}

#infoModal .auth-body .auth-actions {
  margin-top: 24px; /* Espacio sobre los botones "Crear Planes" y "Mis Usuarios" */
}

#infoModal div.auth-actions {
   padding: 16px 24px 0; /* Espacio sobre el botón final "Guardar Cambios" */
}

/* 6. Estilo simple para los inputs, similar a la imagen */
#infoModal .input-field input[type="number"] {
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--stroke, #444); /* Solo una línea abajo */
  box-shadow: none; /* Quitamos cualquier sombra */
  padding: 0;
  height: 2rem;
}

#infoModal .input-field input[type="number"]:focus {
  border-bottom: 2px solid var(--accent, #6f9bff); /* Línea más gruesa al hacer foco */
  box-shadow: none;
}

#infoModal .input-field label {
  font-size: 13px; /* Hacemos la etiqueta un poco más pequeña */
}



/* ===== FIX v2: Estilos para botones en Modal de Negocio ===== */

/*
  Este selector es muy específico para asegurar que los estilos
  se apliquen a los botones azules dentro del modal de negocio.
*/
#infoModal .auth-body .auth-actions .btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px; /* Altura estándar */
  padding: 0 20px; /* Espaciado interno */
  font-size: 14px;
  font-weight: 700;
  border-radius: 999px; /* Bordes redondeados */
  border: none; /* Sin borde */
  color: #fff;
  background: linear-gradient(90deg,#9b5cff,#6f9bff); /* Gradiente original */
  line-height: 1; /* Asegura que el texto no se desplace */
}

/*
  Ajustamos el margen superior del contenedor de los dos botones
  para darles un poco más de aire.
*/
#infoModal .auth-body .auth-actions {
    margin-top: 32px;
}

/*
  Aseguramos que el botón final "Guardar Cambios" también se vea bien.
*/
#infoModal > .auth-panel > .auth-actions {
    padding: 24px;
    padding-top: 0;
}
 


#infoModal .auth-body .auth-actions {
    margin-top: 20px !important;
     flex-direction: row !important;
     margin-bottom: 20px !important;
}


   
/* ===== FIX: Toast sobre el modal ===== */
.neurafit-toast {
  z-index: 12000 !important; /* Debe ser mayor que el z-index del modal (11000) */
}


/* ===== FIX v2: Forzar Toast sobre el modal ===== */

/*
  Esta regla se aplica al contenedor de los toasts y a los toasts mismos,
  asegurando que tengan una prioridad de apilamiento superior a la del modal.
*/
#toast-container, .toast, .neurafit-toast {
  z-index: 12000 !important;
}





/* ===== Estilos para la Lista de Planes ===== */
.plans-list-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
}

.plan-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid var(--stroke);
}

.plan-details strong {
  font-size: 16px;
  display: block;
  color: var(--text);
}

.plan-details p {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0 8px;
}

.plan-details span {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.9;
}

.plan-actions {
  display: flex;
  gap: 8px;
}

#addPlanBtn:disabled {
  background: #555 !important;
  opacity: 0.7;
  cursor: not-allowed;
}


#editPlanModal > .auth-panel {
    height: fit-content !important;
}
 

#plansModal > .auth-panel {
    height: fit-content !important;
}


#plansModal > .auth-body {
    max-height: 80% !important;
    overflow: scroll;
}


#registerModal > .auth-panel {
    height: fit-content !important;
}


/* ===== Estilos para la Tienda de Planes de Usuario ===== */
/* ===== Estilos para la Tienda de Planes de Usuario (CORREGIDO) ===== */
.user-plans-list {
  display: flex;
  flex-direction: column;
  gap: 12px; /* <-- Ajustamos el espacio para que sea fijo y un poco menor */
  margin-top: 1.5rem;
  
  /* --- INICIO DE LA CORRECCIÓN --- */
  max-height: 55vh; /* <-- Altura máxima antes de que aparezca el scroll */
  overflow-y: auto; /* <-- Habilita el scroll vertical cuando es necesario */
  padding: 4px;     /* <-- Pequeño espacio interno para que el scroll no se pegue al borde */
  /* --- FIN DE LA CORRECCIÓN --- */
}

.user-plan-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid var(--stroke);
  flex-shrink: 0; /* <-- Evita que las tarjetas se encojan */
}

.user-plan-card .plan-info h4 {
  margin: 0 0 4px 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.user-plan-card .plan-info p {
  margin: 0 0 8px 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.user-plan-card .plan-pricing {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  font-weight: 500;
}

.user-plan-card .plan-usd-value {
  font-size: 0.8rem;
  opacity: 0.8;
}

.user-plan-card .btn-buy {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
}


#userStoreModal > .auth-panel {
    height: fit-content !important;
}



#userSettingsModal > .auth-panel {
    height: fit-content !important;
}


/* Estilo para el botón de Cerrar Sesión */
.logout-button {
  background: none;
  border: none;
  color: var(--muted); /* Un color sutil */
  text-decoration: underline;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.8;
  padding: 8px;
  transition: opacity 0.2s ease;
}

.logout-button:hover {
  opacity: 1; /* Se aclara un poco al pasar el mouse */
}




/* Estilos para el modal de usuarios, con el mismo diseño que el de planes */
#usersModal > .auth-panel {
    height: fit-content !important;
}

#usersModal .auth-body {
    max-height: 80% !important;
    overflow: scroll;
}

/* Reutiliza las clases existentes para las tarjetas */
.user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid var(--stroke);
}


#settingsModal > .auth-panel {
    height: fit-content !important;
}