/* ===================== PREMIUM POLISH ===================== */

@keyframes premiumShine {
  from { transform: translateX(-100%) skewX(-12deg); }
  to   { transform: translateX(200%) skewX(-12deg); }
}

@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.5; }
  33%      { transform: translate(8%, -6%) scale(1.05); opacity: 0.7; }
  66%      { transform: translate(-5%, 4%) scale(0.98); opacity: 0.5; }
}

@keyframes floatOrbSlow {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(-10%, 8%); }
}

/* ── Navbar: glass + scroll shadow ── */
.navbar {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: box-shadow var(--duration-normal) var(--ease-out-expo),
              background-color var(--duration-normal) ease;
}

body[data-theme="dark"] .navbar {
  background: rgba(5, 8, 11, 0.85);
}

body[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.85);
}

.navbar.navbar-scrolled {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

body[data-theme="light"] .navbar.navbar-scrolled {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* ── Premium CTA (hero + about): shine sweep, lift, shadow ── */
.hero-cta,
.cta-button {
  position: relative;
  overflow: hidden;
  transition: transform var(--duration-normal) var(--ease-out-expo),
              box-shadow var(--duration-normal) var(--ease-out-expo),
              border-color var(--duration-fast) ease;
}

.hero-cta::after,
.cta-button::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.15) 45%,
    rgba(255, 255, 255, 0.25) 50%,
    rgba(255, 255, 255, 0.15) 55%,
    transparent 100%
  );
  transform: translateX(-100%) skewX(-12deg);
  pointer-events: none;
}

.hero-cta:hover,
.cta-button:hover {
  transform: translateY(-2px);
}

body[data-theme="dark"] .hero-cta:hover {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

body[data-theme="light"] .hero-cta:hover {
  box-shadow: 0 12px 32px rgba(17, 24, 39, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.cta-button:hover {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

body[data-theme="light"] .cta-button:hover {
  box-shadow: 0 12px 32px rgba(17, 24, 39, 0.18);
}

.hero-cta:hover::after,
.cta-button:hover::after {
  animation: premiumShine 0.7s var(--ease-out-expo) forwards;
}

.hero-cta:active,
.cta-button:active {
  transform: scale(0.97);
  transition-duration: 0.1s;
}

/* ── Primary buttons (login, auth, submit) ── */
.login-btn,
.auth-submit,
.contact-submit,
.pp-save-btn,
.pp-lo-btn {
  transition: transform var(--duration-fast) var(--ease-out-expo),
              box-shadow var(--duration-normal) var(--ease-out-expo),
              filter var(--duration-fast) ease;
}

.login-btn:hover,
.auth-submit:hover,
.contact-submit:hover,
.pp-save-btn:hover,
.pp-lo-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.4);
}

.login-btn:active,
.auth-submit:active,
.contact-submit:active,
.pp-save-btn:active,
.pp-lo-btn:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.auth-submit:hover { box-shadow: 0 12px 28px rgba(16, 185, 129, 0.35); }
.contact-submit:hover { box-shadow: 0 12px 28px rgba(16, 185, 129, 0.35); }
.pp-save-btn:hover,
.pp-lo-btn:hover { box-shadow: 0 12px 28px rgba(16, 185, 129, 0.3); }

/* ── Value cards: hover lift + border glow ── */
.about-section .value-card {
  transition: transform var(--duration-normal) var(--ease-out-expo),
              box-shadow var(--duration-normal) var(--ease-out-expo),
              border-color var(--duration-normal) ease;
}

body[data-theme="dark"] .about-section .value-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.2);
}

body[data-theme="light"] .about-section .value-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.25);
}

/* ── Auth / profile / login cards: subtle hover depth ── */
.auth-card,
.light-login-card,
.profile-card {
  transition: transform var(--duration-slow) var(--ease-out-expo),
              box-shadow var(--duration-slow) var(--ease-out-expo);
}

.auth-card:hover,
.light-login-card:hover,
.profile-card:hover {
  transform: translateY(-2px);
}

body[data-theme="dark"] .auth-card:hover,
body[data-theme="dark"] .light-login-card:hover,
body[data-theme="dark"] .profile-card:hover {
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
}

body[data-theme="light"] .auth-card:hover,
body[data-theme="light"] .light-login-card:hover,
body[data-theme="light"] .profile-card:hover {
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* ── Hero eyebrow: subtle scale on hover ── */
.hero-eyebrow {
  transition: transform var(--duration-fast) var(--ease-out-expo),
              box-shadow var(--duration-fast) ease;
}

.hero-eyebrow:hover {
  transform: scale(1.02);
}

body[data-theme="dark"] .hero-eyebrow:hover {
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.25);
}

/* ── Nav & menu links: animated underline ── */
.nav-links a,
.subtle-link,
.menu-dropdown a {
  position: relative;
}

.nav-links a::after,
.subtle-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width var(--duration-normal) var(--ease-out-expo);
}

.nav-links a:hover::after,
.subtle-link:hover::after {
  width: 100%;
}

/* ── Focus visible: premium ring (exclude chat input bar — no green there) ── */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-main-dark), 0 0 0 4px rgba(16, 185, 129, 0.5);
}

body[data-theme="light"] :focus-visible {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(16, 185, 129, 0.45);
}

/* No focus ring on chat input bar / textarea (per user: no green on input) */
.free-input-bar:focus-within,
.free-input-bar textarea:focus,
.free-input-bar textarea:focus-visible,
.input-textarea-row textarea:focus,
.input-textarea-row textarea:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
}

/* ── Inputs: smoother focus glow ── */
.login-field input:focus,
.auth-field input:focus,
.auth-field select:focus,
.form-field input:focus,
.form-field textarea:focus,
.pw-field:focus-within {
  transition: border-color var(--duration-normal) ease,
              box-shadow var(--duration-normal) var(--ease-out-expo);
}

/* ── Menu dropdown: refined shadow & transition ── */
.menu-dropdown {
  transition: opacity 0.18s var(--ease-out-expo),
              transform 0.18s var(--ease-out-expo);
}

body[data-theme="dark"] .menu-dropdown.open {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

body[data-theme="light"] .menu-dropdown.open {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* ── Footer: subtle top gradient line ── */
.about-footer {
  position: relative;
  transition: opacity var(--duration-slow) ease;
}

.about-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  max-width: 400px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(16, 185, 129, 0.2) 20%,
    rgba(16, 185, 129, 0.35) 50%,
    rgba(16, 185, 129, 0.2) 80%,
    transparent 100%
  );
  opacity: 0.8;
}

body[data-theme="light"] .about-footer::before {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(16, 185, 129, 0.15) 20%,
    rgba(16, 185, 129, 0.3) 50%,
    rgba(16, 185, 129, 0.15) 80%,
    transparent 100%
  );
}

/* ── Hero orbs wrapper (no entrance animation) ── */
.home-hero,
.about-hero,
.founder-hero,
.help-hero {
  position: relative;
}

.hero-orbs-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.hero-animate .hero-orbs-wrap {
  opacity: 1;
  animation: none;
}

/* ── Floating orbs (hero background depth) ── */
.hero-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(70px);
  animation: floatOrb 22s ease-in-out infinite;
}

.hero-orb-1 {
  width: 320px;
  height: 320px;
  top: 15%;
  left: 5%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, transparent 70%);
  animation-delay: 0s;
}

.hero-orb-2 {
  width: 280px;
  height: 280px;
  top: 60%;
  right: 8%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, transparent 70%);
  animation-delay: -8s;
  animation-duration: 28s;
}

.hero-orb-3 {
  width: 200px;
  height: 200px;
  bottom: 20%;
  left: 15%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.05) 0%, transparent 70%);
  animation-delay: -14s;
  animation-duration: 25s;
}

body[data-theme="light"] .hero-orb-1 {
  background: radial-gradient(circle, rgba(16, 185, 129, 0.06) 0%, transparent 70%);
}

body[data-theme="light"] .hero-orb-2 {
  background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
}

body[data-theme="light"] .hero-orb-3 {
  background: radial-gradient(circle, rgba(16, 185, 129, 0.04) 0%, transparent 70%);
}

/* ── AI controls bar (dashboard): premium hover ── */
.ai-controls {
  transition: box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body[data-theme="dark"] .ai-controls:hover {
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.06), 0 0 0 1px rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.15);
}

body[data-theme="light"] .ai-controls:hover {
  box-shadow: 0 8px 24px rgba(29, 78, 216, 0.05), 0 0 0 1px rgba(29, 78, 216, 0.08);
  border-color: rgba(29, 78, 216, 0.12);
}

/* ── Send button (dashboard) ── */
.tb-send:hover {
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.45) !important;
}

/* ── Profile trigger: subtle pulse on hover ── */
.profile-trigger {
  transition: transform var(--duration-fast) var(--ease-out-expo),
              box-shadow var(--duration-normal) var(--ease-out-expo);
}

.profile-trigger:hover {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

/* ===================== PREMIUM UI ELEMENTS ===================== */

/* ── Chat empty state (dashboard) ── */
/* ── Empty state keyframes ── */
@keyframes emptyFadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes emptyIconEntry {
  0%   { opacity: 0; transform: scale(0.6) translateY(10px); }
  60%  { opacity: 1; transform: scale(1.08) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes emptyFloat {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  30%      { transform: translateY(-7px) rotate(-2deg); }
  70%      { transform: translateY(-4px) rotate(2deg); }
}

@keyframes emptyGlowDark {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(0,210,255,0.6)); }
  50%       { filter: drop-shadow(0 0 20px rgba(0,210,255,1)) drop-shadow(0 0 50px rgba(0,180,255,0.85)) drop-shadow(0 0 90px rgba(0,150,255,0.5)); }
}

@keyframes emptyGlowLight {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(0,0,0,0.18)); }
  50%       { filter: drop-shadow(0 0 18px rgba(0,0,0,0.38)) drop-shadow(0 0 40px rgba(0,0,0,0.18)); }
}

@keyframes emptyHintFade {
  0%   { opacity: 0; transform: translateY(8px); }
  100% { opacity: 0.45; transform: translateY(0); }
}

@keyframes emptyShimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* Container */
.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding: 48px 24px;
  text-align: center;
}

/* All children hidden until .ready is added (after greeting text is set) */
.chat-empty-greeting,
.chat-empty-icon,
.chat-empty-title,
.chat-empty-hint {
  opacity: 0;
}

/* .ready fires the staggered sequence — greeting first, then rest cascade */
.chat-empty-state.ready .chat-empty-greeting {
  animation: emptyFadeUp 0.6s cubic-bezier(0.22,1,0.36,1) 0s forwards;
}
body[data-theme="dark"] .chat-empty-state.ready .chat-empty-icon {
  animation:
    emptyIconEntry 0.7s cubic-bezier(0.34,1.56,0.64,1) 0.25s forwards,
    emptyFloat     4.5s ease-in-out                     1.2s  infinite,
    emptyGlowDark  3s   ease-in-out                     1.8s  infinite;
}
body[data-theme="light"] .chat-empty-state.ready .chat-empty-icon {
  animation:
    emptyIconEntry 0.7s cubic-bezier(0.34,1.56,0.64,1) 0.25s forwards,
    emptyFloat     4.5s ease-in-out                     1.2s  infinite,
    emptyGlowLight 3s   ease-in-out                     1.8s  infinite;
}
.chat-empty-state.ready .chat-empty-title {
  animation: emptyFadeUp 0.6s cubic-bezier(0.22,1,0.36,1) 0.45s forwards;
}
.chat-empty-state.ready .chat-empty-hint {
  animation: emptyHintFade 0.7s cubic-bezier(0.22,1,0.36,1) 0.65s forwards;
}

/* Greeting */
.chat-empty-greeting {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}
body[data-theme="dark"]  .chat-empty-greeting { color: #e5e7eb; }
body[data-theme="light"] .chat-empty-greeting { color: #111827; }

/* Icon */
.chat-empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

/* Title */
.chat-empty-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}
body[data-theme="dark"]  .chat-empty-title { color: #e5e7eb; }
body[data-theme="light"] .chat-empty-title { color: #111827; }

/* Hint */
.chat-empty-hint {
  font-size: 0.88rem;
  max-width: 260px;
  line-height: 1.5;
}
body[data-theme="dark"]  .chat-empty-hint { color: #9ca3af; }
body[data-theme="light"] .chat-empty-hint { color: #6b7280; }

/* ── Profile panel: stat cards stagger on open ── */
.profile-panel .pp-stat-card {
  opacity: 0;
}

.profile-panel.open .pp-stat-card {
  animation: ppStatReveal 0.5s var(--ease-out-expo) forwards;
}

.profile-panel.open .pp-stat-card:nth-child(1) { animation-delay: 0.05s; }
.profile-panel.open .pp-stat-card:nth-child(2) { animation-delay: 0.1s; }
.profile-panel.open .pp-stat-card:nth-child(3) { animation-delay: 0.15s; }
.profile-panel.open .pp-stat-card:nth-child(4) { animation-delay: 0.2s; }

@keyframes ppStatReveal {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pp-stat-card {
  transition: transform var(--duration-normal) var(--ease-out-expo),
              box-shadow var(--duration-normal) var(--ease-out-expo);
}

body[data-theme="dark"] .pp-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

body[data-theme="light"] .pp-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

/* ── Message bubbles: fast entrance (fires on every answer, keep ≤150ms) ── */
.message-bubble {
  animation: messageBubbleIn 0.15s var(--ease-out-expo) forwards;
}

@keyframes messageBubbleIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Input bar: no focus glow (per user preference) ── */
.free-input-bar {
  transition: box-shadow var(--duration-normal) var(--ease-out-expo),
              border-color var(--duration-normal) ease;
}

/* ── AI control labels: subtle focus ── */
.ai-control:focus-within label {
  color: #10b981;
}

body[data-theme="dark"] .ai-control:focus-within label {
  color: #10b981;
}

body[data-theme="light"] .ai-control:focus-within label {
  color: #059669;
}

.ai-control label {
  transition: color var(--duration-fast) ease;
}

/* ── Upload/model options: hover polish ── */
.mdp-option,
.upload-option {
  transition: transform var(--duration-fast) var(--ease-out-expo),
              background var(--duration-fast) ease;
}

.mdp-option:hover,
.upload-option:hover {
  transform: translateX(4px);
}

/* ── Session indicator (dashboard) ── */
.session-indicator {
  display: none; /* hidden: no content under input bar */
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.4;
  margin-bottom: 8px;
}

.session-indicator::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  animation: sessionPulse 2s ease-in-out infinite;
}

@keyframes sessionPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(1.2); }
}
/* ═══════════════════════════════════════════════════════════════
   CHAT HISTORY PANEL
═══════════════════════════════════════════════════════════════ */

/* ── Nav buttons ── */
.history-nav-btn,
.new-chat-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.55;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  transition: opacity 0.15s, background 0.15s;
  flex-shrink: 0;
}
.history-nav-btn svg,
.new-chat-nav-btn svg {
  width: 15px;
  height: 15px;
}
.history-nav-btn:hover,
.new-chat-nav-btn:hover { opacity: 1; }
body[data-theme="dark"]  .history-nav-btn:hover,
body[data-theme="dark"]  .new-chat-nav-btn:hover { background: rgba(255,255,255,0.07); }
body[data-theme="light"] .history-nav-btn:hover,
body[data-theme="light"] .new-chat-nav-btn:hover { background: rgba(0,0,0,0.06); }

/* ── Overlay — dims the chat behind the panel ── */
.history-overlay {
  display: none;
  position: fixed; inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,0);
  transition: background 0.28s ease;
}
.history-overlay.open {
  display: block;
  background: rgba(0,0,0,0.35);
}

/* ── Panel — slides in from left over the chat ── */
.history-panel {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 320px; max-width: 85vw;
  z-index: 9001;
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s ease;
  overflow-y: auto;
  will-change: transform;
}
body[data-theme="dark"]  .history-panel {
  background: #0d1117;
  border-right: 1px solid rgba(255,255,255,0.07);
}
body[data-theme="light"] .history-panel {
  background: #ffffff;
  border-right: 1px solid rgba(0,0,0,0.08);
}
.history-panel.open {
  transform: translateX(0);
  box-shadow: 8px 0 40px rgba(0,0,0,0.28);
}

/* ── Header ── */
.hp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid;
  flex-shrink: 0;
}
body[data-theme="dark"]  .hp-header { border-color: rgba(255,255,255,0.06); }
body[data-theme="light"] .hp-header { border-color: rgba(0,0,0,0.06); }
.hp-header h2 {
  font-size: 0.95rem; font-weight: 700;
  letter-spacing: -0.01em;
}
.hp-close {
  background: none; border: none; cursor: pointer;
  font-size: 1rem; opacity: 0.45; color: inherit;
  width: 30px; height: 30px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.15s, background 0.15s;
}
.hp-close:hover { opacity: 1; }
body[data-theme="dark"]  .hp-close:hover { background: rgba(255,255,255,0.08); }
body[data-theme="light"] .hp-close:hover { background: rgba(0,0,0,0.06); }

/* ── Search ── */
.hp-search-wrap { padding: 10px 12px 6px; flex-shrink: 0; }
.hp-search {
  width: 100%; padding: 8px 12px;
  border-radius: 8px; font-size: 0.84rem; font-family: inherit;
  outline: none; border: 1px solid;
  transition: border-color 0.15s;
}
body[data-theme="dark"]  .hp-search {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.1);
  color: #e5e7eb;
}
body[data-theme="light"] .hp-search {
  background: #f3f4f6;
  border-color: rgba(0,0,0,0.1);
  color: #111827;
}
body[data-theme="dark"]  .hp-search:focus { border-color: rgba(255,255,255,0.25); }
body[data-theme="light"] .hp-search:focus { border-color: rgba(0,0,0,0.25); }
.hp-search::placeholder { opacity: 0.35; }

/* ── Filters ── */
.hp-filters {
  display: flex;
  gap: 6px;
  padding: 0 16px 12px;
  flex-wrap: nowrap;
  overflow-x: visible;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: relative;
  z-index: 100;
}

.hp-filters::-webkit-scrollbar {
  display: none;
}

/* ── Custom Dropdown for History Filters ── */
.hp-custom-dropdown {
  position: relative;
  flex: 0 0 auto;
  z-index: 101;
}

.hp-custom-dropdown.open {
  z-index: 9999;
}

.hp-custom-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 8px 0 10px;
  border-radius: 14px;
  border: 1px solid;
  font-size: 0.72rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

body[data-theme="dark"] .hp-custom-dropdown-trigger {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #e5e7eb;
}

body[data-theme="light"] .hp-custom-dropdown-trigger {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #374151;
}

body[data-theme="dark"] .hp-custom-dropdown-trigger:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

body[data-theme="light"] .hp-custom-dropdown-trigger:hover {
  border-color: #d1d5db;
  background: #f3f4f6;
}

.hp-custom-dropdown.open .hp-custom-dropdown-trigger {
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

body[data-theme="light"] .hp-custom-dropdown.open .hp-custom-dropdown-trigger {
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

.hp-dropdown-text {
  flex: 1;
}

.hp-dropdown-chevron {
  flex-shrink: 0;
  opacity: 0.5;
  transition: transform 0.25s ease;
}

.hp-custom-dropdown.open .hp-dropdown-chevron {
  transform: rotate(180deg);
  opacity: 0.8;
}

.hp-custom-dropdown-menu {
  position: absolute;
  min-width: 140px;
  max-height: 240px;
  overflow-y: auto;
  border-radius: 12px;
  border: 1px solid;
  padding: 4px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top left;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.hp-custom-dropdown-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

body[data-theme="dark"] .hp-custom-dropdown-menu {
  background: #1f2937;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body[data-theme="light"] .hp-custom-dropdown-menu {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.hp-custom-dropdown-menu::-webkit-scrollbar {
  width: 4px;
}

.hp-custom-dropdown-menu::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.3);
  border-radius: 4px;
}

.hp-custom-dropdown-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

body[data-theme="dark"] .hp-custom-dropdown-option {
  color: #d1d5db;
}

body[data-theme="light"] .hp-custom-dropdown-option {
  color: #374151;
}

body[data-theme="dark"] .hp-custom-dropdown-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

body[data-theme="light"] .hp-custom-dropdown-option:hover {
  background: #f3f4f6;
}

.hp-custom-dropdown-option.selected {
  color: #10b981;
}

body[data-theme="dark"] .hp-custom-dropdown-option.selected {
  background: rgba(16, 185, 129, 0.1);
}

body[data-theme="light"] .hp-custom-dropdown-option.selected {
  background: rgba(16, 185, 129, 0.08);
}

.hp-dropdown-check {
  opacity: 0;
  color: #10b981;
  transition: opacity 0.15s ease;
}

.hp-custom-dropdown-option.selected .hp-dropdown-check {
  opacity: 1;
}

/* Hide native select */
.hp-filter {
  display: none;
}

/* ── Custom Date Range ── */
.hp-date-range {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  margin: 0 12px 10px;
  border-radius: 10px;
}

body[data-theme="dark"] .hp-date-range {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

body[data-theme="light"] .hp-date-range {
  background: #f9fafb;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.hp-date-inputs {
  display: flex;
  gap: 10px;
}

.hp-date-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hp-date-field label {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

body[data-theme="dark"] .hp-date-field label {
  color: #9ca3af;
}

body[data-theme="light"] .hp-date-field label {
  color: #6b7280;
}

.hp-date-field input[type="date"] {
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid;
  font-size: 0.75rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

body[data-theme="dark"] .hp-date-field input[type="date"] {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #e5e7eb;
  color-scheme: dark;
}

body[data-theme="light"] .hp-date-field input[type="date"] {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #374151;
}

body[data-theme="dark"] .hp-date-field input[type="date"]:focus {
  border-color: #10b981;
}

body[data-theme="light"] .hp-date-field input[type="date"]:focus {
  border-color: #10b981;
}

.hp-date-apply {
  height: 32px;
  padding: 0 16px;
  border-radius: 8px;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  background: #10b981;
  color: #ffffff;
}

.hp-date-apply:hover {
  background: #059669;
}

/* Active filters indicator */
.hp-active-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px 10px;
  font-size: 0.75rem;
}

.hp-filter-count {
  font-weight: 500;
}

body[data-theme="dark"] .hp-filter-count {
  color: #10b981;
}

body[data-theme="light"] .hp-filter-count {
  color: #059669;
}

.hp-clear-filters {
  background: none;
  border: none;
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

body[data-theme="dark"] .hp-clear-filters {
  color: #9ca3af;
}

body[data-theme="light"] .hp-clear-filters {
  color: #6b7280;
}

body[data-theme="dark"] .hp-clear-filters:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f3f4f6;
}

body[data-theme="light"] .hp-clear-filters:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #111827;
}

/* ── List ── */
.hp-list {
  flex: 1; overflow-y: auto;
  padding: 4px 0 8px;
  overscroll-behavior: contain;
  position: relative;
  z-index: 1;
}
.hp-list::-webkit-scrollbar { width: 3px; }
body[data-theme="dark"]  .hp-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
body[data-theme="light"] .hp-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 2px; }

.hp-group { margin-bottom: 2px; }
.hp-group-label {
  font-size: 0.66rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 10px 16px 4px;
  opacity: 0.28;
}

/* ── Item ── */
.hp-item {
  display: flex; align-items: center; gap: 0;
  padding: 1px 8px 1px 0;
  position: relative;
}
.hp-item-main {
  flex: 1; min-width: 0;
  padding: 9px 8px 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  /* Prevent text overflow */
  overflow: hidden;
}
body[data-theme="dark"]  .hp-item-main:hover { background: rgba(255,255,255,0.05); }
body[data-theme="light"] .hp-item-main:hover { background: rgba(0,0,0,0.04); }

/* Active / currently loaded session */
.hp-item.active .hp-item-main {
  border-radius: 8px;
}
body[data-theme="dark"]  .hp-item.active .hp-item-main { background: rgba(255,255,255,0.07); }
body[data-theme="light"] .hp-item.active .hp-item-main { background: rgba(0,0,0,0.06); }

.hp-item-title {
  font-size: 0.82rem; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 2px;
  line-height: 1.4;
}
.hp-item-preview {
  font-size: 0.73rem; opacity: 0.42;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 3px;
}
.hp-item-meta {
  display: flex; gap: 4px; flex-wrap: wrap;
  font-size: 0.68rem; opacity: 0.35;
  line-height: 1.3;
}

/* ── Three-dot menu button ── */
.hp-item-menu-wrap {
  position: relative;
  flex-shrink: 0;
}
.hp-item-menu-btn {
  background: none; border: none; cursor: pointer;
  color: inherit; opacity: 0.4;
  width: 30px; height: 30px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.2s ease, background 0.2s ease, transform 0.15s ease;
  margin-right: 2px;
}
.hp-item-menu-btn:hover { opacity: 0.7; }
.hp-item-menu-btn:active { transform: scale(0.92); }
body[data-theme="dark"]  .hp-item-menu-btn:hover { background: rgba(255,255,255,0.08); }
body[data-theme="light"] .hp-item-menu-btn:hover { background: rgba(0,0,0,0.06); }

/* ── Dropdown menu with smooth animation ── */
.hp-item-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 100;
  min-width: 185px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1);
  /* Animation properties */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top right;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s ease;
  pointer-events: none;
}
body[data-theme="dark"] .hp-item-dropdown {
  background: #1a1f26;
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.2);
}
body[data-theme="light"] .hp-item-dropdown {
  background: #ffffff;
  border-color: rgba(0,0,0,0.08);
}
.hp-item-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Dropdown date info ── */
.hp-dropdown-date {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 0.6;
}
.hp-dropdown-date svg {
  opacity: 0.7;
  flex-shrink: 0;
}

.hp-dropdown-divider {
  height: 1px;
  margin: 4px 8px;
}
body[data-theme="dark"] .hp-dropdown-divider {
  background: rgba(255,255,255,0.08);
}
body[data-theme="light"] .hp-dropdown-divider {
  background: rgba(0,0,0,0.08);
}

/* ── Dropdown option (rename, export) ── */
.hp-dropdown-option {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  background: transparent;
  text-align: left;
}
body[data-theme="dark"] .hp-dropdown-option {
  color: #d1d5db;
}
body[data-theme="light"] .hp-dropdown-option {
  color: #4b5563;
}
body[data-theme="dark"] .hp-dropdown-option:hover {
  background: rgba(255,255,255,0.08);
  color: #f3f4f6;
}
body[data-theme="light"] .hp-dropdown-option:hover {
  background: rgba(0,0,0,0.05);
  color: #111827;
}
.hp-dropdown-option:active {
  transform: scale(0.98);
}
.hp-dropdown-option svg {
  flex-shrink: 0;
  opacity: 0.6;
}
.hp-dropdown-option:hover svg {
  opacity: 1;
}

/* ── Delete option with red styling ── */
.hp-delete-option {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  background: transparent;
  text-align: left;
}
body[data-theme="dark"] .hp-delete-option {
  color: #f87171;
}
body[data-theme="light"] .hp-delete-option {
  color: #dc2626;
}
body[data-theme="dark"] .hp-delete-option:hover {
  background: rgba(239,68,68,0.15);
}
body[data-theme="light"] .hp-delete-option:hover {
  background: rgba(239,68,68,0.08);
}
.hp-delete-option:active {
  transform: scale(0.98);
}
.hp-delete-option svg {
  flex-shrink: 0;
  opacity: 0.8;
}
.hp-delete-option:hover svg {
  opacity: 1;
}

/* ── Rename Modal ── */
.hp-rename-modal {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 10;
}
body[data-theme="dark"] .hp-rename-modal {
  background: rgba(0,0,0,0.8);
}
body[data-theme="light"] .hp-rename-modal {
  background: rgba(0,0,0,0.5);
}
.hp-rename-modal.open {
  opacity: 1;
  visibility: visible;
}
.hp-rename-box {
  padding: 24px;
  border-radius: 16px;
  width: 100%;
  max-width: 300px;
  transform: scale(0.9);
  transition: transform 0.2s ease;
}
.hp-rename-modal.open .hp-rename-box {
  transform: scale(1);
}
body[data-theme="dark"] .hp-rename-box {
  background: #1f2937;
  border: 1px solid rgba(255,255,255,0.1);
}
body[data-theme="light"] .hp-rename-box {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}
.hp-rename-box h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
}
body[data-theme="dark"] .hp-rename-box h3 {
  color: #f3f4f6;
}
body[data-theme="light"] .hp-rename-box h3 {
  color: #111827;
}
.hp-rename-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid;
  font-size: 0.9rem;
  font-family: inherit;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
body[data-theme="dark"] .hp-rename-input {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.15);
  color: #f3f4f6;
}
body[data-theme="light"] .hp-rename-input {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #111827;
}
.hp-rename-input:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}
.hp-rename-buttons {
  display: flex;
  gap: 10px;
}
.hp-rename-buttons button {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid;
}
.hp-rename-cancel {
  background: transparent;
}
body[data-theme="dark"] .hp-rename-cancel {
  color: #d1d5db;
  border-color: rgba(255,255,255,0.15);
}
body[data-theme="light"] .hp-rename-cancel {
  color: #374151;
  border-color: rgba(0,0,0,0.15);
}
body[data-theme="dark"] .hp-rename-cancel:hover {
  background: rgba(255,255,255,0.08);
}
body[data-theme="light"] .hp-rename-cancel:hover {
  background: rgba(0,0,0,0.05);
}
.hp-rename-save {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
}
.hp-rename-save:hover {
  background: #059669;
  border-color: #059669;
}

/* ── Empty state ── */
.hp-empty {
  text-align: center;
  padding: 52px 24px;
  opacity: 0.4;
}
.hp-empty-icon { font-size: 2rem; margin-bottom: 10px; }
.hp-empty-text { font-size: 0.82rem; line-height: 1.6; }

/* ── Footer ── */
.hp-footer {
  padding: 10px 12px;
  border-top: 1px solid;
  flex-shrink: 0;
}
body[data-theme="dark"]  .hp-footer { border-color: rgba(255,255,255,0.06); }
body[data-theme="light"] .hp-footer { border-color: rgba(0,0,0,0.06); }
.hp-clear-all {
  width: 100%; padding: 10px;
  border-radius: 8px; border: 1px solid;
  font-size: 0.8rem; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: all 0.15s;
  background: rgba(239,68,68,0.1);
  color: #f87171;
  border-color: rgba(239,68,68,0.3);
}
body[data-theme="light"] .hp-clear-all {
  background: rgba(239,68,68,0.08);
  color: #dc2626;
  border-color: rgba(220,38,38,0.25);
}
.hp-clear-all:hover {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.5);
}
body[data-theme="light"] .hp-clear-all:hover {
  background: rgba(220,38,38,0.15);
  border-color: rgba(220,38,38,0.4);
}

/* ── Confirmation Modal ── */
.hp-confirm-modal {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 10;
}
body[data-theme="dark"] .hp-confirm-modal {
  background: rgba(0,0,0,0.8);
}
body[data-theme="light"] .hp-confirm-modal {
  background: rgba(0,0,0,0.5);
}
.hp-confirm-modal.open {
  opacity: 1;
  visibility: visible;
}
.hp-confirm-box {
  padding: 24px;
  border-radius: 16px;
  text-align: center;
  max-width: 280px;
  transform: scale(0.9);
  transition: transform 0.2s ease;
}
.hp-confirm-modal.open .hp-confirm-box {
  transform: scale(1);
}
body[data-theme="dark"] .hp-confirm-box {
  background: #1f2937;
  border: 1px solid rgba(255,255,255,0.1);
}
body[data-theme="light"] .hp-confirm-box {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}
.hp-confirm-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}
.hp-confirm-box h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}
body[data-theme="dark"] .hp-confirm-box h3 {
  color: #f3f4f6;
}
body[data-theme="light"] .hp-confirm-box h3 {
  color: #111827;
}
.hp-confirm-box p {
  font-size: 0.82rem;
  line-height: 1.5;
  margin-bottom: 20px;
}
body[data-theme="dark"] .hp-confirm-box p {
  color: #9ca3af;
}
body[data-theme="light"] .hp-confirm-box p {
  color: #6b7280;
}
.hp-confirm-buttons {
  display: flex;
  gap: 10px;
}
.hp-confirm-buttons button {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid;
}
.hp-confirm-no {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}
body[data-theme="light"] .hp-confirm-no {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border-color: rgba(5, 150, 105, 0.3);
}
body[data-theme="dark"] .hp-confirm-no:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.6);
}
body[data-theme="light"] .hp-confirm-no:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(5, 150, 105, 0.45);
}
.hp-confirm-yes {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}
.hp-confirm-yes:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

/* ── Restored session banner ── */
.hp-restored-banner {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.75rem; opacity: 0.45;
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px dashed;
}
body[data-theme="dark"]  .hp-restored-banner { border-color: rgba(255,255,255,0.12); }
body[data-theme="light"] .hp-restored-banner { border-color: rgba(0,0,0,0.12); }

/* ── Loading skeleton ── */
.hp-loading { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.hp-skeleton {
  height: 14px; border-radius: 6px;
  animation: hpShimmer 1.4s infinite;
}
.hp-skeleton-sm { height: 10px; width: 60%; opacity: 0.6; }
body[data-theme="dark"]  .hp-skeleton { background: rgba(255,255,255,0.07); }
body[data-theme="light"] .hp-skeleton { background: rgba(0,0,0,0.07); }
@keyframes hpShimmer {
  0%   { opacity: 0.5; }
  50%  { opacity: 1;   }
  100% { opacity: 0.5; }
}

@media (max-width: 480px) {
  .history-panel { 
    left: 0;
    width: 100%;
    max-width: 92vw;
  }
}

/* ── Logo as home link ── */
a.logo {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}
a.logo:hover { opacity: 0.75; }

/* ── Nav button tooltips — appears BELOW the icon ── */
.nav-tooltip-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
/* Tooltip label — below the icon */
.nav-tooltip-wrap::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #1f2937;
  color: #f9fafb;
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 99999;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
/* Arrow pointing up toward icon */
.nav-tooltip-wrap::before {
  content: '';
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  border: 5px solid transparent;
  border-bottom-color: #1f2937;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 99999;
}
.nav-tooltip-wrap:hover::after,
.nav-tooltip-wrap:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
body[data-theme="light"] .nav-tooltip-wrap::after {
  background: #111827;
}
body[data-theme="light"] .nav-tooltip-wrap::before {
  border-bottom-color: #111827;
}
/* === TEENGRO PAGE LOADER START === */
#pageLoader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
body[data-theme="dark"] #pageLoader {
  background: rgba(5, 8, 11, 0.94);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
body[data-theme="light"] #pageLoader {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#pageLoader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.page-loader-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  animation: pageLoaderSpin 0.85s linear infinite;
}
body[data-theme="dark"]  .page-loader-spinner {
  border-color: rgba(255, 255, 255, 0.10);
  border-top-color: #10b981;
}
body[data-theme="light"] .page-loader-spinner {
  border-color: rgba(0, 0, 0, 0.08);
  border-top-color: #10b981;
}

.page-loader-label {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
body[data-theme="dark"]  .page-loader-label { color: rgba(255, 255, 255, 0.45); }
body[data-theme="light"] .page-loader-label { color: rgba(0, 0, 0, 0.42); }

@keyframes pageLoaderSpin {
  to { transform: rotate(360deg); }
}
/* === TEENGRO PAGE LOADER END === */
/* ===================== SLIDER PANEL INLINE EDIT ===================== */
.pp-name-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pp-inline-edit-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.35;
  transition: opacity 0.15s, background 0.15s;
  flex-shrink: 0;
}
.pp-inline-edit-btn:hover {
  opacity: 0.8;
  background: rgba(128, 128, 128, 0.15);
}
body[data-theme="dark"] .pp-inline-edit-btn { color: #e5e7eb; }
body[data-theme="light"] .pp-inline-edit-btn { color: #374151; }

.pp-info-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
  overflow: hidden;
}

.pp-bio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.pp-bio-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.4;
}
.pp-bio-empty {
  font-size: 0.82rem;
  opacity: 0.35;
  font-style: italic;
}

.pp-inline-input,
.pp-inline-select {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  min-width: 0;
  max-width: 100px;
  flex: 1;
  transition: border-color 0.15s;
}
body[data-theme="dark"] .pp-inline-input,
body[data-theme="dark"] .pp-inline-select {
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e5e7eb;
}
body[data-theme="light"] .pp-inline-input,
body[data-theme="light"] .pp-inline-select {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: #111827;
}
body[data-theme="dark"] .pp-inline-input:focus,
body[data-theme="dark"] .pp-inline-select:focus {
  border-color: rgba(16, 185, 129, 0.5);
}
body[data-theme="light"] .pp-inline-input:focus,
body[data-theme="light"] .pp-inline-select:focus {
  border-color: rgba(29, 78, 216, 0.5);
}

.pp-name-input {
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  max-width: 180px;
}

.pp-inline-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  resize: none;
  transition: border-color 0.15s;
}
body[data-theme="dark"] .pp-inline-textarea {
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e5e7eb;
}
body[data-theme="light"] .pp-inline-textarea {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: #111827;
}
body[data-theme="dark"] .pp-inline-textarea:focus {
  border-color: rgba(16, 185, 129, 0.5);
}
body[data-theme="light"] .pp-inline-textarea:focus {
  border-color: rgba(29, 78, 216, 0.5);
}

.pp-inline-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.pp-bio-actions {
  justify-content: flex-end;
  margin-top: 8px;
  gap: 8px;
}

.pp-inline-save,
.pp-inline-cancel {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.pp-inline-save:hover,
.pp-inline-cancel:hover {
  transform: scale(1.08);
}

.pp-inline-save {
  background: #10b981;
  color: #020617;
}
.pp-inline-cancel {
  background: transparent;
  border: 1px solid rgba(128, 128, 128, 0.3);
}
body[data-theme="dark"] .pp-inline-cancel { color: #9ca3af; }
body[data-theme="light"] .pp-inline-cancel { color: #6b7280; }

.pp-bio-actions .pp-inline-save,
.pp-bio-actions .pp-inline-cancel {
  width: auto;
  height: auto;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 8px;
}
.pp-bio-actions .pp-inline-cancel {
  background: transparent;
}
body[data-theme="dark"] .pp-bio-actions .pp-inline-cancel {
  border-color: rgba(255, 255, 255, 0.15);
  color: #9ca3af;
}
body[data-theme="light"] .pp-bio-actions .pp-inline-cancel {
  border-color: rgba(0, 0, 0, 0.15);
  color: #6b7280;
}

/* Username availability status in slider */
.pp-username-status {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 4px 14px 0;
  min-height: 16px;
  text-align: right;
  transition: color 0.15s;
}
.pp-username-status:empty {
  display: none;
}
.pp-username-status.checking {
  color: #9ca3af;
}
.pp-username-status.available {
  color: #10b981;
}
.pp-username-status.error {
  color: #f87171;
}

/* ═══════════════════════════════════════════════════════════════
   ACHIEVEMENTS / BADGES SYSTEM
═══════════════════════════════════════════════════════════════ */

/* ── Badges section in profile panel ── */
.pp-badges-section {
  padding: 0 14px 16px;
  max-width: 100%;
  overflow: hidden;
}

.pp-badges-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.pp-badges-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pp-badges-count {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  opacity: 0.6;
}
body[data-theme="dark"] .pp-badges-count {
  background: rgba(255, 255, 255, 0.08);
}
body[data-theme="light"] .pp-badges-count {
  background: rgba(0, 0, 0, 0.06);
}

.pp-badges-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-width: 100%;
  overflow: hidden;
}

.pp-badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 2px;
  border-radius: 10px;
  cursor: default;
  transition: transform 0.15s, background 0.15s;
  position: relative;
  min-width: 0;
  overflow: hidden;
}

body[data-theme="dark"] .pp-badge-item {
  background: rgba(255, 255, 255, 0.04);
}
body[data-theme="light"] .pp-badge-item {
  background: rgba(0, 0, 0, 0.03);
}

.pp-badge-item:hover {
  transform: scale(1.05);
}
body[data-theme="dark"] .pp-badge-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
body[data-theme="light"] .pp-badge-item:hover {
  background: rgba(0, 0, 0, 0.06);
}

.pp-badge-item.locked {
  opacity: 0.35;
  filter: grayscale(100%);
}

.pp-badge-item.earned {
  opacity: 1;
}
body[data-theme="dark"] .pp-badge-item.earned {
  background: rgba(16, 185, 129, 0.1);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.15);
}
body[data-theme="light"] .pp-badge-item.earned {
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.15);
}

.pp-badge-icon {
  font-size: 1.2rem;
  line-height: 1;
  margin-bottom: 3px;
}

.pp-badge-name {
  font-size: 0.52rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
}

/* Login hint for non-authenticated users */
.pp-badges-login-hint {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.82rem;
  opacity: 0.45;
  padding: 24px 16px;
  font-style: italic;
}

/* Make badge items clickable */
.pp-badge-item {
  cursor: pointer;
}

/* ── Badge info popup ── */
.badge-info-popup {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.badge-info-popup.open {
  opacity: 1;
}

.badge-info-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.badge-info-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 280px;
  padding: 28px 24px;
  border-radius: 20px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.badge-info-popup.open .badge-info-card {
  transform: scale(1);
}
body[data-theme="dark"] .badge-info-card {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}
body[data-theme="light"] .badge-info-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
}

.badge-info-card.locked {
  filter: grayscale(50%);
}

.badge-info-icon {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: 12px;
}

.badge-info-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.badge-info-desc {
  font-size: 0.9rem;
  opacity: 0.6;
  line-height: 1.5;
  margin-bottom: 16px;
}

.badge-info-status {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 20px;
}
.badge-info-card.earned .badge-info-status {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}
.badge-info-card.locked .badge-info-status {
  background: rgba(128, 128, 128, 0.15);
  color: #9ca3af;
}

.badge-info-close {
  padding: 10px 28px;
  border-radius: 999px;
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
body[data-theme="dark"] .badge-info-close {
  background: rgba(255, 255, 255, 0.1);
  color: #e5e7eb;
}
body[data-theme="light"] .badge-info-close {
  background: rgba(0, 0, 0, 0.08);
  color: #111827;
}
.badge-info-close:hover {
  opacity: 0.8;
  transform: scale(1.02);
}

/* ── Badge unlock toast ── */
.badge-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  border-radius: 16px;
  z-index: 999999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
body[data-theme="dark"] .badge-toast {
  background: linear-gradient(135deg, #1a2e1a 0%, #0d1a0d 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(16, 185, 129, 0.1), 0 0 40px rgba(16, 185, 129, 0.15);
}
body[data-theme="light"] .badge-toast {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(16, 185, 129, 0.15);
}

.badge-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.badge-toast-icon {
  font-size: 2.2rem;
  line-height: 1;
  animation: badgeIconPop 0.5s ease;
}

@keyframes badgeIconPop {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.badge-toast-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.badge-toast-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #10b981;
}

.badge-toast-name {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
}
body[data-theme="dark"] .badge-toast-name {
  color: #f0fdf4;
}
body[data-theme="light"] .badge-toast-name {
  color: #064e3b;
}

.badge-toast-desc {
  font-size: 0.82rem;
  opacity: 0.65;
  line-height: 1.3;
}
body[data-theme="dark"] .badge-toast-desc {
  color: #d1fae5;
}
body[data-theme="light"] .badge-toast-desc {
  color: #065f46;
}

/* ── Confetti effect on badge unlock (optional) ── */
@keyframes badgeConfetti {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(-100px) rotate(360deg); opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   SHARE CHAT SNIPPET MODAL
═══════════════════════════════════════════════════════════════ */

.share-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.share-modal.open {
  opacity: 1;
}

.share-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.share-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  border-radius: 18px;
  padding: 24px;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.share-modal.open .share-card {
  transform: translateY(0) scale(1);
}
body[data-theme="dark"] .share-card {
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}
body[data-theme="light"] .share-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
}

.share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.share-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}
.share-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity 0.15s, background 0.15s;
}
.share-close:hover {
  opacity: 1;
}
body[data-theme="dark"] .share-close { color: #e5e7eb; }
body[data-theme="light"] .share-close { color: #374151; }
body[data-theme="dark"] .share-close:hover { background: rgba(255, 255, 255, 0.1); }
body[data-theme="light"] .share-close:hover { background: rgba(0, 0, 0, 0.05); }

.share-preview {
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}
body[data-theme="dark"] .share-preview {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
body[data-theme="light"] .share-preview {
  background: #f9fafb;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.share-preview-q,
.share-preview-a {
  margin-bottom: 12px;
}
.share-preview-a {
  margin-bottom: 0;
}
.share-preview-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.4;
  margin-bottom: 4px;
}
.share-preview p {
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0;
  opacity: 0.8;
}

.share-actions {
  display: flex;
  justify-content: center;
}

.share-generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: #10b981;
  color: #020617;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.share-generate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
}
.share-generate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.share-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(2, 6, 23, 0.3);
  border-top-color: #020617;
  border-radius: 50%;
  animation: shareSpinnerSpin 0.6s linear infinite;
}
@keyframes shareSpinnerSpin {
  to { transform: rotate(360deg); }
}

.share-link-section {
  margin-bottom: 16px;
}
.share-link-wrap {
  display: flex;
  gap: 8px;
}
.share-link-input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-family: monospace;
  outline: none;
  min-width: 0;
}
body[data-theme="dark"] .share-link-input {
  background: #05080b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e5e7eb;
}
body[data-theme="light"] .share-link-input {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: #111827;
}

.share-copy-btn {
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
body[data-theme="dark"] .share-copy-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #e5e7eb;
}
body[data-theme="light"] .share-copy-btn {
  background: rgba(0, 0, 0, 0.08);
  color: #111827;
}
body[data-theme="dark"] .share-copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}
body[data-theme="light"] .share-copy-btn:hover {
  background: rgba(0, 0, 0, 0.12);
}
.share-copy-btn.copied {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.share-link-note {
  font-size: 0.75rem;
  opacity: 0.45;
  margin: 10px 0 0;
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════
   XP TOAST
   ═══════════════════════════════════════════════════════════ */
.xp-toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(16px);
  display: flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px;
  font-size: 0.875rem; font-weight: 600;
  z-index: 9999; opacity: 0; pointer-events: none; white-space: nowrap;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.16,1,0.3,1);
}
body[data-theme="dark"]  .xp-toast { background: #111827; border: 1px solid rgba(16,185,129,0.35); color: #e5e7eb; }
body[data-theme="light"] .xp-toast { background: #fff; border: 1px solid rgba(16,185,129,0.3); color: #111827; box-shadow: 0 4px 20px rgba(0,0,0,0.12); }
.xp-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.xp-toast-amount { color: #10b981; font-size: 1rem; font-weight: 800; }
.xp-toast-reason { opacity: 0.65; }

/* ═══════════════════════════════════════════════════════════
   PROFILE PANEL — XP CARD
   ═══════════════════════════════════════════════════════════ */
.pp-xp-card { grid-column: 1 / -1; }
.pp-xp-bar-wrap { width: 100%; height: 5px; border-radius: 999px; overflow: hidden; margin: 5px 0 2px; }
body[data-theme="dark"]  .pp-xp-bar-wrap { background: rgba(255,255,255,0.08); }
body[data-theme="light"] .pp-xp-bar-wrap { background: rgba(0,0,0,0.07); }
.pp-xp-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #10b981, #34d399); transition: width 0.5s cubic-bezier(0.16,1,0.3,1); }

/* ═══════════════════════════════════════════════════════════
   SAVE AS FLASHCARD MODAL (dashboard quick-save)
   ═══════════════════════════════════════════════════════════ */
.fc-quick-save-modal { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.fc-qsm-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(6px); }
.fc-qsm-card { position: relative; z-index: 1; width: 100%; max-width: 440px; border-radius: 20px; overflow: hidden; opacity: 0; transform: scale(0.94) translateY(10px); transition: all 0.22s cubic-bezier(0.16,1,0.3,1); }
.fc-quick-save-modal.open .fc-qsm-card { opacity: 1; transform: scale(1) translateY(0); }
body[data-theme="dark"]  .fc-qsm-card { background: #111827; border: 1px solid rgba(255,255,255,0.08); }
body[data-theme="light"] .fc-qsm-card { background: #fff; border: 1px solid rgba(0,0,0,0.08); box-shadow: 0 20px 60px rgba(0,0,0,0.18); }
.fc-qsm-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; }
.fc-qsm-header h3 { font-size: 0.96rem; font-weight: 700; }
.fc-qsm-close { background: none; border: none; cursor: pointer; font-size: 1rem; opacity: 0.45; font-family: inherit; transition: opacity 0.15s; }
.fc-qsm-close:hover { opacity: 1; }
.fc-qsm-body { padding: 0 20px 14px; display: flex; flex-direction: column; gap: 10px; }
.fc-qsm-body label { font-size: 0.73rem; font-weight: 700; opacity: 0.5; text-transform: uppercase; letter-spacing: 0.06em; display: block; margin-bottom: 2px; }
.fc-qsm-body textarea, .fc-qsm-body input, .fc-qsm-body select { width: 100%; padding: 9px 12px; border-radius: 10px; font-size: 0.875rem; font-family: inherit; outline: none; resize: vertical; transition: border-color 0.15s; }
body[data-theme="dark"]  .fc-qsm-body textarea,
body[data-theme="dark"]  .fc-qsm-body input,
body[data-theme="dark"]  .fc-qsm-body select { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: #e5e7eb; }
body[data-theme="light"] .fc-qsm-body textarea,
body[data-theme="light"] .fc-qsm-body input,
body[data-theme="light"] .fc-qsm-body select { background: #f9fafb; border: 1px solid #e5e7eb; color: #111827; }
body[data-theme="dark"]  .fc-qsm-body textarea:focus,
body[data-theme="dark"]  .fc-qsm-body input:focus,
body[data-theme="dark"]  .fc-qsm-body select:focus { border-color: rgba(16,185,129,0.5); }
body[data-theme="light"] .fc-qsm-body textarea:focus,
body[data-theme="light"] .fc-qsm-body input:focus,
body[data-theme="light"] .fc-qsm-body select:focus { border-color: #10b981; }
.fc-qsm-msg { font-size: 0.82rem; font-weight: 500; padding: 2px 0; }
.fc-qsm-msg.success { color: #10b981; }
.fc-qsm-footer { display: flex; gap: 10px; padding: 10px 20px 18px; }
.fc-qsm-cancel { flex: 1; padding: 10px; border-radius: 10px; font-size: 0.875rem; font-weight: 600; cursor: pointer; font-family: inherit; background: transparent; transition: background 0.12s; }
body[data-theme="dark"]  .fc-qsm-cancel { border: 1px solid rgba(255,255,255,0.12); color: rgba(255,255,255,0.7); }
body[data-theme="light"] .fc-qsm-cancel { border: 1px solid rgba(0,0,0,0.12); color: rgba(0,0,0,0.6); }
body[data-theme="dark"]  .fc-qsm-cancel:hover { background: rgba(255,255,255,0.06); }
body[data-theme="light"] .fc-qsm-cancel:hover { background: rgba(0,0,0,0.04); }
.fc-qsm-save { flex: 2; padding: 10px; border-radius: 10px; border: none; background: #10b981; color: #fff; font-size: 0.875rem; font-weight: 700; cursor: pointer; font-family: inherit; transition: opacity 0.15s; }
.fc-qsm-save:hover { opacity: 0.85; }
.fc-qsm-save:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===================== AI FLASHCARD GENERATION ===================== */

.fc-gen-intro { font-size: 0.92rem; opacity: 0.7; margin-bottom: 14px; }

.fc-form-row { display: flex; gap: 12px; }
.fc-form-row .fc-form-group { flex: 1; }

.fc-gen-results { margin-top: 28px; }
.fc-gen-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }
.fc-gen-results-title { font-size: 1.05rem; margin: 0; }

.fc-gen-cards { display: flex; flex-direction: column; gap: 12px; }

.fc-gen-card {
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  animation: fcGenFadeIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
body[data-theme="dark"]  .fc-gen-card { background: #1f2937; border-color: rgba(255,255,255,0.08); }
body[data-theme="light"] .fc-gen-card { background: #ffffff; border-color: #e5e7eb; }

@keyframes fcGenFadeIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.fc-gen-card-front,
.fc-gen-card-back {
  font-size: 0.92rem;
  line-height: 1.5;
  outline: none;
  white-space: pre-wrap;
  border-radius: 6px;
  padding: 4px 6px;
  transition: background 0.15s;
}
.fc-gen-card-front { font-weight: 600; }
.fc-gen-card-back  { opacity: 0.85; }

body[data-theme="dark"]  .fc-gen-card-front:focus,
body[data-theme="dark"]  .fc-gen-card-back:focus  { background: rgba(255,255,255,0.04); }
body[data-theme="light"] .fc-gen-card-front:focus,
body[data-theme="light"] .fc-gen-card-back:focus  { background: #f9fafb; }

.fc-gen-card-actions { display: flex; gap: 8px; margin-top: 4px; }
.fc-gen-card-del {
  background: transparent;
  border: 1px solid rgba(239,68,68,0.4);
  color: #ef4444;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  transition: background 0.15s;
}
.fc-gen-card-del:hover { background: rgba(239,68,68,0.1); }

/* Skeleton loaders shown while generating */
.fc-skel-card {
  border-radius: 12px;
  height: 92px;
  position: relative;
  overflow: hidden;
  border: 1px solid;
  animation: fcSkelFadeIn 0.35s ease backwards;
}
body[data-theme="dark"]  .fc-skel-card { background: rgba(255,255,255,0.025); border-color: rgba(255,255,255,0.06); }
body[data-theme="light"] .fc-skel-card { background: #f9fafb; border-color: #e5e7eb; }

.fc-skel-card::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  animation: fcSkelShine 1.4s infinite;
}
body[data-theme="light"] .fc-skel-card::after {
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.04), transparent);
}

@keyframes fcSkelFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fcSkelShine {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* ── Page entrance: main content rises up as the page loader fades out ── */
@keyframes tgPageEnter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.tg-page-enter {
  animation: tgPageEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.06s both;
}

@media (prefers-reduced-motion: reduce) {
  .tg-page-enter { animation: none; opacity: 1; transform: none; }
}

/* ── Tabular numerals: prevent digit-width jitter on live-updating numbers ── */
#sparkBalTotal,
#sparkBalInr,
#sparkBalA,
#sparkBalB,
#sparkPillVal,
.xp-toast-amount {
  font-variant-numeric: tabular-nums;
}
