/*
 * global.css — Piofly design system
 * Shared by: index.html, ideas.html, courses.html, economy.html, profile.html
 * Themes: light (default) + dark (via [data-theme="dark"])
 */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&display=swap');

/* ═════════════════════════════════════════════════════════
   DESIGN TOKENS — LIGHT (DEFAULT)
═════════════════════════════════════════════════════════ */
:root {
  /* Brand — Blue (identity & navigation) */
  --primary:        #008FC8;
  --primary-mid:    #007AAD;
  --primary-dark:   #005E8A;
  --primary-light:  #1AAAD9;
  --primary-soft:   #E6F4FA;
  --primary-softer: #F2FAFD;
  --primary-glow:   color-mix(in srgb, var(--primary) 14%, transparent);

  /* Accent — Orange (action & focus) */
  --accent:         #FF8A00;
  --accent-mid:     #E67A00;
  --accent-dark:    #C96800;
  --accent-light:   #FFA333;
  --accent-soft:    #FFF3E6;
  --accent-softer:  #FFFAF2;
  --accent-glow:    color-mix(in srgb, var(--accent) 22%, transparent);

  /* Surfaces — light mode */
  --bg-main:        #F7FAFC;
  --bg-panel:       #FFFFFF;
  --bg-soft:        #FFF8F2;
  --bg-elevated:    #FFFFFF;

  /* Sidebar — matches light mode (acompaña al fondo blanco del workspace) */
  --sidebar-bg:         #FFFFFF;
  --sidebar-panel:      #F7FAFC;
  --sidebar-hover:      rgba(15, 23, 42, 0.04);
  --sidebar-active:     color-mix(in srgb, var(--accent) 10%, transparent);
  --sidebar-border:     #E2E8F0;
  --sidebar-border-mid: #CBD5E1;
  --sidebar-text:       #0F172A;
  --sidebar-text-soft:  #475569;
  --sidebar-text-muted: #94A3B8;

  /* Text */
  --text-main:      #0F172A;
  --text-soft:      #475569;
  --text-muted:     #94A3B8;
  --text-light:     #CBD5E1;
  --text-invert:    #FFFFFF;

  /* Borders */
  --border-soft:    #E2E8F0;
  --border-mid:     #CBD5E1;
  --border-strong:  #94A3B8;

  /* Semantic */
  --green:          #10B981;
  --green-dark:     #059669;
  --green-soft:     #D1FAE5;
  --red:            #EF4444;
  --red-dark:       #DC2626;
  --red-soft:       #FEE2E2;

  /* Shadows — layered for depth */
  --shadow-xs:      0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm:      0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md:      0 4px 14px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg:      0 12px 28px rgba(15, 23, 42, 0.12), 0 4px 8px rgba(15, 23, 42, 0.05);
  --shadow-xl:      0 24px 48px rgba(15, 23, 42, 0.18), 0 8px 16px rgba(15, 23, 42, 0.08);
  --shadow-accent:  0 4px 14px color-mix(in srgb, var(--accent) 28%, transparent);
  --shadow-primary: 0 4px 14px color-mix(in srgb, var(--primary) 22%, transparent);
  --shadow-sidebar: 4px 0 24px rgba(15, 23, 42, 0.08);

  /* Radii */
  --r-xs:           6px;
  --r-sm:           10px;
  --r-md:           14px;
  --r-lg:           18px;
  --r-xl:           24px;
  --r-2xl:          32px;
  --r-pill:         999px;

  /* Layout */
  --max-w:          1280px;
  --header-h:       64px;
  --bnav-h:         0px;

  /* Motion */
  --tr:             all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --tr-fast:        all 0.15s ease;
  --tr-slow:        all 0.35s cubic-bezier(0.22, 1, 0.36, 1);

  /* ── Legacy aliases — preserved so existing markup/JS keeps working ── */
  --white:          #FFFFFF;
  --bg:             #F7FAFC;
  --bg-alt:         #EDF2F7;
  --text:           #0F172A;
  --text-mid:       #475569;
  --border:         #E2E8F0;
  --primary-bg:     #E6F4FA;
  --primary-bg2:    #CFE9F4;
  --gold:           #FF8A00;
  --gold-dark:      #E67A00;
  --gold-light:     #FFA333;
  --gold-bg:        #FFF3E6;
  --red-bg:         #FEE2E2;
  --green-bg:       #D1FAE5;
}

/* ═════════════════════════════════════════════════════════
   SECTOR COLOR THEMES — ACCENT VARIABLE OVERRIDES
   Redefines the global accent color family dynamically
   across the entire dashboard based on the selected sector.
   ═════════════════════════════════════════════════════════ */
[data-chat-theme="eventos"] {
  --accent:         #FF8A00;
  --accent-mid:     #E67A00;
  --accent-dark:    #C96800;
  --accent-light:   #FFB85C;
  --accent-soft:    #FFF3E6;
  --accent-softer:  #FFFAF2;
}
[data-chat-theme="contenido"] {
  --accent:         #EF4444;
  --accent-mid:     #DC2626;
  --accent-dark:    #B91C1C;
  --accent-light:   #FCA5A5;
  --accent-soft:    #FEE2E2;
  --accent-softer:  #FEF2F2;
}
[data-chat-theme="realestate"] {
  --accent:         #3B82F6;
  --accent-mid:     #2563EB;
  --accent-dark:    #1D4ED8;
  --accent-light:   #93C5FD;
  --accent-soft:    #EFF6FF;
  --accent-softer:  #F8FAFC;
}
[data-chat-theme="fitness"] {
  --accent:         #10B981;
  --accent-mid:     #059669;
  --accent-dark:    #047857;
  --accent-light:   #6EE7B7;
  --accent-soft:    #ECFDF5;
  --accent-softer:  #F0FDF4;
}
[data-chat-theme="restaurante"] {
  --accent:         #F97316;
  --accent-mid:     #EA580C;
  --accent-dark:    #C2410C;
  --accent-light:   #FDBA74;
  --accent-soft:    #FFF7ED;
  --accent-softer:  #FFFAF0;
}
[data-chat-theme="educacion"] {
  --accent:         #EAB308;
  --accent-mid:     #CA8A04;
  --accent-dark:    #A16207;
  --accent-light:   #FCD34D;
  --accent-soft:    #FEFCE8;
  --accent-softer:  #FEFDF0;
}
[data-chat-theme="ecommerce"] {
  --accent:         #06B6D4;
  --accent-mid:     #0891B2;
  --accent-dark:    #0E7490;
  --accent-light:   #67E8F9;
  --accent-soft:    #ECFEFF;
  --accent-softer:  #F0FDFA;
}
[data-chat-theme="servicios"] {
  --accent:         #A855F7;
  --accent-mid:     #9333EA;
  --accent-dark:    #7E22CE;
  --accent-light:   #D8B4FE;
  --accent-soft:    #FAF5FF;
  --accent-softer:  #FAF5FF;
}
[data-chat-theme="saas"] {
  --accent:         #6366F1;
  --accent-mid:     #4F46E5;
  --accent-dark:    #4338CA;
  --accent-light:   #A5B4FC;
  --accent-soft:    #EEF2FF;
  --accent-softer:  #F5F3FF;
}
[data-chat-theme="rosa"] {
  --accent:         #EC4899;
  --accent-mid:     #DB2777;
  --accent-dark:    #BE185D;
  --accent-light:   #F9A8D4;
  --accent-soft:    #FDF2F8;
  --accent-softer:  #FDF2F8;
}

/* ═════════════════════════════════════════════════════════
   WS-CHAT ACCENT TOKENS — globales (cualquier página)
   Redefine --ws-chat-accent y familia según el sector activo
   para que el dropdown de usuario, popover de temas y toasts
   funcionen correctamente en index.html y cualquier otra página.
═════════════════════════════════════════════════════════ */
[data-chat-theme="eventos"]     { --ws-chat-accent: #FF8A00; --ws-chat-accent-light: #FFB85C; --ws-chat-feed-bg: #1F1005; --ws-chat-bubble-bg: #0F0904; }
[data-chat-theme="contenido"]   { --ws-chat-accent: #FCA5A5; --ws-chat-accent-light: #FECACA; --ws-chat-feed-bg: #2E1212; --ws-chat-bubble-bg: #1F0707; }
[data-chat-theme="realestate"]  { --ws-chat-accent: #93C5FD; --ws-chat-accent-light: #DBEAFE; --ws-chat-feed-bg: #1A2750; --ws-chat-bubble-bg: #080C20; }
[data-chat-theme="fitness"]     { --ws-chat-accent: #6EE7B7; --ws-chat-accent-light: #A7F3D0; --ws-chat-feed-bg: #0F3D22; --ws-chat-bubble-bg: #061A0E; }
[data-chat-theme="restaurante"] { --ws-chat-accent: #FDBA74; --ws-chat-accent-light: #FED7AA; --ws-chat-feed-bg: #4A2412; --ws-chat-bubble-bg: #1D0E05; }
[data-chat-theme="educacion"]   { --ws-chat-accent: #FCD34D; --ws-chat-accent-light: #FDE68A; --ws-chat-feed-bg: #4D3514; --ws-chat-bubble-bg: #1F1607; }
[data-chat-theme="ecommerce"]   { --ws-chat-accent: #67E8F9; --ws-chat-accent-light: #A5F3FC; --ws-chat-feed-bg: #134353; --ws-chat-bubble-bg: #061720; }
[data-chat-theme="servicios"]   { --ws-chat-accent: #D8B4FE; --ws-chat-accent-light: #E9D5FF; --ws-chat-feed-bg: #331957; --ws-chat-bubble-bg: #110620; }
[data-chat-theme="saas"]        { --ws-chat-accent: #A5B4FC; --ws-chat-accent-light: #C7D2FE; --ws-chat-feed-bg: #25234D; --ws-chat-bubble-bg: #08081E; }
[data-chat-theme="rosa"]        { --ws-chat-accent: #F9A8D4; --ws-chat-accent-light: #FBCFE8; --ws-chat-feed-bg: #3A1430; --ws-chat-bubble-bg: #1A0712; }


/* ═════════════════════════════════════════════════════════
   DESIGN TOKENS — DARK
═════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --bg-main:        #0F172A;
  --bg-panel:       #111827;
  --bg-soft:        #1E293B;
  --bg-elevated:    #1E293B;
  --card-bg:        #1A2233;  /* para overrides de cards (mensajes, context card, etc.) */

  --sidebar-bg:         #0B1220;
  --sidebar-panel:      #111827;
  --sidebar-hover:      rgba(255, 255, 255, 0.06);
  --sidebar-active:     color-mix(in srgb, var(--accent) 16%, transparent);
  --sidebar-border:     rgba(255, 255, 255, 0.06);
  --sidebar-border-mid: rgba(255, 255, 255, 0.12);
  --sidebar-text:       #F1F5F9;
  --sidebar-text-soft:  #94A3B8;
  --sidebar-text-muted: #64748B;

  --text-main:      #F1F5F9;
  --text-soft:      #CBD5E1;
  --text-muted:     #94A3B8;
  --text-light:     #475569;

  --border-soft:    #1E293B;
  --border-mid:     #334155;
  --border-strong:  #475569;

  --primary-soft:   color-mix(in srgb, var(--primary) 16%, transparent);
  --primary-softer: color-mix(in srgb, var(--primary) 8%, transparent);
  --primary-glow:   color-mix(in srgb, var(--primary-light) 22%, transparent);
  --accent-soft:    color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-softer:  color-mix(in srgb, var(--accent) 7%, transparent);
  --accent-glow:    color-mix(in srgb, var(--accent) 28%, transparent);

  --green-soft:     rgba(16, 185, 129, 0.16);
  --red-soft:       rgba(239, 68, 68, 0.16);

  --shadow-xs:      0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm:      0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md:      0 4px 14px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-lg:      0 12px 28px rgba(0, 0, 0, 0.6), 0 4px 8px rgba(0, 0, 0, 0.4);
  --shadow-xl:      0 24px 48px rgba(0, 0, 0, 0.7), 0 8px 16px rgba(0, 0, 0, 0.5);
  --shadow-sidebar: 4px 0 24px rgba(0, 0, 0, 0.4);

  /* Legacy aliases for dark */
  --white:          #111827;
  --bg:             #0F172A;
  --bg-alt:         #1E293B;
  --text:           #F1F5F9;
  --text-mid:       #CBD5E1;
  --border:         #1E293B;
  --primary-bg:     rgba(0, 143, 200, 0.16);
  --primary-bg2:    rgba(0, 143, 200, 0.22);
  --gold-bg:        rgba(255, 138, 0, 0.14);
  --green-bg:       rgba(16, 185, 129, 0.16);
  --red-bg:         rgba(239, 68, 68, 0.16);
}

[data-theme="negro"] {
  --bg-main:        #000000;
  --bg-panel:       #0A0A0A;
  --bg-soft:        #121212;
  --bg-elevated:    #0A0A0A;
  --card-bg:        #0A0A0A;

  --sidebar-bg:         #000000;
  --sidebar-panel:      #000000;
  --sidebar-hover:      rgba(255, 255, 255, 0.04);
  --sidebar-active:     color-mix(in srgb, var(--accent) 16%, transparent);
  --sidebar-border:     rgba(255, 255, 255, 0.05);
  --sidebar-border-mid: rgba(255, 255, 255, 0.09);
  --sidebar-text:       #F8FAFC;
  --sidebar-text-soft:  rgba(248, 250, 252, 0.85);
  --sidebar-text-muted: rgba(248, 250, 252, 0.50);

  --text-main:      #F8FAFC;
  --text-soft:      rgba(248, 250, 252, 0.85);
  --text-muted:     rgba(248, 250, 252, 0.50);
  --text-light:     rgba(255, 255, 255, 0.18);

  --border-soft:    rgba(255, 255, 255, 0.05);
  --border-mid:     rgba(255, 255, 255, 0.09);
  --border-strong:  rgba(255, 255, 255, 0.18);

  --primary-soft:   color-mix(in srgb, var(--primary) 16%, transparent);
  --primary-softer: color-mix(in srgb, var(--primary) 8%, transparent);
  --primary-glow:   color-mix(in srgb, var(--primary-light) 22%, transparent);
  --accent-soft:    color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-softer:  color-mix(in srgb, var(--accent) 7%, transparent);
  --accent-glow:    color-mix(in srgb, var(--accent) 28%, transparent);

  --green-soft:     rgba(16, 185, 129, 0.16);
  --red-soft:       rgba(239, 68, 68, 0.16);

  --shadow-xs:      0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-sm:      0 1px 3px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md:      0 4px 14px rgba(0, 0, 0, 0.7), 0 2px 4px rgba(0, 0, 0, 0.5);
  --shadow-lg:      0 12px 28px rgba(0, 0, 0, 0.8), 0 4px 8px rgba(0, 0, 0, 0.6);
  --shadow-xl:      0 24px 48px rgba(0, 0, 0, 0.9), 0 8px 16px rgba(0, 0, 0, 0.7);
  --shadow-sidebar: 4px 0 24px rgba(0, 0, 0, 0.6);

  /* Legacy aliases for negro */
  --white:          #0A0A0A;
  --bg:             #000000;
  --bg-alt:         #121212;
  --text:           #F8FAFC;
  --text-mid:       rgba(248, 250, 252, 0.85);
  --border:         rgba(255, 255, 255, 0.05);
  --primary-bg:     rgba(0, 143, 200, 0.16);
  --primary-bg2:    rgba(0, 143, 200, 0.22);
  --gold-bg:        rgba(255, 138, 0, 0.14);
  --green-bg:       rgba(16, 185, 129, 0.16);
  --red-bg:         rgba(239, 68, 68, 0.16);
}

/* ═════════════════════════════════════════════════════════
   RESET + BASE
═════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light; }
[data-theme="dark"] html,
html[data-theme="dark"] { color-scheme: dark; }
body {
  background: var(--bg-main);
  color: var(--text-main);
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
}
a       { text-decoration: none; color: inherit; }
button  { font-family: inherit; cursor: pointer; border: none; outline: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }
::selection { background: var(--accent-glow); color: var(--text-main); }

/* ═════════════════════════════════════════════════════════
   HEADER — premium navbar
═════════════════════════════════════════════════════════ */
.header {
  position: sticky; top: 0; z-index: 200;
  height: var(--header-h);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: var(--shadow-xs);
  backdrop-filter: saturate(1.1) blur(10px);
  transition: background 0.3s ease, border-color 0.3s ease;
}
.header-inner {
  max-width: var(--max-w); margin: 0 auto;
  /* Padding simétrico (mismo a ambos lados) — junto al grid 1fr·auto·1fr
     deja el menú central perfectamente centrado. */
  padding: 0 28px; height: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

/* El navbar es un grid 1fr · auto · 1fr: las columnas laterales son
   iguales, así el menú central queda perfectamente centrado y simétrico.
   No se le aplican translateX a los bloques — eso descuadraba la simetría. */

/* Logo */
.header-logo { display: flex; align-items: center; gap: 4px; }
.header-logo img { height: 32px; width: auto; display: block; margin-right: -4px; }
.header-logo-text { font-size: 20px; font-weight: 800; letter-spacing: -0.4px; }
.header-logo-text span:first-child { color: var(--text-main); }
/* "fly" SIEMPRE naranja de marca — fijo, no sigue el tema de color */
.header-logo-text span:last-child  { color: #FF8A00; }

/* Logo swap según modo: claro muestra logo.png (naranja), oscuro muestra logoblanco/logoblanco.png */
.header-logo .logo-on-dark { display: none; }
.header-logo .logo-on-light { display: block; }
[data-theme="dark"] .header-logo .logo-on-light,
[data-theme="negro"] .header-logo .logo-on-light { display: none; }
[data-theme="dark"] .header-logo .logo-on-dark,
[data-theme="negro"] .header-logo .logo-on-dark  { display: block; }

/* Identidad Piofly en el navbar: mascota + wordmark "piofly"
   (pio = color de texto, fly = acento naranja vía .header-logo-text). */
/* translateX en vez de margin: mueve el logo a la derecha SIN empujar
   ni recorrer el resto de los elementos del navbar. */
.header-logo { gap: 7px; }
.hl-avatar {
  width: 34px; height: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.hl-avatar img { width: 100%; height: 100%; object-fit: contain; margin: 0; }

/* Nav — modern pills */
.header-nav { display: flex; align-items: center; gap: 4px; }
.header-nav a {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--r-pill);
  font-size: 13.5px; font-weight: 700; color: var(--text-soft);
  border: 1px solid transparent;
  transition: var(--tr);
  position: relative;
}
.header-nav a svg {
  width: 16px; height: 16px; flex-shrink: 0;
  stroke: currentColor; fill: none;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
.header-nav a:hover {
  color: var(--primary); background: var(--primary-soft);
}
.header-nav a.active {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-color: var(--primary-glow);
  box-shadow: inset 0 -2px 0 var(--primary);
}
[data-theme="dark"] .header-nav a.active,
[data-theme="negro"] .header-nav a.active { color: var(--primary-light); }

/* Right cluster */
.header-right { display: flex; align-items: center; gap: 8px; justify-self: center; }

/* Edgar 2026-06-30: hstat chips PREMIUM gamificación tipo Duolingo.
   - Glass effect con backdrop-blur
   - Cada stat tiene SU color (no todo naranja como antes)
   - Íconos con drop-shadow del color (glow tech)
   - Empty state visual: opacity reducida cuando es 0
   - Hover lift + glow del color */
.hstat {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  font-size: 13px; font-weight: 700;
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1),
              border-color 0.22s cubic-bezier(0.32, 0.72, 0, 1),
              box-shadow 0.22s cubic-bezier(0.32, 0.72, 0, 1);
  cursor: default;
  color: var(--text-soft);
  position: relative;
  overflow: hidden;
}
.hstat::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.hstat:hover { transform: translateY(-1px); }
.hstat:hover::before { opacity: 1; }
.hstat-icon { font-size: 14px; line-height: 1; }
.hstat i {
  font-size: 15px;
  line-height: 1;
  transition: filter 0.22s cubic-bezier(0.32, 0.72, 0, 1),
              transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}
.hstat:hover i { transform: scale(1.12); }

/* FIRE — rachas (gradient red→orange) */
.hstat--fire i {
  color: #FB923C;
  filter: drop-shadow(0 0 6px rgba(251, 113, 133, 0.55));
}
.hstat--fire::before {
  background: linear-gradient(135deg, rgba(251, 113, 133, 0.18), rgba(251, 146, 60, 0.08));
}
.hstat--fire:hover {
  border-color: rgba(251, 146, 60, 0.45);
  box-shadow: 0 0 20px rgba(251, 113, 133, 0.22);
}

/* COINS — verde dinero (FZ = dinero) */
.hstat--coins i {
  color: #34D399;
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.55));
}
.hstat--coins::before {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.20), rgba(5, 150, 105, 0.08));
}
.hstat--coins:hover {
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.22);
}

/* XP — púrpura tech */
.hstat--xp i {
  color: #C4B5FD;
  filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.50));
}
.hstat--xp::before {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(167, 139, 250, 0.08));
}
.hstat--xp:hover {
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.22);
}

/* MONEY — verde esmeralda */
.hstat--money i {
  color: #6EE7B7;
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.50));
}
.hstat--money::before {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.20), rgba(52, 211, 153, 0.08));
}
.hstat--money:hover {
  border-color: rgba(52, 211, 153, 0.45);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.22);
}

/* KARMA — púrpura magenta */
.hstat--karma i {
  color: #C4B5FD;
  filter: drop-shadow(0 0 6px rgba(167, 139, 250, 0.50));
}
.hstat--karma::before {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.18), rgba(196, 181, 253, 0.08));
}

/* Empty state — cuando el stat es 0, el ícono se ve apagado.
   El JS detecta el span con '0' y agrega clase .hstat--empty. */
.hstat--empty i {
  filter: grayscale(0.7) brightness(0.85) !important;
  opacity: 0.6;
}
.hstat--empty .hstat-text { opacity: 0.55; }

/* Theme toggle */
.theme-toggle {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border-soft); background: var(--bg-panel);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-soft); font-size: 16px;
  transition: var(--tr); cursor: pointer;
}
.theme-toggle:hover {
  border-color: var(--accent); color: var(--accent);
  transform: rotate(15deg);
}
.theme-toggle .ph-moon { display: block; }
.theme-toggle .ph-sun  { display: none; }
[data-theme="dark"] .theme-toggle .ph-moon,
[data-theme="negro"] .theme-toggle .ph-moon { display: none; }
[data-theme="dark"] .theme-toggle .ph-sun,
[data-theme="negro"] .theme-toggle .ph-sun  { display: block; }

/* Avatar */
.header-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-mid));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: white;
  border: 2px solid var(--accent); cursor: pointer;
  transition: var(--tr); flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.header-avatar:hover { transform: scale(1.05); box-shadow: var(--shadow-accent); }

/* Hamburger */
.header-hamburger {
  display: none; background: var(--bg-soft); border: 1px solid var(--border-soft);
  color: var(--text-soft); font-size: 18px; padding: 8px 12px;
  border-radius: var(--r-sm); transition: var(--tr); line-height: 1;
}
.header-hamburger:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* ═════════════════════════════════════════════════════════
   LANGUAGE SELECTOR
═════════════════════════════════════════════════════════ */
.lang-selector { position: relative; }
.lang-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: var(--r-pill);
  background: var(--bg-soft); border: 1px solid var(--border-soft);
  color: var(--text-soft); font-size: 13px; font-weight: 700;
  font-family: inherit; cursor: pointer;
  transition: var(--tr);
}
.lang-btn:hover { background: var(--primary-soft); border-color: var(--primary-glow); color: var(--primary); }
.lang-btn svg {
  width: 12px; height: 12px; stroke: currentColor; fill: none;
  stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
  opacity: 0.55; transition: transform .2s;
}
.lang-selector.open .lang-btn svg { transform: rotate(180deg); }
.lang-flag { font-size: 15px; line-height: 1; }
.lang-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-panel); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); padding: 6px; min-width: 152px;
  box-shadow: var(--shadow-lg);
  z-index: 300;
}
.lang-selector.open .lang-dropdown { display: flex; flex-direction: column; }
.lang-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600; color: var(--text-soft);
  font-family: inherit; cursor: pointer; background: none; border: none;
  transition: var(--tr-fast);
}
.lang-opt:hover { background: var(--primary-soft); color: var(--primary); }
.lang-opt--active { color: var(--primary); font-weight: 700; }
.lang-opt--active::after { content: '✓'; margin-left: auto; font-size: 12px; }

/* ═════════════════════════════════════════════════════════
   BOTTOM NAV — mobile only
═════════════════════════════════════════════════════════ */
/* Edgar 2026-06-30: bottom-nav GLASS BLUR premium (Apple/Stripe style).
   El nav 'respira' el color de lo que está atrás — cuando el feed
   tiene un tema teal/púrpura/rojo, el nav se tinta naturalmente
   sin variables CSS extras. Backdrop saturate amplifica los colores
   del contenido detrás (no del nav mismo). */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 300;
  background: rgba(15, 23, 42, 0.65);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  height: 68px; padding: 6px 8px 8px;
  justify-content: space-around; align-items: center;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}
/* Light theme — glass blanco */
[data-theme="light"] .bottom-nav {
  background: rgba(255, 255, 255, 0.72);
  border-top-color: rgba(0, 0, 0, 0.06);
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.08);
}
/* Tema negro puro */
[data-theme="negro"] .bottom-nav {
  background: rgba(0, 0, 0, 0.75);
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.6);
}
/* Cuando hay tema del chat activo, el bottom-nav toma un tinte
   SUTIL del accent (8%) — refuerza la cohesión visual sin
   competir con el contenido. */
body[data-chat-theme] .bottom-nav {
  background: color-mix(in srgb,
    var(--ws-chat-accent) 8%,
    rgba(15, 23, 42, 0.70)
  );
  border-top-color: color-mix(in srgb,
    var(--ws-chat-accent) 14%,
    rgba(255, 255, 255, 0.06)
  );
  box-shadow:
    0 -4px 30px rgba(0, 0, 0, 0.35),
    0 -1px 0 color-mix(in srgb, var(--ws-chat-accent) 8%, transparent);
}

.bnav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 10px; border-radius: var(--r-sm); flex: 1; max-width: 76px;
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  transition: var(--tr); -webkit-tap-highlight-color: transparent;
  position: relative;
}
.bnav-item:hover  { color: var(--primary); }
.bnav-item.active { color: var(--accent); }
.bnav-item.active::before {
  content: ''; position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 28px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--accent);
  box-shadow: 0 2px 12px rgba(255, 138, 0, 0.45);
}
/* Edgar 2026-06-30: tab activo respeta el accent del chat theme */
body[data-chat-theme] .bnav-item.active { color: var(--ws-chat-accent-light, var(--accent)); }
body[data-chat-theme] .bnav-item.active::before {
  background: var(--ws-chat-accent, var(--accent));
  box-shadow: 0 2px 12px color-mix(in srgb, var(--ws-chat-accent) 50%, transparent);
}
.bnav-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.bnav-icon svg {
  width: 22px; height: 22px; stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ═════════════════════════════════════════════════════════
   CARD PRIMITIVE
═════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card-title {
  font-size: 11px; font-weight: 800; letter-spacing: 0.9px;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 20px;
}

/* ═════════════════════════════════════════════════════════
   BUTTON PRIMITIVES
═════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 700;
  transition: var(--tr); cursor: pointer;
  border: 1px solid transparent;
}
.btn--primary {
  background: var(--accent); color: white;
  box-shadow: var(--shadow-accent);
}
.btn--primary:hover { background: var(--accent-mid); transform: translateY(-1px); }
.btn--ghost {
  background: var(--bg-soft); color: var(--text-soft);
  border-color: var(--border-soft);
}
.btn--ghost:hover { background: var(--bg-main); border-color: var(--border-mid); color: var(--text-main); }

/* ═════════════════════════════════════════════════════════
   RESPONSIVE
═════════════════════════════════════════════════════════ */
@media (max-width: 960px) {
  .header-nav { display: none; }
  .header-hamburger { display: block; }
  .header-inner { padding: 0 16px; grid-template-columns: 1fr auto; gap: 8px; }
  .lang-selector { display: none; }
}

@media (max-width: 768px) {
  :root { --bnav-h: 68px; }
  .bottom-nav { display: flex; }
}

@media (max-width: 500px) {
  .header-inner { padding: 0 14px; }
  .hstat-text   { display: none; }
  .hstat        { padding: 6px 10px; }
}

/* ═════════════════════════════════════════════════════════════════
   USER PILL + DROPDOWN — patron pro (Stripe/Linear/Notion)
   Visible cuando estás logueado, abre menú con tu identidad y acciones.
   ═════════════════════════════════════════════════════════════════ */
/* Respeta el atributo [hidden] aunque el CSS abajo defina display:flex.
   Sin esta regla, los elementos con display:inline-flex/grid se ven aun
   cuando JS les pone hidden=true. */
.user-pill[hidden],
.user-auth-buttons[hidden],
.user-dropdown[hidden] { display: none !important; }

.user-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 5px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--bg-panel);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}
.user-pill:hover {
  border-color: var(--border-mid);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.user-pill[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.user-pill-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--gold, #FFB85C));
  color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
  letter-spacing: -0.02em;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18), 0 2px 4px rgba(0,0,0,0.10);
}
.user-pill-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.user-pill-caret {
  color: var(--text-muted);
  transition: transform 0.18s ease, color 0.15s ease;
}
.user-pill:hover .user-pill-caret { color: var(--text-soft); }
.user-pill[aria-expanded="true"] .user-pill-caret { transform: rotate(180deg); color: var(--accent); }

/* Botones de auth cuando NO está logueado */
.user-auth-buttons { display: inline-flex; align-items: center; gap: 8px; }
/* Edgar 2026-07-03: anti-flash de auth buttons cuando el user ya esta
   logueado. Si el script inline temprano detecta cache de sesion valida,
   agrega .has-cached-auth al <html> - ocultamos auth buttons y mostramos
   el pill antes del primer paint. Sin flash de 'Iniciar sesion' feo. */
html.has-cached-auth #user-auth-buttons { display: none !important; }
html.has-cached-auth #user-pill[hidden] {
  display: inline-flex !important;
  visibility: visible !important;
}
html.has-cached-auth #hstat-fire[hidden],
html.has-cached-auth #hstat-coins[hidden] {
  display: inline-flex !important;
  visibility: visible !important;
}
/* Edgar 2026-06-30: Sign in y Sign up con MISMA ALTURA fija (36px).
   Antes el ghost tenía menos altura que el primary. */
.user-auth-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 16px;
  height: 36px;
  border-radius: 10px;
  font-size: 13.5px; font-weight: 700;
  text-decoration: none;
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1),
              background 0.22s cubic-bezier(0.32, 0.72, 0, 1),
              color 0.22s cubic-bezier(0.32, 0.72, 0, 1),
              border-color 0.22s cubic-bezier(0.32, 0.72, 0, 1),
              box-shadow 0.22s cubic-bezier(0.32, 0.72, 0, 1);
  white-space: nowrap;
  box-sizing: border-box;
}
.user-auth-btn--ghost {
  color: var(--text-soft);
  background: transparent;
  border: 1px solid var(--border-soft);
}
.user-auth-btn--ghost:hover {
  color: var(--text-main);
  border-color: var(--border-mid);
  background: rgba(255, 255, 255, 0.04);
}
.user-auth-btn--primary {
  color: #FFFFFF;
  background: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: 0 2px 10px rgba(255, 138, 0, 0.30);
}
.user-auth-btn--primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 6px 18px rgba(255, 138, 0, 0.42);
}

/* ─── Dropdown ─── */
.user-dropdown {
  position: fixed;
  z-index: 9999;
  width: 280px;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 6px;
  box-shadow:
    0 20px 50px rgba(15,23,42,0.18),
    0 6px 14px rgba(15,23,42,0.08),
    inset 0 1px 0 rgba(255,255,255,0.04);
  animation: user-dropdown-in 0.18s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
[data-theme="dark"] .user-dropdown,
[data-theme="negro"] .user-dropdown {
  box-shadow:
    0 24px 60px rgba(0,0,0,0.55),
    0 4px 12px rgba(0,0,0,0.30),
    inset 0 1px 0 rgba(255,255,255,0.04);
}
@keyframes user-dropdown-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)     scale(1);    }
}

.user-dropdown-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: 10px;
}
.user-dropdown-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--gold, #FFB85C));
  color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.22), 0 4px 10px rgba(0,0,0,0.12);
}
.user-dropdown-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-dropdown-identity { min-width: 0; flex: 1; }
.user-dropdown-name {
  font-size: 14px; font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-dropdown-email {
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.user-dropdown-menu {
  display: flex; flex-direction: column; gap: 1px;
  margin-top: 4px;
  border-top: 1px solid var(--border-soft);
  padding-top: 4px;
}

/* Badge a la derecha de un item (ej: 'FREE', 'PRO', etc.) */
.user-dropdown-badge {
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.user-dropdown-badge--free {
  background: var(--bg-soft);
  color: var(--text-soft);
  border: 1px solid var(--border-soft);
}
.user-dropdown-badge--pro {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(255,138,0,0.30);
}

.user-dropdown-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px; font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  font-family: inherit;
  text-align: left;
}
.user-dropdown-item:hover { background: var(--bg-soft); }
.user-dropdown-item i { font-size: 16px; color: var(--text-soft); flex-shrink: 0; }
.user-dropdown-item:hover i { color: var(--accent); }
.user-dropdown-item span { flex: 1; }
.user-dropdown-item--danger { color: var(--red, #EF4444); }
.user-dropdown-item--danger:hover { background: var(--red-soft, rgba(239,68,68,0.08)); }
.user-dropdown-item--danger i,
.user-dropdown-item--danger:hover i { color: var(--red, #EF4444); }
.user-dropdown-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 4px 8px;
}

/* ───────────────────────────────────────────────
   Con un tema de chat activo, TODO el menú de perfil
   sigue el color del tema: el pill, su avatar, el
   dropdown (borde + glow), la cabecera, los hovers y
   el badge PRO. "Cerrar sesión" se queda rojo por ser
   una acción destructiva.
─────────────────────────────────────────────── */
/* Pill (el botón del avatar en el navbar): fondo y borde con el color del
   tema, misma base oscura que el dropdown para que combinen entre sí. */
body[data-chat-theme] .user-pill {
  background: color-mix(in srgb, var(--ws-chat-accent) 11%, color-mix(in srgb, #000 24%, var(--ws-chat-feed-bg, var(--bg-panel))));
  border-color: color-mix(in srgb, var(--ws-chat-accent) 38%, transparent);
}
body[data-chat-theme] .user-pill:hover {
  border-color: color-mix(in srgb, var(--ws-chat-accent) 60%, transparent);
}
/* Pill: estado abierto + caret */
body[data-chat-theme] .user-pill[aria-expanded="true"] {
  border-color: var(--ws-chat-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ws-chat-accent) 26%, transparent);
}
body[data-chat-theme] .user-pill[aria-expanded="true"] .user-pill-caret {
  color: var(--ws-chat-accent);
}
/* Avatares (pill + dropdown): el degradado usa el color del tema */
body[data-chat-theme] .user-pill-avatar,
body[data-chat-theme] .user-dropdown-avatar {
  background: linear-gradient(135deg, var(--ws-chat-accent), var(--ws-chat-accent-light));
}
/* Caja del dropdown: superficie de menú premium. Sin borde de color
   (eso lo hacía ver como alerta) — superficie tintada con degradado
   sutil + sombra profunda y difusa. El tema se siente en la superficie
   y en un halo ambiental tenue, no en un contorno brillante. */
body[data-chat-theme] .user-dropdown {
  background: color-mix(in srgb, var(--ws-chat-accent) 10%, color-mix(in srgb, #000 23%, var(--ws-chat-feed-bg, var(--bg-panel))));
  border-color: rgba(255,255,255,0.08);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 12px 26px -10px rgba(0,0,0,0.50),
    0 32px 64px -18px rgba(0,0,0,0.62),
    0 24px 56px -30px color-mix(in srgb, var(--ws-chat-accent) 60%, transparent);
}
/* Cabecera con identidad: leve tinte del tema */
body[data-chat-theme] .user-dropdown-head {
  background: color-mix(in srgb, var(--ws-chat-accent) 12%, transparent);
}
/* Items: hover con fondo e ícono del tema */
body[data-chat-theme] .user-dropdown-item:not(.user-dropdown-item--danger):hover {
  background: color-mix(in srgb, var(--ws-chat-accent) 14%, transparent);
}
body[data-chat-theme] .user-dropdown-item:not(.user-dropdown-item--danger):hover i {
  color: var(--ws-chat-accent);
}
/* Separadores con el tinte del tema */
body[data-chat-theme] .user-dropdown-menu { border-top-color: color-mix(in srgb, var(--ws-chat-accent) 32%, transparent); }
body[data-chat-theme] .user-dropdown-divider { background: color-mix(in srgb, var(--ws-chat-accent) 32%, transparent); }
/* Badge PRO: degradado del tema (texto oscuro para contraste sobre pasteles) */
body[data-chat-theme] .user-dropdown-badge--pro {
  background: linear-gradient(135deg, var(--ws-chat-accent), var(--ws-chat-accent-light));
  color: #1A1206;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--ws-chat-accent) 40%, transparent);
}

/* Responsive — en mobile el pill ocupa solo avatar */
@media (max-width: 640px) {
  .user-pill-caret { display: none; }
  .user-auth-btn { padding: 7px 10px; font-size: 12.5px; }
  .user-dropdown { width: 250px; }
}

/* ═════════════════════════════════════════════════════════════
   THEME PICKER POPOVER — diseño pro tipo Linear/Notion (Compartido)
   ═════════════════════════════════════════════════════════════ */
.sys-themes-popover {
  position: fixed;
  z-index: 9999;
  width: 200px;
  background: var(--bg-panel) !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: 13px;
  padding: 11px;
  box-shadow: var(--shadow-xl) !important;
  display: none;
  transform-origin: bottom center;
}
/* Vidrio esmerilado: translúcido + blur fuerte, con un filo superior que
   atrapa la luz (inset highlight) para que flote sobre el fondo. */
@supports (backdrop-filter: blur(10px)) {
  .sys-themes-popover {
    background: rgba(255, 255, 255, 0.72) !important;
    backdrop-filter: blur(26px) saturate(1.8);
    -webkit-backdrop-filter: blur(26px) saturate(1.8);
    border: 1px solid rgba(0, 0, 0, 0.07) !important;
    box-shadow:
      0 18px 44px -14px rgba(0,0,0,0.30),
      0 5px 14px -8px rgba(0,0,0,0.22),
      inset 0 1px 0 rgba(255,255,255,0.55) !important;
  }
  [data-theme="dark"] .sys-themes-popover {
    background: rgba(17, 24, 39, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
    box-shadow:
      0 20px 48px -16px rgba(0,0,0,0.78),
      0 6px 16px -10px rgba(0,0,0,0.55),
      inset 0 1px 0 rgba(255,255,255,0.07) !important;
  }
}
/* Despliegue al abrir y bajada al cerrar — mismo carácter que el menú
   de perfil (.user-dropdown): easing con leve overshoot.
   La animación se dispara recién cuando el JS añade .is-positioned
   (ya calculado su lugar) — así el despliegue completo se ve en
   pantalla y no arranca a medias fuera de vista. */
.sys-themes-popover.open { display: block; }
.sys-themes-popover.open.is-positioned {
  animation: sys-themes-pop 0.26s cubic-bezier(0.18, 0.89, 0.32, 1.28) both;
}
.sys-themes-popover.closing {
  display: block;
  animation: sys-themes-pop-out 0.15s ease both;
  pointer-events: none;
}
@keyframes sys-themes-pop {
  from { opacity: 0; transform: translateY(16px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0)   scale(1);   }
}
@keyframes sys-themes-pop-out {
  from { opacity: 1; transform: translateY(0)    scale(1);    }
  to   { opacity: 0; transform: translateY(12px) scale(0.94); }
}

/* Título de cada sección — diminuto, espaciado, sutil */
.sys-themes-section-title {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted) !important;
  opacity: 0.8;
  margin: 0 3px 6px;
}

/* Con un tema de chat activo, el propio popover de temas se tiñe con
   el color del tema — borde, títulos de sección y el anillo del color
   seleccionado siguen el acento del tema. */
/* El fondo del popover usa el MISMO color del tema (la base oscura del
   feed del chat), realzado con algo de acento — así combina con el tema,
   no se ve gris. */
/* Superficie de menú premium: NO un borde de color (eso lo hace ver
   como alerta) sino una superficie tintada con degradado sutil y una
   sombra profunda y difusa. El tema se siente en el color de la
   superficie y en un halo ambiental tenue, no en un contorno. */
[data-chat-theme] .sys-themes-popover {
  background: color-mix(in srgb, var(--ws-chat-accent) 11%, color-mix(in srgb, #000 25%, var(--ws-chat-feed-bg))) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-color: rgba(255,255,255,0.08) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 10px 22px -10px rgba(0,0,0,0.55),
    0 28px 56px -18px rgba(0,0,0,0.70),
    0 22px 52px -28px color-mix(in srgb, var(--ws-chat-accent) 55%, transparent) !important;
}
[data-chat-theme] .sys-themes-section-title {
  color: color-mix(in srgb, var(--ws-chat-accent-light) 58%, #7b8694) !important;
}
[data-chat-theme] .sys-themes-section + .sys-themes-section {
  border-top-color: color-mix(in srgb, var(--ws-chat-accent) 26%, transparent) !important;
}
[data-chat-theme] .sys-themes-section:first-of-type .sys-themes-option {
  background: color-mix(in srgb, var(--ws-chat-accent) 9%, rgba(255,255,255,0.025)) !important;
  border-color: color-mix(in srgb, var(--ws-chat-accent) 22%, transparent) !important;
}
[data-chat-theme] .sys-themes-section:first-of-type .sys-themes-option:hover {
  background: color-mix(in srgb, var(--ws-chat-accent) 16%, rgba(255,255,255,0.04)) !important;
  border-color: color-mix(in srgb, var(--ws-chat-accent) 40%, transparent) !important;
}
[data-chat-theme] .sys-themes-color-tile.is-active {
  box-shadow: 0 0 0 2px var(--bg-panel), 0 0 0 4px var(--ws-chat-accent) !important;
}
.sys-themes-section + .sys-themes-section {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--border-soft) !important;
}

.sys-themes-list {
  display: flex; flex-direction: column;
  gap: 4px;
}
/* Ladeado side-by-side para el primer grupo (Oscuro/Blanco) */
.sys-themes-section:first-of-type .sys-themes-list {
  flex-direction: row;
  gap: 6px;
}
.sys-themes-section:first-of-type .sys-themes-option {
  flex: 1;
  justify-content: center;
  padding: 6px 7px;
  font-size: 10.5px;
  gap: 6px;
  border-radius: 8px;
  background: var(--bg-soft) !important;
  border: 1px solid var(--border-soft) !important;
}
.sys-themes-section:first-of-type .sys-themes-option:hover {
  background: var(--bg-elevated) !important;
  border-color: var(--border-mid) !important;
  transform: translateY(-1px);
}

.sys-themes-option {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-main) !important;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
}
.sys-themes-option:hover {
  background: var(--bg-soft) !important;
  color: var(--text-main) !important;
}
.sys-themes-option.is-active {
  background: var(--primary-soft) !important;
  border-color: var(--primary-glow) !important;
  color: var(--primary-dark) !important;
}
[data-theme="dark"] .sys-themes-option.is-active {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #FFFFFF !important;
}
/* Con tema de chat activo, la opción seleccionada toma el acento del tema */
[data-chat-theme] .sys-themes-option.is-active {
  background: color-mix(in srgb, var(--ws-chat-accent) 16%, transparent) !important;
  border-color: var(--ws-chat-accent) !important;
  color: var(--text-main) !important;
}
[data-chat-theme] .sys-themes-option.is-active .sys-themes-option-check {
  color: var(--ws-chat-accent) !important;
}
.sys-themes-option-swatch {
  width: 13px; height: 13px;
  border-radius: 50% !important;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16);
}
.sys-themes-option-label {
  flex: 0 1 auto;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: 0.01em;
}
.sys-themes-option-check {
  display: flex; align-items: center; justify-content: center;
  width: 12px; height: 12px;
  color: var(--text-main) !important;
  flex-shrink: 0;
}
.sys-themes-option-check svg { width: 11px; height: 11px; }

/* ─── Cuadrícula de colores 5×2 (compacta, tiles planos) ─── */
.sys-themes-color-grid {
  display: grid;
  grid-template-columns: repeat(5, 26px);
  gap: 7px;
  justify-content: center;
  padding: 2px 0 1px;
}
/* Tiles planos — círculos de color simples, sin volumen ni destellos. */
.sys-themes-color-tile {
  width: 26px;
  height: 26px;
  border-radius: 50% !important;
  border: 0 !important;
  cursor: pointer;
  padding: 0;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
  box-shadow: none !important;
}
.sys-themes-color-tile:hover {
  transform: scale(1.12) !important;
}
.sys-themes-color-tile.is-active {
  transform: scale(1.06) !important;
  box-shadow: 0 0 0 2px var(--bg-panel), 0 0 0 4px var(--tile-color) !important;
}
.sys-themes-color-tile svg {
  position: relative;
  width: 10px; height: 10px;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.45));
}


/* Edgar 2026-07-06: en desktop ocultamos el item "Mi cuenta" del dropdown.
   Configuracion ya lleva a lo mismo (profile.html) y evita redundancia. */
@media (min-width: 961px) {
  .user-dropdown .user-dropdown-item--my-account { display: none !important; }
}

/* Edgar 2026-07-06: en desktop, si el user ya esta en profile.html,
   ocultamos su avatar del header (redundante — ya esta viendo su cuenta). */
@media (min-width: 961px) {
  body.prof-page #user-pill { display: none !important; }
}
