:root {
  --bg-base: #0B0C1E;
  --bg-card: #141530;
  --bg-card-hover: #1C1D3E;
  --border: #2A2B4A;
  --accent-primary: #6C63FF;
  --accent-red: #E63946;
  --color-amber: #F59E0B;
  --text-primary: #F0F0FF;
  --text-secondary: #9395B0;
  --color-bg-page: var(--bg-base);
  --color-bg-card: var(--bg-card);
  --color-bg-card-hover: var(--bg-card-hover);
  --color-border: var(--border);
  --color-text-primary: var(--text-primary);
  --color-text-secondary: var(--text-secondary);
  --sidebar-bg: rgba(11, 12, 30, 0.40);
  --sidebar-collapsed: 72px;
  --sidebar-expanded: 240px;
  --header-h: 0px;
  --pad: 24px;
  --popout-neon-border: rgba(96, 165, 250, 0.5);
  --popout-neon-shadow: 0 0 0 1px rgba(59, 130, 246, 0.32), 0 0 24px rgba(59, 130, 246, 0.28), 0 10px 34px rgba(0, 0, 0, 0.5);
  --popout-glass: blur(18px) saturate(1.35);
  --ths6-panel-bg: linear-gradient(145deg, rgba(20,16,50,.99), rgba(14,10,36,.99));
  --ths6-panel-border: 1px solid rgba(124,58,237,.3);
  --ths6-panel-text: #F0F0FF;
  --ths6-panel-muted: rgba(221,214,254,.4);
  --ths6-accent: #7C3AED;
  --ths6-accent-2: #6366F1;
  --ths6-panel-radius: 16px;
  --ths6-ease: cubic-bezier(.4,0,.2,1);
  --ths6-speed: 220ms;
  --ths6-avatar-bg: #0C0B22;
  --ths6-avatar-text: #DDD6FE;
  --toast-bg: rgba(13,17,45,0.95);
  --toast-border: rgba(124,58,237,0.4);
  --toast-text: #e9ddff;
  --ths6-header-bg: linear-gradient(135deg, #0C0B22, #0F0D2A, #0A0B1F);
  --ths6-prism-bar-bg: linear-gradient(90deg, #4F46E5, #7C3AED, #6366F1, #3B82F6, #60A5FA, #818CF8, #4F46E5);
  --ths6-prism-shadow: 0 0 16px rgba(99, 102, 241, .5), 0 4px 20px rgba(99, 102, 241, .2);
  --ths6-aurora-bg: linear-gradient(270deg, rgba(99,102,241,.08), rgba(124,58,237,.1), rgba(79,70,229,.07), rgba(139,92,246,.08), rgba(99,102,241,.08));
  --thrive-scroll-bg-image:
    radial-gradient(ellipse 110% 22% at 28%  0%,  rgba(80, 28,170,0.58) 0%, transparent 88%),
    radial-gradient(ellipse  80% 18% at 80%  2%,  rgba(32, 85,185,0.38) 0%, transparent 88%),
    radial-gradient(ellipse  62% 20% at 52%  1%,  rgba(60, 65,175,0.44) 0%, transparent 88%),
    radial-gradient(ellipse  70% 22% at  6% 16%,  rgba(80, 28,170,0.16) 0%, transparent 78%),
    radial-gradient(ellipse  60% 20% at 94% 14%,  rgba(48, 40,165,0.14) 0%, transparent 78%),
    radial-gradient(ellipse  50% 18% at 50% 20%,  rgba(92, 50,180,0.11) 0%, transparent 76%),
    radial-gradient(ellipse 110% 22% at 28% 50%,  rgba(80, 28,170,0.58) 0%, transparent 88%),
    radial-gradient(ellipse  80% 18% at 80% 52%,  rgba(32, 85,185,0.38) 0%, transparent 88%),
    radial-gradient(ellipse  62% 20% at 52% 51%,  rgba(60, 65,175,0.44) 0%, transparent 88%),
    radial-gradient(ellipse  70% 22% at  6% 66%,  rgba(80, 28,170,0.16) 0%, transparent 78%),
    radial-gradient(ellipse  60% 20% at 94% 64%,  rgba(48, 40,165,0.14) 0%, transparent 78%),
    radial-gradient(ellipse  50% 18% at 50% 70%,  rgba(92, 50,180,0.11) 0%, transparent 76%),
    linear-gradient(170deg, #090618 0%, #060414 15%, #040310 40%, #03020d 70%, #02020a 100%);
  --thrive-ambient-bg-image:
    radial-gradient(ellipse 48% 28% at 20% 38%, rgba(95, 38,190,0.09) 0%, transparent 68%),
    radial-gradient(ellipse 38% 22% at 80% 55%, rgba(72, 78,195,0.08) 0%, transparent 68%),
    radial-gradient(ellipse 32% 18% at 48% 72%, rgba(55, 48,180,0.07) 0%, transparent 65%),
    radial-gradient(ellipse 36% 16% at 66% 18%, rgba(40,100,210,0.07) 0%, transparent 65%);
  --thrive-scroll-opacity: 0.6;
  --thrive-ambient-opacity: 0.58;
}

/* ── THEME 1 — default, already defined in :root above ─────────── */
/* No [data-theme] block needed — :root IS thrive-default */

[data-theme="thrive-default"],
[data-theme="thrive-aurora"] {
  --bg-base:        #0B0C1E;
  --bg-card:        #141530;
  --bg-card-hover:  #1C1D3E;
  --border:         #2A2B4A;
  --accent-primary: #6C63FF;
  --text-primary:   #F0F0FF;
  --text-secondary: #9395B0;
  --sidebar-bg:     rgba(11, 12, 30, 0.40);
  --ths6-panel-bg:  linear-gradient(145deg, rgba(20,16,50,.99), rgba(14,10,36,.99));
  --ths6-panel-border: 1px solid rgba(124,58,237,.3);
  --ths6-panel-text:   #F0F0FF;
  --ths6-panel-muted:  rgba(221,214,254,.4);
  --ths6-accent:    #7C3AED;
  --ths6-accent-2:  #6366F1;
  --ths6-avatar-bg: #0C0B22;
  --ths6-avatar-text: #DDD6FE;
  --toast-bg: rgba(13,17,45,0.95);
  --toast-border: rgba(124,58,237,0.4);
  --toast-text: #e9ddff;
  --ths6-header-bg: linear-gradient(135deg, #060f28, #0b1a3d, #0a1330);
  --ths6-prism-bar-bg: linear-gradient(90deg, #1D4ED8, #2563EB, #3B82F6, #4F46E5, #6366F1, #7C3AED);
  --ths6-prism-shadow: 0 0 16px rgba(99, 102, 241, .5), 0 4px 20px rgba(99, 102, 241, .2);
  --ths6-aurora-bg: linear-gradient(270deg, rgba(29,78,216,.12), rgba(37,99,235,.10), rgba(79,70,229,.08), rgba(124,58,237,.08), rgba(29,78,216,.12));
  --thrive-scroll-bg-image:
    radial-gradient(ellipse 110% 22% at 28%  0%,  rgba(30,64,175,0.50) 0%, transparent 88%),
    radial-gradient(ellipse  80% 18% at 80%  2%,  rgba(37,99,235,0.36) 0%, transparent 88%),
    radial-gradient(ellipse  62% 20% at 52%  1%,  rgba(59,130,246,0.30) 0%, transparent 88%),
    radial-gradient(ellipse  70% 22% at  6% 16%,  rgba(30,64,175,0.18) 0%, transparent 78%),
    radial-gradient(ellipse  60% 20% at 94% 14%,  rgba(67,56,202,0.16) 0%, transparent 78%),
    radial-gradient(ellipse  50% 18% at 50% 20%,  rgba(76,29,149,0.12) 0%, transparent 76%),
    radial-gradient(ellipse 110% 22% at 28% 50%,  rgba(30,64,175,0.50) 0%, transparent 88%),
    radial-gradient(ellipse  80% 18% at 80% 52%,  rgba(37,99,235,0.36) 0%, transparent 88%),
    radial-gradient(ellipse  62% 20% at 52% 51%,  rgba(59,130,246,0.30) 0%, transparent 88%),
    radial-gradient(ellipse  70% 22% at  6% 66%,  rgba(30,64,175,0.18) 0%, transparent 78%),
    radial-gradient(ellipse  60% 20% at 94% 64%,  rgba(67,56,202,0.16) 0%, transparent 78%),
    radial-gradient(ellipse  50% 18% at 50% 70%,  rgba(76,29,149,0.12) 0%, transparent 76%),
    linear-gradient(170deg, #040914 0%, #050d1f 18%, #050a18 42%, #03060f 70%, #02040b 100%);
  --thrive-ambient-bg-image:
    radial-gradient(ellipse 48% 28% at 20% 38%, rgba(37,99,235,0.11) 0%, transparent 68%),
    radial-gradient(ellipse 38% 22% at 80% 55%, rgba(59,130,246,0.10) 0%, transparent 68%),
    radial-gradient(ellipse 32% 18% at 48% 72%, rgba(67,56,202,0.08) 0%, transparent 65%),
    radial-gradient(ellipse 36% 16% at 66% 18%, rgba(124,58,237,0.07) 0%, transparent 65%);
}

[data-theme="polar-white"],
[data-theme="thrive-daylight"] {
  --bg-base:        #FFFFFF;
  --bg-card:        #FFFFFF;
  --bg-card-hover:  #F8F7FF;
  --border:         rgba(108, 99, 255, 0.14);
  --accent-primary: #6C63FF;
  --text-primary:   #1E1B4B;
  --text-secondary: #5C5E7A;
  --sidebar-bg:     #FFFFFF;
  --ths6-panel-bg:  #FFFFFF;
  --ths6-panel-border: 1px solid rgba(108, 99, 255, 0.18);
  --ths6-panel-text:   #1E1B4B;
  --ths6-panel-muted:  #5C5E7A;
  --ths6-accent:    #6C63FF;
  --ths6-accent-2:  #A78BFA;
  --ths6-avatar-bg: #FFFFFF;
  --ths6-avatar-text: #1E1B4B;
  --toast-bg: rgba(255, 255, 255, 0.98);
  --toast-border: rgba(108, 99, 255, 0.22);
  --toast-text: #1E1B4B;
  --ths6-header-bg: #FFFFFF;
  --ths6-prism-bar-bg: linear-gradient(90deg, #6C63FF, #A78BFA, #6C63FF);
  --ths6-prism-shadow: 0 1px 0 rgba(108, 99, 255, 0.08);
  --ths6-aurora-bg: linear-gradient(270deg, rgba(108,99,255,0.06), rgba(14,165,233,0.05), rgba(108,99,255,0.06));
  --thrive-scroll-bg-image:
    radial-gradient(60% 40% at 0% 0%,  rgba(108,99,255,0.055) 0%, transparent 65%),
    radial-gradient(50% 35% at 100% 8%, rgba(14,165,233,0.045) 0%, transparent 65%),
    #FFFFFF;
  --thrive-ambient-bg-image:
    radial-gradient(60% 40% at 0% 0%,  rgba(108,99,255,0.055) 0%, transparent 65%),
    radial-gradient(50% 35% at 100% 8%, rgba(14,165,233,0.045) 0%, transparent 65%),
    #FFFFFF;
  --thrive-scroll-opacity: 1;
  --thrive-ambient-opacity: 1;
}

[data-theme="sky-canvas"] {
  --bg-base:        #FAFDFF;
  --bg-card:        #F0F9FF;
  --bg-card-hover:  #E0F2FE;
  --border:         rgba(14,165,233,.16);
  --accent-primary: #0EA5E9;
  --text-primary:   #0C4A6E;
  --text-secondary: #64748B;
  --sidebar-bg:     rgba(240,249,255,.85);
  --ths6-panel-bg:  linear-gradient(145deg, rgba(224,242,254,.99), rgba(186,230,253,.99));
  --ths6-panel-border: 1px solid rgba(14,165,233,.3);
  --ths6-panel-text:   #0C4A6E;
  --ths6-panel-muted:  rgba(12,74,110,.4);
  --ths6-accent:    #0EA5E9;
  --ths6-accent-2:  #0284C7;
  --ths6-avatar-bg: #F0F9FF;
  --ths6-avatar-text: #0C4A6E;
  --toast-bg: rgba(240,249,255,0.95);
  --toast-border: rgba(14,165,233,0.32);
  --toast-text: #0C4A6E;
  --ths6-header-bg: linear-gradient(135deg, #F0F9FF, #E0F2FE, #F0F9FF);
  --ths6-prism-bar-bg: linear-gradient(90deg, #0EA5E9, #0284C7, #38BDF8, #0EA5E9);
  --ths6-prism-shadow: 0 0 10px rgba(14,165,233,.22), 0 4px 14px rgba(2,132,199,.14);
  --ths6-aurora-bg: linear-gradient(270deg, rgba(14,165,233,.1), rgba(56,189,248,.08), rgba(2,132,199,.08), rgba(14,165,233,.1));
  --thrive-scroll-bg-image:
    radial-gradient(ellipse 110% 22% at 28% 0%, rgba(14,165,233,.2) 0%, transparent 84%),
    radial-gradient(ellipse 80% 18% at 80% 2%, rgba(56,189,248,.16) 0%, transparent 84%),
    radial-gradient(ellipse 62% 20% at 52% 1%, rgba(2,132,199,.14) 0%, transparent 84%),
    radial-gradient(ellipse 70% 22% at 6% 16%, rgba(125,211,252,.12) 0%, transparent 76%),
    radial-gradient(ellipse 60% 20% at 94% 14%, rgba(14,165,233,.1) 0%, transparent 76%),
    radial-gradient(ellipse 50% 18% at 50% 20%, rgba(56,189,248,.1) 0%, transparent 74%),
    radial-gradient(ellipse 110% 22% at 28% 50%, rgba(14,165,233,.2) 0%, transparent 84%),
    radial-gradient(ellipse 80% 18% at 80% 52%, rgba(56,189,248,.16) 0%, transparent 84%),
    radial-gradient(ellipse 62% 20% at 52% 51%, rgba(2,132,199,.14) 0%, transparent 84%),
    radial-gradient(ellipse 70% 22% at 6% 66%, rgba(125,211,252,.12) 0%, transparent 76%),
    radial-gradient(ellipse 60% 20% at 94% 64%, rgba(14,165,233,.1) 0%, transparent 76%),
    radial-gradient(ellipse 50% 18% at 50% 70%, rgba(56,189,248,.1) 0%, transparent 74%),
    linear-gradient(170deg, #FAFDFF 0%, #F0F9FF 45%, #E0F2FE 100%);
  --thrive-ambient-bg-image:
    radial-gradient(ellipse 48% 28% at 20% 38%, rgba(14,165,233,.12) 0%, transparent 68%),
    radial-gradient(ellipse 38% 22% at 80% 55%, rgba(56,189,248,.1) 0%, transparent 68%),
    radial-gradient(ellipse 32% 18% at 48% 72%, rgba(2,132,199,.08) 0%, transparent 65%),
    radial-gradient(ellipse 36% 16% at 66% 18%, rgba(125,211,252,.1) 0%, transparent 65%);
  --thrive-scroll-opacity: 0.9;
  --thrive-ambient-opacity: 0.8;
}

[data-theme="deep-cosmos"] {
  --bg-base:        #08051A;
  --bg-card:        #120D2E;
  --bg-card-hover:  #1A1240;
  --border:         rgba(6,182,212,.22);
  --accent-primary: #06B6D4;
  --text-primary:   #F0FDFF;
  --text-secondary: #7DD3FC;
  --sidebar-bg:     rgba(8,5,26,0.50);
  --ths6-panel-bg:  linear-gradient(145deg, rgba(18,13,46,.99), rgba(10,7,30,.99));
  --ths6-panel-border: 1px solid rgba(6,182,212,.3);
  --ths6-panel-text:   #F0FDFF;
  --ths6-panel-muted:  rgba(125,211,252,.4);
  --ths6-accent:    #06B6D4;
  --ths6-accent-2:  #0891B2;
  --ths6-avatar-bg: #0D0A22;
  --ths6-avatar-text: #F0FDFF;
  --toast-bg: rgba(10,10,24,0.95);
  --toast-border: rgba(6,182,212,0.4);
  --toast-text: #E6FBFF;
  --ths6-header-bg: linear-gradient(135deg, #08051A, #120D2E, #0A0720);
  --ths6-prism-bar-bg: linear-gradient(90deg, #06B6D4, #0891B2, #7C3AED, #06B6D4);
  --ths6-prism-shadow: 0 0 16px rgba(6,182,212,.45), 0 4px 20px rgba(8,145,178,.2);
  --ths6-aurora-bg: linear-gradient(270deg, rgba(6,182,212,.1), rgba(124,58,237,.08), rgba(8,145,178,.08), rgba(6,182,212,.1));
}

[data-theme="blueprint"] {
  --bg-base:        #070D18;
  --bg-card:        #0E1929;
  --bg-card-hover:  #162438;
  --border:         rgba(59,130,246,.2);
  --accent-primary: #3B82F6;
  --text-primary:   #EFF6FF;
  --text-secondary: #BFDBFE;
  --sidebar-bg:     rgba(7,13,24,0.55);
  --ths6-panel-bg:  linear-gradient(145deg, rgba(14,25,41,.99), rgba(7,13,24,.99));
  --ths6-panel-border: 1px solid rgba(59,130,246,.3);
  --ths6-panel-text:   #EFF6FF;
  --ths6-panel-muted:  rgba(191,219,254,.4);
  --ths6-accent:    #3B82F6;
  --ths6-accent-2:  #2563EB;
  --ths6-avatar-bg: #0B1320;
  --ths6-avatar-text: #EFF6FF;
  --toast-bg: rgba(10,18,30,0.95);
  --toast-border: rgba(59,130,246,0.4);
  --toast-text: #EFF6FF;
  --ths6-header-bg: linear-gradient(135deg, #070D18, #0E1929, #162438);
  --ths6-prism-bar-bg: linear-gradient(90deg, #3B82F6, #2563EB, #60A5FA, #3B82F6);
  --ths6-prism-shadow: 0 0 16px rgba(59,130,246,.45), 0 4px 20px rgba(37,99,235,.2);
  --ths6-aurora-bg: linear-gradient(270deg, rgba(59,130,246,.1), rgba(37,99,235,.08), rgba(96,165,250,.08), rgba(59,130,246,.1));
}

[data-theme="midnight-violet"] {
  --bg-base:        #0D0B1F;
  --bg-card:        #16143A;
  --bg-card-hover:  #1E1C4A;
  --border:         rgba(139,92,246,.2);
  --accent-primary: #8B5CF6;
  --text-primary:   #EDE9FE;
  --text-secondary: #A78BFA;
  --sidebar-bg:     rgba(13,11,31,0.50);
  --ths6-panel-bg:  linear-gradient(145deg, rgba(22,20,58,.99), rgba(13,11,31,.99));
  --ths6-panel-border: 1px solid rgba(139,92,246,.3);
  --ths6-panel-text:   #EDE9FE;
  --ths6-panel-muted:  rgba(167,139,250,.4);
  --ths6-accent:    #8B5CF6;
  --ths6-accent-2:  #7C3AED;
  --ths6-avatar-bg: #110F28;
  --ths6-avatar-text: #EDE9FE;
  --toast-bg: rgba(17,15,40,0.95);
  --toast-border: rgba(139,92,246,0.4);
  --toast-text: #EDE9FE;
  --ths6-header-bg: linear-gradient(135deg, #0D0B1F, #16143A, #1E1C4A);
  --ths6-prism-bar-bg: linear-gradient(90deg, #8B5CF6, #7C3AED, #A78BFA, #8B5CF6);
  --ths6-prism-shadow: 0 0 16px rgba(139,92,246,.45), 0 4px 20px rgba(124,58,237,.2);
  --ths6-aurora-bg: linear-gradient(270deg, rgba(139,92,246,.1), rgba(236,72,153,.08), rgba(167,139,250,.08), rgba(139,92,246,.1));
}

[data-theme="neon-pulse"] {
  --bg-base:        #030308;
  --bg-card:        #0D0D18;
  --bg-card-hover:  #141420;
  --border:         rgba(255,0,110,.22);
  --accent-primary: #FF006E;
  --text-primary:   #FFFFFF;
  --text-secondary: #FF80B6;
  --sidebar-bg:     rgba(3,3,8,0.60);
  --ths6-panel-bg:  linear-gradient(145deg, rgba(20,10,30,.99), rgba(10,5,20,.99));
  --ths6-panel-border: 1px solid rgba(255,0,110,.35);
  --ths6-panel-text:   #FFFFFF;
  --ths6-panel-muted:  rgba(255,128,182,.4);
  --ths6-accent:    #FF006E;
  --ths6-accent-2:  #CC0058;
  --ths6-avatar-bg: #0A0A14;
  --ths6-avatar-text: #FFFFFF;
  --toast-bg: rgba(12,8,22,0.95);
  --toast-border: rgba(255,0,110,0.45);
  --toast-text: #FFD8EA;
  --ths6-header-bg: linear-gradient(135deg, #030308, #0D0D18, #141420);
  --ths6-prism-bar-bg: linear-gradient(90deg, #FF006E, #CC0058, #BF00FF, #FF006E);
  --ths6-prism-shadow: 0 0 16px rgba(255,0,110,.55), 0 4px 20px rgba(191,0,255,.25);
  --ths6-aurora-bg: linear-gradient(270deg, rgba(255,0,110,.12), rgba(191,0,255,.1), rgba(250,255,0,.06), rgba(255,0,110,.12));
}

[data-theme="polar-white"] .th-aurora-bg {
  background: linear-gradient(180deg, rgba(236,242,255,.98) 0%, rgba(248,250,255,1) 100%);
}
[data-theme="sky-canvas"] .th-aurora-bg {
  background: linear-gradient(180deg, rgba(224,242,254,.98) 0%, rgba(240,249,255,1) 100%);
}

#thrive-header {
  position: sticky;
  top: 0; z-index: 200;
  width: 100%;
  overflow: hidden;
  padding: 0;
  transition: all .3s ease;
}

.th-aurora-bg {
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    rgba(18,8,40,.98) 0%,
    rgba(12,5,28,1) 100%
  );
  z-index: 0;
}

.th-aurora-blob-1 {
  position: absolute; border-radius: 50%;
  width: 55%;  height: 160px;
  left: -8%;   top: -40px;
  background: radial-gradient(ellipse,
    rgba(124,58,237,.7) 0%, rgba(109,40,217,.35) 40%, transparent 70%);
  animation: aurora1 14s ease-in-out infinite;
  pointer-events: none;
}
.th-aurora-blob-2 {
  position: absolute; border-radius: 50%;
  width: 45%;  height: 140px;
  left: 30%;   top: -30px;
  background: radial-gradient(ellipse,
    rgba(6,182,212,.45) 0%, rgba(14,165,233,.2) 45%, transparent 70%);
  animation: aurora2 18s ease-in-out infinite;
  pointer-events: none;
}
.th-aurora-blob-3 {
  position: absolute; border-radius: 50%;
  width: 40%;  height: 120px;
  right: -5%;  top: -20px;
  background: radial-gradient(ellipse,
    rgba(196,165,253,.4) 0%, rgba(168,85,247,.2) 45%, transparent 70%);
  animation: aurora3 22s ease-in-out infinite;
  pointer-events: none;
}

.th-aurora-seam {
  position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(124,58,237,.5) 30%,
    rgba(6,182,212,.3) 60%,
    transparent 100%
  );
}

.th-inner {
  position: relative; z-index: 1;
  display: flex; align-items: center;
  gap: 14px; padding: 14px 24px;
  transition: padding .3s ease;
}
#thrive-header.scrolled .th-inner { padding: 9px 24px; }

.th-greeting {
  flex: 1; min-width: 0;
  font-size: 14px; font-weight: 600; color: #f1f5f9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.th-logo-zone { display: flex; align-items: center; gap: 10px; }
.th-main-logo { height: 30px; width: auto; display: block; }
.th-bh-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  color: #a78bfa;
  border-left: 1px solid rgba(124,58,237,0.35);
  padding-left: 10px;
}
.th-stats { display: flex; align-items: center; gap: 8px; }
.th-stat-pill {
  border: 1px solid rgba(124,58,237,.35);
  background: rgba(124,58,237,.14);
  color: #e9d5ff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}
.th-utils { display: flex; align-items: center; gap: 8px; }
.th-util-btn {
  border: 1px solid rgba(124,58,237,.35);
  background: rgba(18,8,40,.6);
  color: #f3e8ff;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
}
.th-util-btn:hover { background: rgba(124,58,237,.18); }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
}

a { color: inherit; text-decoration: none; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: #101227;
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 999;
}
.skip-link:focus { left: 8px; }

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-collapsed);
  background: var(--bg-base);
  border-right: 1px solid var(--border);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: width 200ms ease;
  z-index: 60;
  overflow: hidden;
}
.sidebar:hover { width: var(--sidebar-expanded); }

.logo {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  overflow: hidden;
}
.logo .logo-icon {
  width: 28px;
  height: 28px;
  opacity: 1;
  object-fit: contain;
  object-position: center;
  display: block;
  transition: opacity 200ms ease;
  image-rendering: -webkit-optimize-contrast;
}
.logo .logo-full {
  width: auto;
  height: auto;
  max-height: 52px;
  opacity: 0;
  object-fit: contain;
  object-position: center;
  display: block;
  transition: opacity 200ms ease;
  image-rendering: -webkit-optimize-contrast;
}
.sidebar:hover .logo .logo-icon { opacity: 0; }
.sidebar:hover .logo .logo-full { opacity: 1; }

.nav-group { margin-top: 8px; display: grid; gap: 6px; }

.sidebar:not(:hover) .nav-group,
.sidebar.collapsed .nav-group {
  gap: 3px;
}
.nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.5);
  position: relative;
  transition: background 0.2s ease, color 0.2s ease;
  pointer-events: auto;
  text-decoration: none;
}
.sidebar:hover .nav-item {
  justify-content: flex-start;
  width: 100%;
  height: auto;
  gap: 12px;
  padding: 10px;
}
.menu-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  display: grid;
  place-items: center;
}
.menu-icon svg {
  width: 20px;
  height: 20px;
  display: block;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  transition: color 0.2s ease, filter 0.2s ease;
}
.menu-icon--has-badge { position: relative; }
.menu-icon--has-badge::after {
  content: attr(data-badge);
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 14px;
  height: 14px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 1.5px solid #111326;
  line-height: 1;
}
.menu-icon--has-badge[data-badge="0"]::after { display: none; }
.nav-item .menu-label {
  display: none;
  white-space: nowrap;
  pointer-events: none;
  font-size: 0.86rem;
}
.nav-item .badge {
  background: var(--accent-primary);
  color: white;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease;
}
.sidebar:hover .nav-item .menu-label {
  display: inline-flex;
}
.sidebar:hover .nav-item .badge {
  display: inline-flex;
  opacity: 1;
  visibility: visible;
}
.nav-item.active {
  border-left: 3px solid currentColor;
  padding-left: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.95);
}
.nav-item.active .menu-label { color: inherit; font-weight: 600; }
.nav-item.active svg { filter: drop-shadow(0 0 4px currentColor); }
.nav-item:hover { background: rgba(255, 255, 255, 0.04); color: rgba(255, 255, 255, 0.85); }
.nav-item:hover svg { filter: brightness(1.25) drop-shadow(0 0 6px currentColor); }
.nav-item:focus-visible {
  outline: 2px solid rgba(167, 139, 250, 0.75);
  outline-offset: 1px;
}

.nav-item[data-route="home"].active { border-left-color: #a78bfa; }
.nav-item[data-route="planner"].active { border-left-color: #60a5fa; }
.nav-item[data-route="action-centre"].active { border-left-color: #f97316; }
.nav-item[data-route="journal"].active { border-left-color: #34d399; }
.nav-item[data-route="goals"].active { border-left-color: #f43f5e; }
.nav-item[data-route="sleep-routine"].active { border-left-color: #818cf8; }
.nav-item[data-route="cravings"].active { border-left-color: #fb923c; }
.nav-item[data-route="messages"].active { border-left-color: #38bdf8; }
.nav-item[data-route="community"].active { border-left-color: #a3e635; }
.nav-item[data-route="progress-tracker"].active { border-left-color: #4ade80; }
.nav-item[data-route="recovery-online"].active { border-left-color: #22d3ee; }
.nav-item[data-route="engagements"].active { border-left-color: #c084fc; }
.nav-item[data-route="resources"].active { border-left-color: #fbbf24; }

.menu-icon--home { color: #a78bfa; }
.menu-icon--planner { color: #60a5fa; }
.menu-icon--action-centre { color: #f97316; }
.menu-icon--journal { color: #34d399; }
.menu-icon--goals { color: #f43f5e; }
.menu-icon--sleep-routine { color: #818cf8; }
.menu-icon--cravings { color: #fb923c; }
.menu-icon--messages { color: #38bdf8; }
.menu-icon--community { color: #a3e635; }
.menu-icon--progress-tracker { color: #4ade80; }
.menu-icon--recovery-online { color: #22d3ee; }
.menu-icon--engagements { color: #c084fc; }
.menu-icon--resources { color: #fbbf24; }

/* Explicit collapsed mode support */
.sidebar.collapsed .nav-item .menu-label {
  display: none !important;
}
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0;
}
.sidebar.collapsed .menu-icon {
  margin: 0 auto;
}

.sidebar:not(:hover) .nav-item.active,
.sidebar.collapsed .nav-item.active {
  border-left: 2px solid currentColor;
  padding-left: 0;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.sidebar:not(:hover) .nav-item[data-route="home"].active,
.sidebar.collapsed .nav-item[data-route="home"].active {
  background: rgba(167, 139, 250, 0.14);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.28), 0 0 16px rgba(167, 139, 250, 0.28);
}
.sidebar:not(:hover) .nav-item[data-route="planner"].active,
.sidebar.collapsed .nav-item[data-route="planner"].active {
  background: rgba(96, 165, 250, 0.14);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.28), 0 0 16px rgba(96, 165, 250, 0.28);
}
.sidebar:not(:hover) .nav-item[data-route="action-centre"].active,
.sidebar.collapsed .nav-item[data-route="action-centre"].active {
  background: rgba(249, 115, 22, 0.14);
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.28), 0 0 16px rgba(249, 115, 22, 0.28);
}
.sidebar:not(:hover) .nav-item[data-route="journal"].active,
.sidebar.collapsed .nav-item[data-route="journal"].active {
  background: rgba(52, 211, 153, 0.14);
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.28), 0 0 16px rgba(52, 211, 153, 0.28);
}
.sidebar:not(:hover) .nav-item[data-route="goals"].active,
.sidebar.collapsed .nav-item[data-route="goals"].active {
  background: rgba(244, 63, 94, 0.14);
  box-shadow: inset 0 0 0 1px rgba(244, 63, 94, 0.28), 0 0 16px rgba(244, 63, 94, 0.28);
}
.sidebar:not(:hover) .nav-item[data-route="sleep-routine"].active,
.sidebar.collapsed .nav-item[data-route="sleep-routine"].active {
  background: rgba(129, 140, 248, 0.14);
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.28), 0 0 16px rgba(129, 140, 248, 0.28);
}
.sidebar:not(:hover) .nav-item[data-route="cravings"].active,
.sidebar.collapsed .nav-item[data-route="cravings"].active {
  background: rgba(251, 146, 60, 0.14);
  box-shadow: inset 0 0 0 1px rgba(251, 146, 60, 0.28), 0 0 16px rgba(251, 146, 60, 0.28);
}
.sidebar:not(:hover) .nav-item[data-route="messages"].active,
.sidebar.collapsed .nav-item[data-route="messages"].active {
  background: rgba(56, 189, 248, 0.14);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.28), 0 0 16px rgba(56, 189, 248, 0.28);
}
.sidebar:not(:hover) .nav-item[data-route="community"].active,
.sidebar.collapsed .nav-item[data-route="community"].active {
  background: rgba(163, 230, 53, 0.14);
  box-shadow: inset 0 0 0 1px rgba(163, 230, 53, 0.26), 0 0 16px rgba(163, 230, 53, 0.26);
}
.sidebar:not(:hover) .nav-item[data-route="progress-tracker"].active,
.sidebar.collapsed .nav-item[data-route="progress-tracker"].active {
  background: rgba(74, 222, 128, 0.14);
  box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.28), 0 0 16px rgba(74, 222, 128, 0.28);
}
.sidebar:not(:hover) .nav-item[data-route="recovery-online"].active,
.sidebar.collapsed .nav-item[data-route="recovery-online"].active {
  background: rgba(34, 211, 238, 0.14);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.28), 0 0 16px rgba(34, 211, 238, 0.28);
}
.sidebar:not(:hover) .nav-item[data-route="engagements"].active,
.sidebar.collapsed .nav-item[data-route="engagements"].active {
  background: rgba(192, 132, 252, 0.14);
  box-shadow: inset 0 0 0 1px rgba(192, 132, 252, 0.28), 0 0 16px rgba(192, 132, 252, 0.28);
}
.sidebar:not(:hover) .nav-item[data-route="resources"].active,
.sidebar.collapsed .nav-item[data-route="resources"].active {
  background: rgba(251, 191, 36, 0.14);
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.28), 0 0 16px rgba(251, 191, 36, 0.28);
}

.sidebar:not(:hover) .menu-icon,
.sidebar.collapsed .menu-icon {
  margin: 0 auto;
}

@keyframes aurora1 {
  0% { transform: translate(0,0) scale(1); opacity: .6; }
  33% { transform: translate(60px,-40px) scale(1.1); opacity: .8; }
  66% { transform: translate(-30px,50px) scale(.95); opacity: .5; }
  100% { transform: translate(0,0) scale(1); opacity: .6; }
}

@keyframes aurora2 {
  0% { transform: translate(0,0) scale(1); opacity: .4; }
  50% { transform: translate(-80px,30px) scale(1.15); opacity: .65; }
  100% { transform: translate(0,0) scale(1); opacity: .4; }
}

@keyframes aurora3 {
  0% { transform: translate(0,0) scale(1.05); opacity: .35; }
  40% { transform: translate(50px,60px) scale(.9); opacity: .55; }
  100% { transform: translate(0,0) scale(1.05); opacity: .35; }
}
.pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-primary);
}
#avatarWrap .pill {
  background: rgba(108, 99, 255, 0.15);
  border: 1px solid rgba(108, 99, 255, 0.4);
  color: var(--text-primary);
}
#avatarWrap .pill img,
#profileDropdown img {
  object-fit: cover;
  display: block;
}
.dropdown-wrap { position: relative; }
.header-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.clean-pill { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.35); color: #fcd34d; }
.streak-pill { background: rgba(234,88,12,0.12); border: 1px solid rgba(234,88,12,0.35); color: #fdba74; }
.strides-pill { background: rgba(124,58,237,0.14); border: 1px solid rgba(124,58,237,0.35); color: #c4b5fd; }
.score-pill { background: rgba(6,182,212,0.12); border: 1px solid rgba(6,182,212,0.35); color: #67e8f9; }
.header-pill:hover { filter: brightness(1.08); transform: translateY(-1px); }
.pill-count { font-weight: 700; }
.pill-points { opacity: 0.95; }

.th-quicklog-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  box-shadow: 0 2px 12px rgba(124,58,237,0.35);
}
.th-quicklog-btn:hover {
  background: linear-gradient(135deg, #6d28d9, #9333ea);
  box-shadow: 0 4px 20px rgba(124,58,237,0.5);
  transform: translateY(-1px);
}
.th-quicklog-btn .kbd {
  font-size: 9px;
  font-family: "JetBrains Mono", monospace;
  background: rgba(255,255,255,0.16);
  border-radius: 4px;
  padding: 1px 5px;
}
.th-ql-dropdown {
  width: 220px;
  right: 0;
  left: auto;
  padding: 8px;
}
.th-ql-dropdown .search-result-item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.th-avatar-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(124,58,237,0.45);
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}
.th-avatar-initial { font-size: 14px; font-weight: 700; }
.th-online-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  right: 2px;
  bottom: 2px;
  background: #22c55e;
  border: 1px solid #0a0a0f;
}

.header-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 320px;
  background: rgba(13,17,45,0.97);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: 16px;
  padding: 20px 24px;
  z-index: 5000;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  animation: dropdown-in 0.2s ease-out;
}
.header-dropdown,
.th-ql-dropdown,
#stridesDropdown,
#streakDropdown,
#crisisDropdown,
#profileDropdown,
.search-results-dropdown,
.goal-dropdown,
.notif-dropdown,
.profile-dropdown,
.crisis-dropdown,
.modal-content,
#coach-panel,
.ths6-search-dialog,
.ths6-quicklog-panel,
.ths6-notif-panel,
.ths6-profile-panel,
.ths6-sheet-dialog {
  background: var(--ths6-panel-bg) !important;
  border: var(--ths6-panel-border) !important;
  color: var(--ths6-panel-text) !important;
  border-color: var(--popout-neon-border) !important;
  box-shadow: var(--popout-neon-shadow) !important;
  backdrop-filter: var(--popout-glass);
  -webkit-backdrop-filter: var(--popout-glass);
}
.header-dropdown::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}
.header-dropdown[hidden] { display: none; }
@keyframes dropdown-in {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.dropdown-title { margin: 0; color: #fff; font-size: 1.05rem; }
.dropdown-subtitle { margin: 2px 0 12px; color: rgba(255,255,255,0.7); font-size: 0.8rem; }
.dropdown-body { color: rgba(255,255,255,0.85); font-size: 0.84rem; line-height: 1.55; }

#stridesDropdown,
#streakDropdown,
#crisisDropdown,
#profileDropdown {
  background: var(--ths6-panel-bg);
  border: var(--ths6-panel-border);
  box-shadow: var(--popout-neon-shadow);
}

#stridesDropdown,
#streakDropdown {
  width: 300px;
  padding: 16px;
}

.panel-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.panel-subtitle { margin-top: 2px; color: var(--text-secondary); font-size: 0.78rem; }

.strides-count,
.streak-count { margin-top: 12px; display: grid; gap: 2px; }
.strides-number,
.streak-number { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.strides-label,
.streak-label { font-size: 0.78rem; color: var(--text-secondary); }

.milestone-track,
.streak-milestones { margin-top: 14px; display: grid; gap: 10px; }
.milestone-bar { position: relative; height: 4px; background: rgba(255,255,255,0.12); border-radius: 999px; overflow: hidden; }
.milestone-bar-fill { position: absolute; left: 0; top: 0; height: 100%; background: var(--accent-primary); width: 0; border-radius: 999px; }
.milestone-nodes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.streak-milestones .milestone-nodes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.milestone-node { display: grid; justify-items: center; text-align: center; gap: 4px; }
.milestone-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent-primary); background: transparent; }
.milestone-node.is-complete .milestone-dot { background: var(--accent-primary); }
.milestone-node.is-next .milestone-dot { box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.18); }
.milestone-value { font-size: 0.7rem; font-weight: 600; color: var(--text-primary); }
.milestone-label { font-size: 0.66rem; color: var(--text-secondary); }
.points-tally { margin-top: 12px; font-size: 0.8rem; color: var(--text-secondary); }
.points-tally strong { color: var(--text-primary); }

.streak-days-row { margin-top: 12px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.streak-day { width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; font-size: 0.62rem; background: rgba(255,255,255,0.08); border: 1px solid var(--border); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.02em; }
.streak-day.is-done { background: var(--color-amber); border-color: var(--color-amber); color: #2a1a00; }
.streak-day.is-future { opacity: 0.5; }
.streak-day.is-today { position: relative; }
.streak-day.is-today::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.8);
  animation: streak-pulse 2.2s ease-in-out infinite;
}
@keyframes streak-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}
.streak-next { margin-top: 10px; font-size: 0.78rem; color: var(--text-secondary); }
.streak-best { margin-top: 4px; font-size: 0.76rem; color: var(--text-secondary); }

.bell {
  color: #ffffff;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}
.bell svg { stroke: #ffffff; }
.bell:hover { color: rgba(167,139,250,0.9); }
.bell:hover svg { stroke: rgba(167,139,250,0.9); }
.bell .badge { position: absolute; top: 6px; right: 6px; background: var(--accent-red); color: white; font-size: 10px; padding: 2px 6px; border-radius: 999px; }

.header-search-wrap { position: relative; display: flex; align-items: center; gap: 8px; }
.header-search-btn { background: none; border: none; color: #ffffff; cursor: pointer; padding: 6px; border-radius: 8px; display: flex; align-items: center; }
.header-search-btn:hover { background: rgba(255,255,255,0.1); color: rgba(167,139,250,0.9); }
.header-search-input {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(124,58,237,0.4);
  border-radius: 20px;
  padding: 6px 14px;
  color: #ffffff;
  font-size: 0.82rem;
  outline: none;
  width: 0;
  opacity: 0;
  transition: width 0.25s ease-out, opacity 0.25s ease-out;
  pointer-events: none;
}
.header-search-input.is-open { width: 220px; opacity: 1; pointer-events: auto; }
.header-search-input::placeholder { color: rgba(255,255,255,0.4); }
.search-results-dropdown { width: 280px; top: calc(100% + 8px); }
.search-section-title { margin: 10px 0 6px; font-size: 0.72rem; color: rgba(255,255,255,0.62); text-transform: uppercase; letter-spacing: 0.06em; }
.search-result-item { font-size: 0.8rem; padding: 8px 10px; border-radius: 8px; color: rgba(255,255,255,0.88); }
.search-result-item:hover { background: rgba(255,255,255,0.06); }

.header-goal-ring { position: relative; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.goal-ring-fill { transition: stroke-dashoffset 0.2s linear; }
.goal-ring-pct { position: absolute; font-size: 0.52rem; font-weight: 700; color: #ffffff; line-height: 1; }
.goal-dropdown { width: 340px; left: auto; right: 0; padding: 16px; }
.goal-item { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; font-size: 0.8rem; color: rgba(255,255,255,0.86); }
.goal-note { margin-top: 8px; font-size: 0.78rem; color: #d8b4fe; line-height: 1.5; }
.notif-dropdown { width: 340px; max-height: 400px; overflow-y: auto; left: auto; right: 0; }
.notif-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.notif-title { margin: 0; color: #fff; font-size: 1rem; }
.mark-read { background: none; border: none; color: #c4b5fd; font-size: 0.75rem; cursor: pointer; }
.notif-item { border-left: 3px solid transparent; padding: 10px 10px 10px 12px; border-radius: 10px; margin-bottom: 8px; background: rgba(255,255,255,0.03); }
.notif-item.unread { background: rgba(255,255,255,0.08); }
.notif-item.purple { border-left-color: #a78bfa; }
.notif-item.green { border-left-color: #4ade80; }
.notif-item.blue { border-left-color: #60a5fa; }
.notif-item strong { display: block; color: #fff; font-size: 0.84rem; margin-bottom: 4px; }
.notif-item span { color: rgba(255,255,255,0.68); font-size: 0.74rem; }

.avatar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border); padding: 6px 10px; border-radius: 999px; cursor: pointer;
}
.avatar img { width: 28px; height: 28px; border-radius: 50%; }
.profile-dropdown {
  width: auto;
  min-width: 240px;
  left: auto;
  right: 0;
  padding: 8px;
  border-radius: 14px;
  overflow: hidden;
}
.profile-menu { display: grid; gap: 4px; }
.profile-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.profile-item:hover { background: var(--bg-card-hover); }
.profile-divider { border-top: 1px solid var(--border); margin: 4px 0; }
.profile-inline-panel {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  margin: 4px 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.profile-panel-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.profile-panel-row strong { color: var(--text-primary); }
.profile-panel-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.profile-panel-input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.8rem;
}
.profile-panel-save {
  background: var(--accent-primary);
  border: none;
  color: #ffffff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.profile-panel-save:hover { filter: brightness(1.05); }
.profile-soon {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
}
.profile-select {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.78rem;
}
.profile-toggle { accent-color: var(--accent-primary); width: 16px; height: 16px; }

.crisis-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(230, 57, 70, 0.15);
  border: 1px solid rgba(230, 57, 70, 0.5);
  border-radius: 20px;
  color: #ff6b7a;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.crisis-btn:hover { background: rgba(230, 57, 70, 0.25); }
.crisis-dropdown { width: 320px; left: auto; right: 0; padding: 16px; }
.crisis-panel-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.crisis-panel-subtitle { margin-top: 2px; font-size: 0.78rem; color: var(--text-secondary); }
.crisis-panel-section { margin-top: 12px; display: grid; gap: 10px; }
.crisis-row { display: flex; gap: 10px; align-items: flex-start; }
.crisis-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,0.06); }
.crisis-row-title { font-size: 0.82rem; font-weight: 700; color: var(--text-primary); }
.crisis-row-detail { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }
.crisis-divider { margin: 12px 0; border-top: 1px solid var(--border); }
.crisis-safety-title { font-size: 0.82rem; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.crisis-list { margin: 0; padding-left: 18px; color: var(--text-secondary); font-size: 0.78rem; display: grid; gap: 6px; }
.crisis-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  width: 100%;
  background: #e63946;
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  text-decoration: none;
}
.clean-time-panel { padding: 0 16px 12px; display: grid; gap: 8px; }
.clean-time-panel input { border: 1px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.08); color: #fff; border-radius: 8px; padding: 7px 9px; }
.clean-time-panel button { border: 1px solid rgba(124,58,237,0.55); background: rgba(124,58,237,0.2); color: #e9ddff; border-radius: 8px; padding: 7px 9px; cursor: pointer; }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--toast-bg); border: 1px solid var(--toast-border); color: var(--toast-text); border-radius: 10px; padding: 10px 12px; z-index: 1100; }
.toast[hidden] { display: none; }

.card {
  background: rgba(10, 7, 28, 0.6);
  border: 1px solid rgba(124, 58, 237, 0.14);
  border-radius: 16px;
  box-shadow: rgba(0, 0, 0, 0.4) 0px 8px 32px 0px,
              rgba(255, 255, 255, 0.04) 0px 1px 0px 0px inset;
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  padding: 24px;
}

.page-main {
  margin-left: var(--sidebar-collapsed);
  padding: 24px 24px 48px;
  display: grid;
  gap: 24px;
}

.page-title { font-size: 28px; font-weight: 700; margin: 0; }
.page-subtitle { margin: 6px 0 0; color: var(--text-secondary); }

.page-card {
  background: rgba(10, 7, 28, 0.6);
  border: 1px solid rgba(124, 58, 237, 0.14);
  border-radius: 16px;
  box-shadow: rgba(0, 0, 0, 0.4) 0px 8px 32px 0px,
              rgba(255, 255, 255, 0.04) 0px 1px 0px 0px inset;
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  padding: 24px;
  display: grid;
  gap: 12px;
}
.page-card .placeholder { color: var(--text-secondary); font-size: 0.95rem; }
.page-card .primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  width: fit-content;
}

.journal-progress-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.journal-metric {
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}
.journal-metric .metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.journal-metric .metric-toggle {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 2px;
  border-radius: 999px;
}
.journal-metric .toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  cursor: pointer;
}
.journal-metric .toggle-btn.active {
  background: var(--accent-primary);
  color: white;
}
.journal-metric .label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.journal-metric .value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.journal-metric .subvalue {
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.pt-week-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.pt-week-row .day-cell {
  height: 32px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  font-size: 0.75rem;
}
.pt-week-row .day-cell.done {
  color: white;
  background: linear-gradient(135deg, #6C63FF, #9c94ff);
  border: none;
}
.pt-week-row .day-cell.today {
  color: white;
  background: linear-gradient(135deg, #00c8aa, #6C63FF);
  border: none;
}
.pt-week-row .day-cell.missed { opacity: 0.4; }
.pt-week-row .day-cell.future { opacity: 0.25; }
.pt-week-note { color: var(--text-secondary); font-size: 0.85rem; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--bg-card, #1a1d35);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 460px;
  width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  color: var(--text-primary, #fff);
}

@media (max-width: 900px) {
  .journal-progress-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .header { left: 0; }
  .page-main { margin-left: 0; }
}

.snap-journal-value.is-amber { color: #f59e0b; }
.snap-journal-value.is-teal { color: #00c8aa; }
/* ===== THRIVE RECOVERY COACH WIDGET ===== */
#thrive-coach-root {
  position: fixed;
  bottom: 28px;
  right: 44px;
  z-index: 9999;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  pointer-events: none;
}
/* FAB Button */
#coach-fab {
  pointer-events: all;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6c63ff 0%, #a78bfa 50%, #38bdf8 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(108, 99, 255, 0.55), 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  position: relative;
  color: white;
  flex-shrink: 0;
  touch-action: pan-y;
  cursor: grab;
}
#coach-fab:active { cursor: grabbing; }
body.coach-fab-dragging #coach-fab { cursor: grabbing; }
#coach-fab:hover {
  transform: scale(1.12) translateY(-3px);
  box-shadow: 0 16px 48px rgba(108, 99, 255, 0.7);
}
#coach-fab:active { transform: scale(0.97); }
.coach-fab-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.coach-fab-icon {
  width: 60px;
  height: 60px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  transform: scale(1.9);
  transform-origin: center;
  pointer-events: none;
  flex-shrink: 0;
}
.coach-fab-live {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #10b981;
  color: #fff;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 5px;
  border-radius: 20px;
  text-transform: uppercase;
  border: 2px solid #1a1a2e;
  animation: coach-live-glow 2s ease-in-out infinite alternate;
}
@keyframes coach-live-glow {
  from { box-shadow: 0 0 6px rgba(16, 185, 129, 0.6); }
  to { box-shadow: 0 0 14px rgba(16, 185, 129, 1); }
}
.coach-fab-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 3px solid rgba(108, 99, 255, 0.5);
  animation: coach-pulse 2.2s ease-out infinite;
  pointer-events: none;
}
@keyframes coach-pulse {
  0% { opacity: 1; transform: scale(1); }
  70%, 100% { opacity: 0; transform: scale(1.5); }
}
#coach-fab.coach-fab-open .coach-fab-pulse { display: none; }
#coach-fab.coach-fab-open { transform: scale(0.92); }
/* Context badge (green dot on relevant pages) */
.coach-context-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #0B0C1E;
  animation: badge-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes badge-pop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}
/* Chat Panel */
#coach-panel {
  pointer-events: all;
  width: 400px;
  max-height: 620px;
  background: rgba(16, 14, 38, 0.97);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(108, 99, 255, 0.35);
  border-radius: 24px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05) inset, 0 8px 32px rgba(108, 99, 255, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom right;
  position: relative;
}
.coach-panel-drag-handle {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(90deg, transparent, rgba(108, 99, 255, 0.4), rgba(56, 189, 248, 0.4), transparent);
}
#coach-panel::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(108, 99, 255, 0.8), rgba(56, 189, 248, 0.6), transparent);
  pointer-events: none;
}
#coach-panel[hidden] { display: none; }
@keyframes coach-panel-in {
  from { opacity: 0; transform: scale(0.88) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
/* Panel Header */
.coach-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(108, 99, 255, 0.25);
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.4) 0%, rgba(167, 139, 250, 0.2) 50%, rgba(56, 189, 248, 0.15) 100%);
  flex-shrink: 0;
  position: relative;
}
.coach-header-info { display: flex; align-items: center; gap: 10px; }
.coach-avatar-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6c63ff, #a78bfa, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(108, 99, 255, 0.4);
}
.coach-avatar-image {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: none;
  pointer-events: none;
}
.coach-avatar-glyph {
  font-size: 20px;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.coach-panel-title { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; }
.coach-panel-subtitle { font-size: 11px; color: rgba(167, 139, 250, 0.85); margin-top: 2px; font-weight: 500; }
.coach-header-actions { display: flex; align-items: center; gap: 6px; }
.coach-header-actions button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 14px;
}
.coach-header-actions button:hover {
  background: rgba(108, 99, 255, 0.3);
  border-color: rgba(108, 99, 255, 0.5);
  color: #fff;
  transform: scale(1.1);
}
#coach-clear-btn {
  font-size: 13px;
  line-height: 1;
}
/* Messages Area */
.coach-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.coach-messages::-webkit-scrollbar { width: 4px; }
.coach-messages::-webkit-scrollbar-track { background: transparent; }
.coach-messages::-webkit-scrollbar-thumb { background: rgba(108, 99, 255, 0.3); border-radius: 4px; }
/* Message bubbles */
.coach-msg { display: flex; max-width: 88%; }
.coach-msg-assistant { align-self: flex-start; }
.coach-msg-user { align-self: flex-end; flex-direction: row-reverse; }
.coach-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}
.coach-msg-assistant .coach-bubble {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.92);
  border-bottom-left-radius: 6px;
}
.coach-msg-user .coach-bubble {
  background: linear-gradient(135deg, #6c63ff, #a78bfa);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 14px rgba(108, 99, 255, 0.35);
}
.coach-msg-assistant .coach-bubble strong { color: #c4b5fd; }
.coach-msg-assistant .coach-bubble a { color: #a78bfa; text-decoration: underline; }
/* Typing indicator */
.coach-typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
}
.coach-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6C63FF;
  animation: coach-typing-bounce 1.2s ease-in-out infinite;
}
.coach-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.coach-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes coach-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
  30% { transform: translateY(-6px); opacity: 1; }
}
/* Quick chips */
.coach-quick-chips {
  padding: 6px 14px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.08);
}
.coach-chip {
  background: rgba(108, 99, 255, 0.1);
  border: 1px solid rgba(108, 99, 255, 0.35);
  color: rgba(167, 139, 250, 0.9);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-family: inherit;
}
.coach-chip:hover {
  background: rgba(108, 99, 255, 0.28);
  border-color: rgba(108, 99, 255, 0.6);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 99, 255, 0.25);
}
/* Input area */
.coach-input-area {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}
.coach-mode-controls {
  display: inline-flex;
  gap: 6px;
}
.coach-mode-btn {
  border: 1px solid rgba(108, 99, 255, 0.28);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  height: 28px;
  padding: 0 11px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
}
.coach-mode-btn.is-active {
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.9), rgba(167, 139, 250, 0.88));
  color: #fff;
  border-color: rgba(167, 139, 250, 0.9);
}
.coach-voice-popout {
  position: fixed;
  right: 16px;
  bottom: 84px;
  width: 250px;
  border-radius: 14px;
  border: 1px solid rgba(108, 99, 255, 0.28);
  background: linear-gradient(160deg, rgba(14, 16, 34, 0.96), rgba(26, 16, 64, 0.9));
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
  z-index: 10001;
  padding: 10px 12px 12px;
}
.coach-voice-popout[hidden] { display: none; }
.coach-voice-popout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.coach-voice-popout-title {
  font-size: 12px;
  font-weight: 700;
  color: #efeaff;
}
#coach-voice-popout-close {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(108, 99, 255, 0.3);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
}
.coach-voice-wave {
  height: 24px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin-bottom: 8px;
}
.coach-voice-wave span {
  width: 4px;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.88);
  height: 8px;
}
.coach-voice-wave.speaking span {
  animation: coach-voice-wave 0.85s ease-in-out infinite;
  background: rgba(56, 189, 248, 0.92);
}
.coach-voice-wave.listening span {
  animation: coach-voice-wave 0.55s ease-in-out infinite;
  background: rgba(251, 113, 133, 0.95);
}
.coach-voice-wave.thinking span {
  animation: coach-voice-wave 1.25s ease-in-out infinite;
  background: rgba(250, 204, 21, 0.9);
}
.coach-voice-wave span:nth-child(2) { animation-delay: 0.08s; }
.coach-voice-wave span:nth-child(3) { animation-delay: 0.16s; }
.coach-voice-wave span:nth-child(4) { animation-delay: 0.24s; }
.coach-voice-wave span:nth-child(5) { animation-delay: 0.32s; }
.coach-voice-status {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.82);
}
@keyframes coach-voice-wave {
  0%, 100% { transform: scaleY(0.45); opacity: 0.55; }
  50% { transform: scaleY(1.15); opacity: 1; }
}
.coach-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
#coach-input[hidden] { display: none; }
#coach-mic-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(108, 99, 255, 0.35);
  background: rgba(108, 99, 255, 0.14);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#coach-mic-btn.is-listening {
  background: linear-gradient(135deg, #ef4444, #f97316);
  border-color: rgba(248, 113, 113, 0.9);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.24);
}
#coach-mic-btn.is-speaking {
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  border-color: rgba(56, 189, 248, 0.9);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}
#coach-mic-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
#coach-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(108, 99, 255, 0.25);
  border-radius: 18px;
  padding: 9px 13px;
  color: #fff;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  resize: none;
  min-height: 40px;
  height: 40px;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#coach-input:focus {
  border-color: rgba(108, 99, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.12);
}
#coach-input::placeholder { color: rgba(255, 255, 255, 0.3); }
#coach-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6c63ff, #a78bfa);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  color: white;
  box-shadow: 0 4px 12px rgba(108, 99, 255, 0.4);
}
#coach-send-btn:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(108, 99, 255, 0.55);
}
#coach-send-btn:disabled { background: #2a2b4a; cursor: not-allowed; opacity: 0.5; box-shadow: none; }
#coach-send-btn.loading { animation: coach-send-pulse 0.8s ease-in-out infinite; }
@keyframes coach-send-pulse { 0%,100%{ opacity:1; } 50%{ opacity:0.5; } }
#coach-send-btn svg { width: 16px; height: 16px; }
/* Disclaimer */
.coach-disclaimer {
  padding: 6px 14px 10px;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.38);
  text-align: center;
  line-height: 1.4;
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.coach-disclaimer .coach-brand {
  background: linear-gradient(90deg, #a78bfa, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  font-weight: 600;
}
.coach-clear-confirm {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: rgba(10, 10, 22, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.coach-clear-confirm[hidden] { display: none; }
.coach-clear-card {
  width: 100%;
  max-width: 320px;
  border-radius: 16px;
  border: 1px solid rgba(108, 99, 255, 0.45);
  background: linear-gradient(180deg, rgba(29, 24, 64, 0.98), rgba(20, 18, 45, 0.98));
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  padding: 14px;
}
.coach-clear-title {
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}
.coach-clear-copy {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 1.45;
}
.coach-clear-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.coach-clear-actions button {
  border-radius: 10px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(108, 99, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
#coach-clear-confirm-btn {
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  border-color: rgba(167, 139, 250, 0.8);
}
/* Mobile responsive */
@media (max-width: 640px) {
  #thrive-coach-root { bottom: 16px; right: 16px; left: 16px; align-items: flex-end; }
  #coach-panel { width: calc(100vw - 32px); max-height: 70vh; border-radius: 20px 20px 16px 16px; }
  #coach-fab { width: 56px; height: 56px; }
  .coach-voice-popout {
    right: 16px;
    left: 16px;
    width: auto;
    bottom: 84px;
  }
}
/* Hide coach on pages where it would conflict (admin portal only) */
body.admin-portal #thrive-coach-root { display: none; }
body.messages-page #thrive-coach-root { display: none !important; }

/* Header refresh: aligned with frontend-next ThriveHeader */
#thrive-header {
  position: sticky;
  top: 0;
  z-index: 200;
  width: 100%;
  isolation: isolate;
  overflow: hidden;
  transition: box-shadow 0.24s ease;
}

#thrive-header.scrolled {
  box-shadow: 0 12px 24px rgba(6, 8, 25, 0.34);
}

#thrive-header .th-aurora-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(18, 6, 44, 1), rgb(10, 4, 30));
}

#thrive-header .th-aurora-blob-1,
#thrive-header .th-aurora-blob-2,
#thrive-header .th-aurora-blob-3 {
  position: absolute;
  top: -50%;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(20px);
}

#thrive-header .th-aurora-blob-1 {
  left: -8%;
  width: 55%;
  height: 400%;
  background: radial-gradient(rgba(124, 58, 237, 0.85) 0%, rgba(109, 40, 217, 0.55) 35%, transparent 70%);
  animation: aurora1 14s ease-in-out infinite;
}

#thrive-header .th-aurora-blob-2 {
  left: 26%;
  width: 50%;
  height: 400%;
  background: radial-gradient(rgba(6, 182, 212, 0.6) 0%, rgba(14, 165, 233, 0.32) 40%, transparent 70%);
  animation: aurora2 18s ease-in-out infinite;
}

#thrive-header .th-aurora-blob-3 {
  right: -8%;
  width: 48%;
  height: 400%;
  background: radial-gradient(rgba(196, 165, 253, 0.55) 0%, rgba(168, 85, 247, 0.32) 40%, transparent 70%);
  animation: aurora3 22s ease-in-out infinite;
}

#thrive-header .th-aurora-shimmer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.06) 49%, transparent 78%);
  transform: translateX(-120%) skewX(-12deg);
  animation: auroraShimmer 7s ease-in-out 1.5s infinite;
}

#thrive-header .th-aurora-seam {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124, 58, 237, 0.8) 25%, rgba(6, 182, 212, 0.6) 55%, rgba(196, 165, 253, 0.5) 75%, transparent);
  animation: seamPulse 3s ease-in-out infinite;
}

#thrive-header .th-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 52px 52px 2px;
}

#thrive-header .th-top-row {
  min-height: 0;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(42, 43, 74, 0.65);
}

#thrive-header .th-greeting-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#thrive-header .th-greeting {
  margin: 0;
  color: #9395b0;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 500;
}

#thrive-header .th-user-name {
  margin: 0;
  color: #f0f0ff;
  font-size: 16px;
  line-height: 1.1;
  font-weight: 700;
}

#thrive-header .th-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#thrive-header .th-quick-btn,
#thrive-header .th-icon-btn {
  border: 1px solid rgba(42, 43, 74, 0.95);
  border-radius: 10px;
  background: rgba(20, 21, 48, 0.82);
  color: #f0f0ff;
  height: 36px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
}

#thrive-header .th-quick-btn {
  border-color: rgba(167, 139, 250, 0.65);
  background: linear-gradient(180deg, rgba(108, 99, 255, 0.22), rgba(108, 99, 255, 0.1));
  font-size: 13px;
  font-weight: 600;
}

#thrive-header .th-icon-btn {
  width: 36px;
  padding: 0;
}

#thrive-header .th-quick-btn:hover,
#thrive-header .th-icon-btn:hover {
  border-color: rgba(167, 139, 250, 0.85);
}

#thrive-header .th-quick-btn svg,
#thrive-header .th-icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

#thrive-header .th-notification-dot {
  position: absolute;
  top: -6px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #f07167;
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  font-weight: 700;
  text-align: center;
}

#thrive-header .th-bottom-row {
  min-height: 0;
  padding: 6px 8px 8px;
}

#thrive-header .th-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#thrive-header .th-stat-card {
  background: rgba(20, 21, 48, 0.74);
  border: 1px solid rgba(42, 43, 74, 0.9);
  border-radius: 10px;
  color: #f0f0ff;
  height: 44px;
  padding: 4px 8px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  text-align: left;
  cursor: default;
}

#thrive-header .th-stat-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

#thrive-header .th-stat-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex-shrink: 0;
}

#thrive-header .th-stat-label {
  font-size: 10px;
  line-height: 1;
  color: #9395b0;
  letter-spacing: 0.01em;
  font-weight: 500;
}

#thrive-header .th-stat-value {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
  color: #f0f0ff;
}

#thrive-header .th-stat-hint {
  font-size: 9px;
  line-height: 1.1;
  color: #5c5e7a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#thrive-header .th-progress-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

#thrive-header .th-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 1.8s cubic-bezier(0.22, 1, 0.36, 1);
}

#thrive-header .th-mobile-rail {
  height: 2px;
  overflow: hidden;
}

#thrive-header .th-mobile-pulse {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(124, 58, 237, 0.9), rgba(6, 182, 212, 0.8), rgba(196, 165, 253, 0.7), transparent);
  animation: seamPulse 3s ease-in-out infinite;
}

#thrive-header .dot-purple { background: #6c63ff; }
#thrive-header .dot-purple-light { background: #a78bfa; }
#thrive-header .dot-teal { background: #00c9a7; }
#thrive-header .dot-amber { background: #f4a261; }
#thrive-header .dot-sage { background: #52b788; }
#thrive-header .dot-rose { background: #f07167; }
#thrive-header .grad-purple { background: linear-gradient(90deg, #6c63ff, #a78bfa); }
#thrive-header .grad-purple-light { background: linear-gradient(90deg, #a78bfa, rgba(196, 165, 253, 0.9)); }
#thrive-header .grad-teal { background: linear-gradient(90deg, rgba(6, 182, 212, 0.9), #00c9a7); }
#thrive-header .grad-amber { background: linear-gradient(90deg, rgba(251, 191, 36, 0.95), #f4a261); }
#thrive-header .grad-sage { background: linear-gradient(90deg, rgba(52, 211, 153, 0.95), #52b788); }
#thrive-header .grad-rose { background: linear-gradient(90deg, rgba(251, 113, 133, 0.95), #f07167); }

@media (min-width: 768px) {
  #thrive-header .th-inner {
    grid-template-rows: 56px 52px;
  }

  #thrive-header .th-top-row {
    padding: 8px 20px;
  }

  #thrive-header .th-bottom-row {
    padding: 6px 20px 8px;
  }

  #thrive-header .th-stats-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  #thrive-header .th-stat-card {
    height: 38px;
  }

  #thrive-header .th-stat-hint {
    display: none;
  }

  #thrive-header .th-mobile-rail {
    display: none;
  }
}

@media (min-width: 1200px) {
  #thrive-header .th-inner {
    height: 64px;
    grid-template-rows: 64px;
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  #thrive-header .th-top-row {
    height: 64px;
    border-bottom: 0;
    padding: 0 16px;
    gap: 16px;
    min-width: 330px;
  }

  #thrive-header .th-greeting-wrap {
    min-width: 130px;
  }

  #thrive-header .th-bottom-row {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 16px 0 0;
  }

  #thrive-header .th-stats-grid {
    width: 100%;
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  #thrive-header .th-stat-card {
    height: 44px;
  }
}

@keyframes auroraShimmer {
  0% { transform: translateX(-120%) skewX(-12deg); opacity: 0; }
  35% { opacity: 0.06; }
  50% { transform: translateX(0) skewX(-12deg); opacity: 0.06; }
  100% { transform: translateX(120%) skewX(-12deg); opacity: 0; }
}

@keyframes seamPulse {
  0% { opacity: 0.7; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}
/* ═══════════════════════════════════════════════════════
   Thrive Header S6 · Prism Glass · Purple Spectrum
   Append to static/shell.css — do not remove existing rules
   ═══════════════════════════════════════════════════════ */

/* ── Keyframes ────────────────────────────────────────── */
@keyframes ths6-aurora {
  0%   { background-position: 0%   50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0%   50%; }
}
@keyframes ths6-spin {
  from { transform: rotate(0deg);   }
  to   { transform: rotate(360deg); }
}
@keyframes ths6-hc-bar {
  from { width: 0; }
  to   { width: var(--bar-w, 50%); }
}

/* ── Header shell ────────────────────────────────────── */
.ths6 {
  position: sticky;
  top: 0;
  z-index: 200;
  width: 100%;
  max-width: 100vw;
  height: 68px;
  min-height: 68px;
  height: var(--header-h, 68px);
  background:
    linear-gradient(180deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,0) 22%),
    var(--ths6-header-bg);
  border-bottom: 1px solid rgba(96, 165, 250, .22);
  box-shadow:
    0 10px 30px rgba(2, 6, 23, .45),
    inset 0 1px 0 rgba(255, 255, 255, .24);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  overflow: visible;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #F0F0FF;
}

/* ── Prismatic top bar ───────────────────────────────── */
.ths6-prism-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--ths6-prism-bar-bg);
  background-size: 300%;
  animation: ths6-aurora 5s ease infinite;
  box-shadow: var(--ths6-prism-shadow);
}

/* ── Full-bleed aurora body ──────────────────────────── */
.ths6-aurora {
  position: absolute;
  inset: 0;
  background: var(--ths6-aurora-bg);
  background-size: 400%;
  animation: ths6-aurora 9s ease infinite;
  pointer-events: none;
}

/* ── Prism light cone ────────────────────────────────── */
.ths6-prism-cone {
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 340px;
  height: 100%;
  background: linear-gradient(
    180deg,
    rgba(99, 102, 241, .07) 0%,
    transparent 100%
  );
  clip-path: polygon(38% 0%, 62% 0%, 82% 100%, 18% 100%);
  pointer-events: none;
}

/* ── Inner flex row ──────────────────────────────────── */
.ths6-inner {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 24px;
  gap: 0px;
  z-index: 1;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* ── Logo ────────────────────────────────────────────── */
.ths6-logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  width: clamp(120px, 18vw, 186px);
  max-width: 186px;
  min-width: 0;
  height: 50px;
  margin-right: 4px;
  overflow: visible;
}
.ths6-logo {
  width: 100%;
  height: auto;
  max-height: 46px;
  object-fit: contain;
  object-position: left center;
  display: block;
  max-width: 100%;
  transform: none;
  filter: brightness(0) invert(1);
  image-rendering: auto;
  image-rendering: -webkit-optimize-contrast;
}
.ths6-logo-fallback {
  display: none;
  align-items: center;
  font-size: 16px;
  font-weight: 800;
  color: #DDD6FE;
  letter-spacing: -.01em;
}

/* ── Vertical divider ────────────────────────────────── */
.ths6-divider {
  width: 1.5px;
  height: 26px;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(167, 139, 250, .35),
    transparent
  );
  flex-shrink: 0;
}

/* ── Identity ────────────────────────────────────────── */
.ths6-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 1;
  min-width: 0;
}

/* Desktop: stable logo/divider/identity alignment */
@media (min-width: 961px) {
  .ths6-logo-link {
    margin-left: 0;
    margin-right: 4px;
  }
  .ths6-divider {
    margin-left: 4px;
    margin-right: 8px;
  }
  .ths6-identity {
    margin-left: 0px;
  }
}

/* Spinning conic ring avatar */
.ths6-avatar-ring {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.ths6-avatar-spin {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    #7C3AED, #4F46E5, #3B82F6,
    #6366F1, #818CF8, #4F46E5, #7C3AED
  );
  animation: ths6-spin 6s linear infinite;
}
.ths6-avatar-inner {
  position: absolute;
  inset: 2.5px;
  border-radius: 50%;
  background: var(--ths6-avatar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: var(--ths6-avatar-text);
  text-shadow: 0 0 10px rgba(124, 58, 237, .6);
  box-shadow: 0 0 18px rgba(124, 58, 237, .4);
}

.ths6-user-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ths6-greeting {
  font-size: 13px;
  color: #F0F0FF;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ths6-clean {
  font-size: 13px;
  color: #5C5E7A;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ths6-clean-num {
  color: #A78BFA;
  font-weight: 700;
}

/* ── Search bar ──────────────────────────────────────── */
.ths6-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 360px;
  margin-left: 14px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(167, 139, 250, .18);
  border-radius: 10px;
  height: 36px;
  padding: 0 12px;
  cursor: text;
  backdrop-filter: blur(8px);
  transition: border-color .2s, background .2s, box-shadow .2s;
  color: inherit;
  font-family: inherit;
}
.ths6-search:hover,
.ths6-search:focus-visible {
  border-color: rgba(167, 139, 250, .5);
  background: rgba(255, 255, 255, .07);
  box-shadow: 0 0 20px rgba(99, 102, 241, .15);
  outline: none;
}
.ths6-search-icon { flex-shrink: 0; }
.ths6-search-txt {
  font-size: 12px;
  color: rgba(221, 214, 254, .35);
  flex: 1;
  text-align: left;
  white-space: nowrap;
}
.ths6-kbd {
  font-size: 10px;
  color: rgba(221, 214, 254, .4);
  background: rgba(255, 255, 255, .06);
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid rgba(167, 139, 250, .2);
  font-family: inherit;
}

/* ── Quick Log CTA ───────────────────────────────────── */
.ths6-log-btn {
  background: linear-gradient(90deg, #1E40AF, #1D4ED8, #2563EB, #4F46E5);
  border: 1px solid rgba(96, 165, 250, .38);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 0 18px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  letter-spacing: .02em;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow:
    0 0 20px rgba(37, 99, 235, .42),
    inset 0 1.5px 0 rgba(255, 255, 255, .2),
    inset 0 -1px 0 rgba(0, 0, 0, .15);
  transition: box-shadow .2s, transform .15s;
}
.ths6-log-btn:hover {
  box-shadow:
    0 0 32px rgba(37, 99, 235, .62),
    inset 0 1.5px 0 rgba(255, 255, 255, .2);
  transform: translateY(-1px);
}
.ths6-log-btn:active {
  transform: translateY(0);
}

/* ── Stat rings nav ──────────────────────────────────── */
.ths6-rings {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 0;
  opacity: 0;
  transform: translateX(34px);
  max-width: 0;
  overflow: hidden;
  pointer-events: none;
  transition:
    opacity 2000ms cubic-bezier(.22,.61,.36,1),
    transform 2000ms cubic-bezier(.22,.61,.36,1),
    max-width 2000ms cubic-bezier(.22,.61,.36,1),
    margin-left 2000ms cubic-bezier(.22,.61,.36,1);
}
#thrive-header.ths6-rings-open .ths6-rings {
  opacity: 1;
  transform: translateX(0);
  max-width: 560px;
  pointer-events: auto;
}

.ths6-rings-hotspot {
  margin-left: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(124, 58, 237, .55);
  background:
    radial-gradient(circle at 30% 30%, rgba(167, 139, 250, .36), rgba(99, 102, 241, .16) 52%, rgba(59, 130, 246, .10) 100%);
  color: #c4b5fd;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow:
    0 0 18px rgba(124, 58, 237, .35),
    0 0 34px rgba(99, 102, 241, .18),
    inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: transform 220ms cubic-bezier(.4,0,.2,1), box-shadow 220ms cubic-bezier(.4,0,.2,1), opacity 220ms cubic-bezier(.4,0,.2,1);
  animation: ths6-hotspotPulse 1.9s ease-in-out infinite;
}
.ths6-rings-hotspot svg {
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 0 6px rgba(167, 139, 250, .7));
}
.ths6-rings-hotspot:hover,
.ths6-rings-hotspot:focus-visible {
  transform: translateY(-1px) scale(1.03);
  box-shadow:
    0 0 24px rgba(124, 58, 237, .55),
    0 0 42px rgba(99, 102, 241, .3),
    inset 0 1px 0 rgba(255, 255, 255, .24);
  outline: none;
}
#thrive-header.ths6-rings-open .ths6-rings-hotspot {
  opacity: 0;
  pointer-events: none;
  transform: scale(.92);
}

@keyframes ths6-hotspotPulse {
  0%, 100% { box-shadow: 0 0 16px rgba(124, 58, 237, .30), 0 0 28px rgba(99, 102, 241, .16), inset 0 1px 0 rgba(255,255,255,.18); }
  50% { box-shadow: 0 0 22px rgba(124, 58, 237, .52), 0 0 40px rgba(99, 102, 241, .28), inset 0 1px 0 rgba(255,255,255,.24); }
}

/* Each ring wrapper */
.ths6-stat-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 52px;
  cursor: default;
  opacity: 0;
  transform: translateX(18px);
  transition:
    opacity 2000ms cubic-bezier(.22,.61,.36,1),
    transform 2000ms cubic-bezier(.22,.61,.36,1);
}
#thrive-header.ths6-rings-open .ths6-stat-wrap {
  opacity: 1;
  transform: translateX(0);
}
#thrive-header.ths6-rings-open .ths6-stat-wrap:nth-child(1) { transition-delay: 0ms; }
#thrive-header.ths6-rings-open .ths6-stat-wrap:nth-child(2) { transition-delay: 0ms; }
#thrive-header.ths6-rings-open .ths6-stat-wrap:nth-child(3) { transition-delay: 0ms; }
#thrive-header.ths6-rings-open .ths6-stat-wrap:nth-child(4) { transition-delay: 0ms; }
#thrive-header.ths6-rings-open .ths6-stat-wrap:nth-child(5) { transition-delay: 0ms; }
#thrive-header.ths6-rings-open .ths6-stat-wrap:nth-child(6) { transition-delay: 0ms; }

@media (hover: none), (max-width: 960px) {
  .ths6-rings-hotspot {
    display: none;
  }
  .ths6-rings {
    opacity: 1;
    transform: none;
    max-width: none;
    overflow: visible;
    pointer-events: auto;
  }
  .ths6-stat-wrap {
    opacity: 1;
    transform: none;
  }
}
.ths6-ring-outer {
  position: relative;
  width: 52px;
  height: 52px;
}
.ths6-ring-val {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 0 1px currentColor;
}
.ths6-ring-lbl {
  font-size: 9.5px;
  color: #F0F0FF;
  letter-spacing: .04em;
  text-align: center;
  white-space: nowrap;
}

/* ── Hover card ──────────────────────────────────────── */
.ths6-hover-card {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: var(--ths6-panel-bg);
  border: var(--ths6-panel-border);
  border-radius: 16px;
  padding: 16px 18px;
  min-width: 200px;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  box-shadow: var(--popout-neon-shadow);
  backdrop-filter: blur(12px);
  white-space: nowrap;
}
.ths6-stat-wrap:hover .ths6-hover-card {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.ths6-hc-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .09em;
  font-weight: 600;
  margin-bottom: 8px;
}
.ths6-hc-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 10px;
}
.ths6-hc-track {
  height: 5px;
  background: rgba(255, 255, 255, .07);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.ths6-hc-bar {
  height: 100%;
  border-radius: 3px;
  width: var(--bar-w, 50%);
  animation: ths6-hc-bar .8s cubic-bezier(.4, 0, .2, 1) both;
}
.ths6-hc-note {
  font-size: 10px;
  color: #5C5E7A;
  line-height: 1.6;
}
.ths6-hc-note b { font-weight: 600; }

/* ── Glass icon buttons ──────────────────────────────── */
.ths6-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
  min-width: fit-content;
}
.ths6-actions .ths6-rings {
  margin-right: 10px;
}
.ths6-glass-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  color: #bfdbfe;
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, .24) 0%,
    rgba(30, 64, 175, .18) 50%,
    rgba(99, 102, 241, .14) 100%
  );
  border: 1px solid rgba(96, 165, 250, .45);
  box-shadow:
    0 0 18px rgba(37, 99, 235, .34),
    0 0 34px rgba(30, 64, 175, .18),
    inset 0 1.5px 0 rgba(255, 255, 255, .18),
    inset 0 -1px 0 rgba(0, 0, 0, .10);
  backdrop-filter: blur(10px);
  transition: all .2s;
}
.ths6-glass-btn:hover {
  color: #F0F0FF;
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, .34),
    rgba(30, 64, 175, .24),
    rgba(99, 102, 241, .18)
  );
  border-color: rgba(147, 197, 253, .58);
  box-shadow:
    0 0 24px rgba(37, 99, 235, .5),
    0 0 42px rgba(30, 64, 175, .26),
    inset 0 1.5px 0 rgba(255, 255, 255, .22);
  transform: translateY(-1px) scale(1.04);
}
.ths6-glass-btn:active {
  transform: translateY(0) scale(1);
}
.ths6-glass-btn svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

/* ── Responsive: hide labels on small screens ────────── */
@media (max-width: 1200px) {
  .ths6-ring-lbl   { display: none; }
  .ths6-rings      { gap: 8px; }
  .ths6-search     { max-width: 260px; }
}
@media (max-width: 1099px) {
  .ths6-prism-bar  { display: none; }
}
@media (max-width: 960px) {
  .ths6-search     { display: none; }
  .ths6-user-text  { display: none; }
  .ths6-rings,
  .ths6-rings-hotspot { display: none !important; }
  .ths6-inner      { padding: 0 14px; gap: 8px; }
  .ths6-logo-link  { margin-right: 8px; width: clamp(110px, 26vw, 160px); }
  .ths6-divider    { display: none; }
  .ths6-log-btn    { padding: 0 12px; }
}
@media (max-width: 768px) {
  .ths6-log-btn    { display: none; }
  .ths6-avatar-ring { width: 32px; height: 32px; }
  .ths6-glass-btn  { width: 40px; height: 40px; }
  .ths6-inner      { padding: 0 10px; position: relative; }
  .ths6-identity   { display: none; }
  .ths6-logo-link  {
    position: absolute;
    left: 58%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin-right: 0;
    width: clamp(130px, 46vw, 190px);
    max-width: calc(100vw - 120px);
    height: 42px;
    z-index: 1;
  }
  .ths6-actions    { margin-left: auto; position: relative; z-index: 2; }
}

/* ## Header Interactions */

.ths6-search-modal {
  position: fixed;
  inset: 0;
  z-index: 6000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ths6-speed) var(--ths6-ease);
}
.ths6-search-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}
.ths6-search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 15, .66);
  backdrop-filter: blur(6px);
}
.ths6-search-dialog {
  position: absolute;
  left: 50%;
  top: 12vh;
  transform: translateX(-50%) translateY(-6px);
  width: min(760px, calc(100vw - 28px));
  max-height: min(72vh, 720px);
  border-radius: 20px;
  background: var(--ths6-panel-bg);
  border: var(--ths6-panel-border);
  box-shadow: 0 20px 50px rgba(0,0,0,.5), 0 0 24px rgba(124,58,237,.24);
  overflow: hidden;
  transition: transform var(--ths6-speed) var(--ths6-ease);
}
.ths6-search-modal.is-open .ths6-search-dialog {
  transform: translateX(-50%) translateY(0);
}
.ths6-search-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(124,58,237,.26);
  color: var(--ths6-panel-muted);
}
.ths6-search-head input {
  width: 100%;
  border: 1px solid rgba(124,58,237,.22);
  border-radius: 12px;
  height: 40px;
  padding: 0 12px;
  background: rgba(255,255,255,.05);
  color: var(--ths6-panel-text);
  font-size: 14px;
}
.ths6-search-head input:focus {
  outline: none;
  border-color: rgba(124,58,237,.62);
  box-shadow: 0 0 0 2px rgba(124,58,237,.22);
}
.ths6-search-close {
  border: 1px solid rgba(124,58,237,.28);
  background: rgba(255,255,255,.06);
  color: var(--ths6-panel-muted);
  border-radius: 10px;
  height: 34px;
  padding: 0 10px;
  cursor: pointer;
}
.ths6-search-results {
  max-height: min(56vh, 560px);
  overflow: auto;
  display: grid;
  gap: 2px;
  padding: 8px;
}
.ths6-search-item {
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ths6-panel-text);
  text-align: left;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 4px 10px;
  padding: 10px 12px;
  cursor: pointer;
}
.ths6-search-item .ths6-si-icon {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 14px;
  background: rgba(124,58,237,.18);
}
.ths6-search-item .ths6-si-main { font-weight: 700; font-size: 14px; }
.ths6-search-item .ths6-si-meta { font-size: 11px; color: #c4b5fd; text-transform: uppercase; letter-spacing: .08em; }
.ths6-search-item .ths6-si-path { grid-column: 2 / -1; font-size: 12px; color: var(--ths6-panel-muted); }
.ths6-search-item:hover,
.ths6-search-item.is-active {
  background: rgba(124,58,237,.18);
}
.ths6-search-empty {
  color: var(--ths6-panel-muted);
  font-size: 13px;
  padding: 14px 18px 18px;
}

.ths6-quicklog-panel {
  position: fixed;
  top: calc(var(--header-h, 68px) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  width: min(760px, calc(100vw - 28px));
  z-index: 5200;
  border-radius: 18px;
  border: var(--ths6-panel-border);
  background: var(--ths6-panel-bg);
  box-shadow: 0 16px 42px rgba(0,0,0,.45), 0 0 24px rgba(124,58,237,.16);
  padding: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ths6-speed) var(--ths6-ease), transform var(--ths6-speed) var(--ths6-ease);
}
.ths6-quicklog-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.ths6-ql-head {
  color: var(--ths6-panel-text);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}
.ths6-ql-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.ths6-ql-tile {
  border: 1px solid rgba(124,58,237,.26);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
  color: var(--ths6-panel-text);
  padding: 10px;
  text-align: left;
  display: grid;
  gap: 2px;
  cursor: pointer;
}
.ths6-ql-tile:hover { background: rgba(124,58,237,.16); }
.ths6-ql-icon { font-size: 16px; }
.ths6-ql-label { font-size: 12px; color: var(--ths6-panel-muted); }
.ths6-ql-value { font-size: 14px; font-weight: 700; }
.ths6-ql-mood { margin-top: 12px; }
.ths6-ql-mood-title {
  color: #F0F0FF;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}
.ths6-ql-mood-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}
.ths6-ql-mood-row button {
  width: 100%;
  height: 52px;
  border-radius: 999px;
  border: 0;
  background: rgba(124,58,237,.12);
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: transform var(--ths6-speed) var(--ths6-ease), background var(--ths6-speed) var(--ths6-ease), border-color var(--ths6-speed) var(--ths6-ease), box-shadow var(--ths6-speed) var(--ths6-ease);
}
.ths6-ql-mood-row button.is-active {
  background: rgba(124,58,237,.28);
  box-shadow: 0 0 18px rgba(124,58,237,.25), inset 0 0 0 2px rgba(167,139,250,.75);
}
.ths6-ql-mood-row button:hover { transform: translateY(-1px); background: rgba(124,58,237,.24); }

.ths6-notif-dot {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #a855f7;
  box-shadow: 0 0 12px rgba(168,85,247,.85);
  opacity: 0;
  transform: scale(.8);
  transition: opacity var(--ths6-speed) var(--ths6-ease), transform var(--ths6-speed) var(--ths6-ease);
}
.ths6-notif-dot.is-show {
  opacity: 1;
  transform: scale(1);
  animation: ths6NotifBellPulse 1.35s ease-in-out infinite;
}
@keyframes ths6NotifBellPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(168,85,247,.65); }
  50% { box-shadow: 0 0 16px rgba(168,85,247,.96); }
}
.ths6-notif-panel {
  position: fixed;
  top: var(--header-h, 68px);
  right: 0;
  width: min(420px, 100vw);
  max-height: calc(100vh - var(--header-h, 68px));
  overflow: hidden;
  border-radius: 0;
  border-left: 1px solid rgba(124,58,237,.22);
  border-top: 1px solid rgba(124,58,237,.18);
  background: var(--ths6-panel-bg);
  box-shadow: -18px 0 56px rgba(0,0,0,.46), inset 1px 0 0 rgba(255,255,255,.04);
  z-index: 5300;
  opacity: 0;
  transform: translateX(100%);
  pointer-events: none;
  transition: opacity var(--ths6-speed) var(--ths6-ease), transform var(--ths6-speed) var(--ths6-ease);
}
.ths6-notif-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 8, 23, 0.58);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 5200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s ease;
}
.ths6-notif-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.ths6-notif-panel.is-rail {
  z-index: 5301;
}
.ths6-notif-panel.is-rail.is-open {
  transform: translateX(0);
}
.ths6-notif-panel.is-rail .ths6-notif-list {
  max-height: calc(100vh - var(--header-h, 68px) - 128px);
}
.ths6-notif-panel.is-open {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}
.ths6-notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(124,58,237,.24);
}
.ths6-notif-title {
  color: var(--ths6-panel-text);
  font-size: 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ths6-notif-title-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(196, 181, 253, .35);
  box-shadow: 0 0 0 rgba(196, 181, 253, 0);
}
.ths6-notif-title-dot.is-live {
  background: #c4b5fd;
  animation: ths6NotifTitlePulse 1.25s ease-in-out infinite;
}
@keyframes ths6NotifTitlePulse {
  0%, 100% { transform: scale(.95); box-shadow: 0 0 0 rgba(196,181,253,0); }
  50% { transform: scale(1.08); box-shadow: 0 0 14px rgba(196,181,253,.65); }
}
.ths6-notif-count { color: var(--ths6-panel-muted); }
.ths6-notif-mark {
  border: 1px solid rgba(124,58,237,.28);
  background: rgba(255,255,255,.05);
  color: var(--ths6-panel-muted);
  border-radius: 9px;
  font-size: 12px;
  height: 26px;
  padding: 0 8px;
  cursor: pointer;
}
.ths6-notif-list {
  max-height: calc(100vh - var(--header-h, 68px) - 128px);
  overflow: auto;
  padding: 8px 8px 10px;
  display: grid;
  gap: 6px;
}
.ths6-notif-group {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  letter-spacing: .08em;
  color: rgba(221,214,254,.45);
  margin: 2px 0 1px;
}
.ths6-notif-group::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, rgba(124,58,237,.04), rgba(124,58,237,.35), rgba(124,58,237,.04));
  z-index: 0;
}
.ths6-notif-group span {
  position: relative;
  z-index: 1;
  background: rgba(15,10,38,.92);
  padding: 0 8px;
}
.ths6-notif-item {
  position: relative;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 11px;
  background: linear-gradient(170deg, rgba(21,16,49,.92), rgba(15,11,40,.95));
  color: var(--ths6-panel-text);
  text-align: left;
  display: grid;
  gap: 2px;
  padding: 8px 9px 8px 11px;
  cursor: pointer;
  transition: transform var(--ths6-speed) var(--ths6-ease), border-color var(--ths6-speed) var(--ths6-ease), box-shadow var(--ths6-speed) var(--ths6-ease), opacity var(--ths6-speed) var(--ths6-ease);
}
.ths6-notif-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 12px 0 0 12px;
  background: #8b5cf6;
}
.ths6-notif-item:hover {
  transform: translateX(2px);
  border-color: rgba(167,139,250,.6);
}
.ths6-notif-item:active { transform: translateX(2px) scale(.99); }
.ths6-notif-item.is-priority-urgent::before { background: #ef4444; }
.ths6-notif-item.is-priority-high::before { background: #f59e0b; }
.ths6-notif-item.is-priority-normal::before { background: #8b5cf6; }
.ths6-notif-item.is-priority-info::before { background: #3b82f6; }
.ths6-notif-item.is-status-unread {
  border-color: rgba(124,58,237,.52);
  box-shadow: 0 0 0 1px rgba(124,58,237,.30), 0 0 18px rgba(124,58,237,.18);
}
.ths6-notif-item.is-status-in-progress {
  border-color: rgba(245,158,11,.58);
  box-shadow: 0 0 0 1px rgba(245,158,11,.25), 0 0 14px rgba(245,158,11,.16);
}
.ths6-notif-item.is-status-completed {
  border-color: rgba(16,185,129,.48);
  opacity: .52;
}
.ths6-notif-item.is-status-completed .ths6-notif-item-title,
.ths6-notif-item.is-status-completed .ths6-notif-item-msg { text-decoration: line-through; }
.ths6-notif-item.is-complete-bounce { animation: ths6NotifCompleteBounce .28s ease-out; }
@keyframes ths6NotifCompleteBounce {
  0% { transform: scale(1); }
  55% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
.ths6-notif-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.ths6-notif-iconbox {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(83,52,140,.72), rgba(54,35,94,.78));
  border: 1px solid rgba(124,58,237,.35);
  flex-shrink: 0;
}
.ths6-notif-icon { font-size: 14px; line-height: 1; }
.ths6-notif-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding-top: 1px;
}
.ths6-notif-meta {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.ths6-notif-badge {
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  border: 1px solid rgba(124,58,237,.28);
  border-radius: 999px;
  padding: 1px 6px;
  color: #a78bfa;
  background: rgba(124,58,237,.18);
}
.ths6-notif-unread-dot {
  margin-left: 6px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #a855f7;
  box-shadow: 0 0 10px rgba(168,85,247,.8);
}
.ths6-notif-item-title { font-size: 15px; font-weight: 700; line-height: 1.2; margin: 0; }
.ths6-notif-item-msg { font-size: 13px; color: var(--ths6-panel-muted); line-height: 1.22; margin: 0; }
.ths6-notif-item-time { font-size: 12px; color: #c4b5fd; }
.ths6-notif-item-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}
.ths6-notif-cta {
  border: 1px solid rgba(124,58,237,.35);
  background: rgba(255,255,255,.06);
  color: #ded8ff;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  height: 28px;
  padding: 0 10px;
  cursor: pointer;
}
.ths6-notif-cta.is-full {
  width: 100%;
  height: 30px;
  border-color: rgba(147,102,255,.55);
  background: linear-gradient(90deg, #a855f7, #6366f1);
  color: #fff;
}
.ths6-notif-cta.is-ghost {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.16);
  color: #d8d3f7;
}
.ths6-notif-cta.is-completed {
  width: 100%;
  height: 30px;
  border-color: rgba(16,185,129,.30);
  background: rgba(5, 48, 42, .65);
  color: #34d399;
}
.ths6-notif-empty {
  font-size: 12px;
  color: var(--ths6-panel-muted);
  border: 1px dashed rgba(124,58,237,.35);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.ths6-notif-footer {
  display: block;
  text-align: center;
  padding: 12px 10px;
  border-top: 1px solid rgba(124,58,237,.24);
  color: #a855f7;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}
.ths6-notif-popout-overlay {
  position: fixed;
  inset: 0;
  z-index: 5450;
  background: rgba(8, 4, 16, .58);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ths6-speed) var(--ths6-ease);
}
.ths6-notif-popout-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.ths6-notif-popout {
  width: min(520px, calc(100vw - 24px));
  max-height: min(88vh, 760px);
  overflow: auto;
  border-radius: 16px;
  border: var(--ths6-panel-border);
  background: var(--ths6-panel-bg);
  box-shadow: 0 18px 52px rgba(0,0,0,.52), 0 0 26px rgba(124,58,237,.2);
  transform: translateY(12px) scale(.94);
  opacity: 0;
  transition: transform .24s cubic-bezier(.22,.74,.28,1), opacity .24s cubic-bezier(.22,.74,.28,1);
}
.ths6-notif-popout.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.ths6-notif-popout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(124,58,237,.24);
}
.ths6-notif-popout-title { margin: 0; font-size: 14px; color: var(--ths6-panel-text); }
.ths6-notif-popout-close {
  border: 1px solid rgba(124,58,237,.32);
  background: rgba(255,255,255,.05);
  color: #ddd6fe;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  cursor: pointer;
}
.ths6-notif-popout-body { padding: 12px; display: grid; gap: 8px; }
.ths6-notif-popout-copy { margin: 0; color: var(--ths6-panel-muted); font-size: 12px; }
.ths6-notif-mood-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.ths6-notif-mood-grid button {
  height: 40px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  font-size: 20px;
  cursor: pointer;
  transition: border-color var(--ths6-speed) var(--ths6-ease), box-shadow var(--ths6-speed) var(--ths6-ease), transform var(--ths6-speed) var(--ths6-ease);
}
.ths6-notif-mood-grid button.is-selected {
  border-color: rgba(167,139,250,.85);
  box-shadow: 0 0 18px rgba(124,58,237,.34);
}
.ths6-notif-field-label { font-size: 11px; color: #ddd6fe; }
.ths6-notif-textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(124,58,237,.28);
  background: rgba(255,255,255,.04);
  color: var(--ths6-panel-text);
  padding: 8px;
  resize: vertical;
  min-height: 86px;
}
.ths6-notif-assignment-card {
  border: 1px solid rgba(124,58,237,.32);
  background: rgba(124,58,237,.13);
  border-radius: 12px;
  padding: 10px;
}
.ths6-notif-assignment-label {
  font-size: 11px;
  color: #c4b5fd;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ths6-notif-assignment-title { font-size: 14px; color: var(--ths6-panel-text); margin-top: 2px; }
.ths6-notif-message-thread {
  border: 1px solid rgba(124,58,237,.26);
  border-radius: 12px;
  padding: 8px;
  background: rgba(255,255,255,.03);
}
.ths6-notif-message-bubble {
  border-radius: 10px;
  background: rgba(124,58,237,.2);
  border: 1px solid rgba(124,58,237,.38);
  color: #ede9fe;
  padding: 7px 9px;
  font-size: 12px;
}
.ths6-notif-actions {
  display: flex;
  justify-content: flex-end;
}
.ths6-notif-primary {
  border: 1px solid rgba(124,58,237,.5);
  background: rgba(124,58,237,.22);
  color: #ede9fe;
  border-radius: 9px;
  height: 28px;
  padding: 0 10px;
  cursor: pointer;
}

@media (max-width: 600px) {
  .ths6-notif-panel {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: min(74vh, 88vh);
    border-radius: 18px 18px 0 0;
    border-left: 1px solid rgba(124,58,237,.22);
    border-right: 1px solid rgba(124,58,237,.22);
    border-top: 1px solid rgba(124,58,237,.22);
    transform: translateY(100%);
  }
  .ths6-notif-panel.is-open { transform: translateY(0); }
  .ths6-notif-panel.is-rail .ths6-notif-list,
  .ths6-notif-list { max-height: calc(74vh - 130px); }
  .ths6-notif-popout-overlay {
    align-items: end;
    padding: 0;
  }
  .ths6-notif-popout {
    width: 100%;
    max-height: 88vh;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    transform: translateY(18px) scale(1);
  }
}

.ths6-profile-panel {
  position: fixed;
  width: 320px;
  z-index: 5400;
  border-radius: 16px;
  border: var(--ths6-panel-border);
  background: var(--ths6-panel-bg);
  box-shadow: 0 16px 42px rgba(0,0,0,.45), 0 0 24px rgba(124,58,237,.16);
  padding: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity var(--ths6-speed) var(--ths6-ease), transform var(--ths6-speed) var(--ths6-ease);
}
.ths6-profile-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.ths6-profile-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(124,58,237,.24);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  padding: 10px;
  margin-bottom: 8px;
}
.pd-avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(124,58,237,.25);
  color: #fff;
  font-size: 18px;
}
.pd-display-name { color: var(--ths6-panel-text); font-size: 14px; font-weight: 700; }
.pd-email { color: var(--ths6-panel-muted); font-size: 11px; }
.pd-clean-badge { color: #c4b5fd; font-size: 11px; }
.ths6-profile-item {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ths6-panel-text);
  border-radius: 12px;
  text-align: left;
  padding: 9px 10px;
  font-size: 13px;
  cursor: pointer;
}
.ths6-profile-item:hover { background: rgba(124,58,237,.16); border-color: rgba(124,58,237,.25); }
.ths6-profile-item.danger { color: #fca5a5; }

.ths6-sheet {
  position: fixed;
  inset: 0;
  z-index: 6500;
}
.ths6-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 4, 14, .66);
  backdrop-filter: blur(4px);
}
.ths6-sheet-dialog {
  position: absolute;
  left: 50%;
  top: 14vh;
  transform: translateX(-50%);
  width: min(460px, calc(100vw - 28px));
  border-radius: 16px;
  border: var(--ths6-panel-border);
  background: var(--ths6-panel-bg);
  box-shadow: 0 16px 42px rgba(0,0,0,.45), 0 0 24px rgba(124,58,237,.16);
}
.ths6-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(124,58,237,.24);
}
.ths6-sheet-title { color: var(--ths6-panel-text); font-size: 14px; font-weight: 700; }
.ths6-sheet-x {
  border: 1px solid rgba(124,58,237,.24);
  background: rgba(255,255,255,.04);
  color: var(--ths6-panel-muted);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
}
.ths6-sheet-body { padding: 14px; display: grid; gap: 10px; }
.ths6-field-label { color: var(--ths6-panel-muted); font-size: 12px; }
.ths6-field {
  width: 100%;
  border: 1px solid rgba(124,58,237,.24);
  border-radius: 12px;
  height: 40px;
  padding: 0 10px;
  background: rgba(255,255,255,.04);
  color: var(--ths6-panel-text);
}
.ths6-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ths6-panel-text);
  font-size: 13px;
}
.ths6-emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.ths6-emoji {
  border: 1px solid rgba(124,58,237,.24);
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  height: 42px;
  cursor: pointer;
  font-size: 20px;
}
.ths6-emoji.is-selected,
.ths6-emoji:hover {
  border-color: rgba(124,58,237,.66);
  background: rgba(124,58,237,.18);
}
.ths6-sheet-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(124,58,237,.24);
}
.ths6-sheet-btn {
  border: 1px solid rgba(124,58,237,.28);
  background: linear-gradient(90deg, #7C3AED, #6366F1);
  color: #fff;
  border-radius: 10px;
  height: 34px;
  padding: 0 14px;
  cursor: pointer;
}
.ths6-sheet-btn.ghost {
  background: rgba(255,255,255,.04);
  color: var(--ths6-panel-muted);
}

.ths6-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(8px);
  z-index: 6600;
  border-radius: 12px;
  border: var(--ths6-panel-border);
  background: var(--ths6-panel-bg);
  color: var(--ths6-panel-text);
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: 0 10px 24px rgba(0,0,0,.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ths6-speed) var(--ths6-ease), transform var(--ths6-speed) var(--ths6-ease);
}
.ths6-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

html {
  font-size: calc(16px * var(--ths6-font-scale, 1));
}
.ths6-high-contrast .ths6,
.ths6-high-contrast .ths6-profile-panel,
.ths6-high-contrast .ths6-notif-panel,
.ths6-high-contrast .ths6-quicklog-panel,
.ths6-high-contrast .ths6-search-dialog,
.ths6-high-contrast .ths6-sheet-dialog {
  border-color: rgba(255,255,255,.68);
}
.ths6-reduce-motion *,
.ths6-reduce-motion *::before,
.ths6-reduce-motion *::after {
  animation-duration: .01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
  scroll-behavior: auto !important;
}

@media (max-width: 760px) {
  .ths6-ql-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ths6-profile-panel { width: min(320px, calc(100vw - 16px)); left: 8px !important; }
}

/* === THRIVE PAGE AURORA BG === */
body {
  background: var(--bg-base) !important;
}

#thrive-aurora-wrap {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

#thrive-scroll-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 200vh;
  will-change: transform;
  background-image: var(--thrive-scroll-bg-image);
  opacity: var(--thrive-scroll-opacity, 1);
}

#thrive-ambient-bg {
  position: absolute;
  inset: 0;
  background: var(--thrive-ambient-bg-image);
  opacity: var(--thrive-ambient-opacity, 1);
  animation: thriveAmbient 32s ease-in-out infinite alternate;
}

@keyframes thriveAmbient {
  0%   { opacity: 0.5; transform: scale(1)    translate(  0px,  0px); }
  35%  { opacity: 1;   transform: scale(1.12) translate( 22px,-18px); }
  70%  { opacity: 0.7; transform: scale(1.06) translate(-14px, 24px); }
  100% { opacity: 0.6; transform: scale(1.03) translate( 18px,-10px); }
}

/* === THRIVE DAYLIGHT / POLAR WHITE OVERRIDES === */
[data-theme="polar-white"] body,
[data-theme="thrive-daylight"] body {
  background:
    radial-gradient(60% 40% at 0% 0%,  rgba(108,99,255,0.055) 0%, transparent 65%),
    radial-gradient(50% 35% at 100% 8%, rgba(14,165,233,0.045) 0%, transparent 65%),
    #FFFFFF !important;
  background-attachment: fixed !important;
  color: #1E1B4B !important;
}

[data-theme="polar-white"] #thrive-scroll-bg,
[data-theme="thrive-daylight"] #thrive-scroll-bg {
  background-image:
    radial-gradient(110% 22% at 28% 0%, rgba(108,99,255,0.06) 0%, transparent 88%),
    radial-gradient(80% 18% at 80% 2%, rgba(14,165,233,0.05) 0%, transparent 88%) !important;
  opacity: 1 !important;
}

[data-theme="polar-white"] #thrive-ambient-bg,
[data-theme="thrive-daylight"] #thrive-ambient-bg {
  background: transparent !important;
  opacity: 0 !important;
}

[data-theme="polar-white"] .ths6,
[data-theme="thrive-daylight"] .ths6 {
  background: #FFFFFF !important;
  border-bottom: 1px solid rgba(108, 99, 255, 0.12) !important;
  box-shadow: 0 1px 0 rgba(108, 99, 255, 0.08) !important;
  color: #1E1B4B !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

[data-theme="polar-white"] .ths6 *,
[data-theme="thrive-daylight"] .ths6 * {
  color: #1E1B4B;
}

[data-theme="polar-white"] .ths6-clean,
[data-theme="polar-white"] .ths6-clean-num,
[data-theme="thrive-daylight"] .ths6-clean,
[data-theme="thrive-daylight"] .ths6-clean-num {
  color: #5C5E7A !important;
}

[data-theme="polar-white"] .ths6-prism-cone,
[data-theme="thrive-daylight"] .ths6-prism-cone {
  background: linear-gradient(180deg, rgba(108,99,255,0.08) 0%, transparent 100%) !important;
  opacity: 0.7 !important;
  filter: none !important;
}

[data-theme="polar-white"] .ths6-logo,
[data-theme="polar-white"] .logo-full,
[data-theme="polar-white"] .logo-icon,
[data-theme="thrive-daylight"] .ths6-logo,
[data-theme="thrive-daylight"] .logo-full,
[data-theme="thrive-daylight"] .logo-icon {
  filter: none !important;
}

[data-theme="polar-white"] .ths6-avatar-ring,
[data-theme="thrive-daylight"] .ths6-avatar-ring {
  background: linear-gradient(135deg, #EDE9FE, #DDD6FE) !important;
}

[data-theme="polar-white"] .ths6-search,
[data-theme="thrive-daylight"] .ths6-search {
  background: #F4F3FF !important;
  border: 1px solid rgba(108, 99, 255, 0.18) !important;
  color: #1E1B4B !important;
}

[data-theme="polar-white"] .ths6-search::placeholder,
[data-theme="thrive-daylight"] .ths6-search::placeholder {
  color: #8B8FA8 !important;
}

[data-theme="polar-white"] .sidebar,
[data-theme="thrive-daylight"] .sidebar,
[data-theme="polar-white"] nav:not(header nav),
[data-theme="thrive-daylight"] nav:not(header nav),
[data-theme="polar-white"] aside,
[data-theme="thrive-daylight"] aside {
  background: #FFFFFF !important;
  border-right: 1px solid rgba(108, 99, 255, 0.10) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

[data-theme="polar-white"] .nav-item,
[data-theme="thrive-daylight"] .nav-item {
  color: #5C5E7A !important;
}

[data-theme="polar-white"] .nav-item.active,
[data-theme="thrive-daylight"] .nav-item.active {
  background: rgba(108, 99, 255, 0.09) !important;
  border-radius: 10px !important;
  color: #6C63FF !important;
}

[data-theme="polar-white"] .nav-item:hover,
[data-theme="thrive-daylight"] .nav-item:hover {
  background: #F8F7FF !important;
  color: #5C5E7A !important;
}

[data-theme="polar-white"] .nav-item .menu-label,
[data-theme="thrive-daylight"] .nav-item .menu-label {
  color: #5C5E7A !important;
}

[data-theme="polar-white"] .nav-item.active .menu-label,
[data-theme="thrive-daylight"] .nav-item.active .menu-label {
  color: #6C63FF !important;
}

[data-theme="polar-white"] .menu-icon--home,
[data-theme="thrive-daylight"] .menu-icon--home { color: rgb(167, 139, 250) !important; }
[data-theme="polar-white"] .menu-icon--planner,
[data-theme="thrive-daylight"] .menu-icon--planner { color: rgb(96, 165, 250) !important; }
[data-theme="polar-white"] .menu-icon--action-centre,
[data-theme="thrive-daylight"] .menu-icon--action-centre { color: rgb(249, 115, 22) !important; }
[data-theme="polar-white"] .menu-icon--journal,
[data-theme="thrive-daylight"] .menu-icon--journal { color: rgb(52, 211, 153) !important; }
[data-theme="polar-white"] .menu-icon--goals,
[data-theme="thrive-daylight"] .menu-icon--goals { color: rgb(244, 63, 94) !important; }
[data-theme="polar-white"] .menu-icon--sleep-routine,
[data-theme="thrive-daylight"] .menu-icon--sleep-routine { color: rgb(129, 140, 248) !important; }
[data-theme="polar-white"] .menu-icon--cravings,
[data-theme="thrive-daylight"] .menu-icon--cravings { color: rgb(251, 146, 60) !important; }
[data-theme="polar-white"] .menu-icon--messages,
[data-theme="thrive-daylight"] .menu-icon--messages { color: rgb(56, 189, 248) !important; }
[data-theme="polar-white"] .menu-icon--progress-tracker,
[data-theme="thrive-daylight"] .menu-icon--progress-tracker { color: rgb(74, 222, 128) !important; }
[data-theme="polar-white"] .menu-icon--recovery-online,
[data-theme="thrive-daylight"] .menu-icon--recovery-online { color: rgb(34, 211, 238) !important; }
[data-theme="polar-white"] .menu-icon--engagements,
[data-theme="thrive-daylight"] .menu-icon--engagements { color: rgb(192, 132, 252) !important; }
[data-theme="polar-white"] .menu-icon--resources,
[data-theme="thrive-daylight"] .menu-icon--resources { color: rgb(251, 191, 36) !important; }

[data-theme="polar-white"] .card,
[data-theme="polar-white"] .page-card,
[data-theme="polar-white"] .snapshot-card,
[data-theme="polar-white"] .momentum-card,
[data-theme="thrive-daylight"] .card,
[data-theme="thrive-daylight"] .page-card,
[data-theme="thrive-daylight"] .snapshot-card,
[data-theme="thrive-daylight"] .momentum-card {
  background: #FFFFFF !important;
  border: 1px solid rgba(108, 99, 255, 0.13) !important;
  box-shadow: 0 1px 4px rgba(108, 99, 255, 0.08), 0 4px 16px rgba(108, 99, 255, 0.05) !important;
  color: #1E1B4B !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

[data-theme="polar-white"] .page-card .placeholder,
[data-theme="thrive-daylight"] .page-card .placeholder {
  color: #5C5E7A !important;
}

[data-theme="polar-white"] .modal-overlay,
[data-theme="thrive-daylight"] .modal-overlay {
  background: rgba(30, 27, 75, 0.45) !important;
  backdrop-filter: blur(4px) !important;
}

[data-theme="polar-white"] .modal-content,
[data-theme="thrive-daylight"] .modal-content {
  background: #FFFFFF !important;
  border: 1px solid rgba(108, 99, 255, 0.18) !important;
  color: #1E1B4B !important;
}

[data-theme="polar-white"] input,
[data-theme="polar-white"] textarea,
[data-theme="polar-white"] select,
[data-theme="thrive-daylight"] input,
[data-theme="thrive-daylight"] textarea,
[data-theme="thrive-daylight"] select {
  background: #F4F3FF !important;
  border: 1px solid rgba(108, 99, 255, 0.20) !important;
  color: #1E1B4B !important;
}

[data-theme="polar-white"] input::placeholder,
[data-theme="polar-white"] textarea::placeholder,
[data-theme="thrive-daylight"] input::placeholder,
[data-theme="thrive-daylight"] textarea::placeholder {
  color: #8B8FA8 !important;
}

[data-theme="polar-white"] input:focus,
[data-theme="polar-white"] textarea:focus,
[data-theme="polar-white"] select:focus,
[data-theme="thrive-daylight"] input:focus,
[data-theme="thrive-daylight"] textarea:focus,
[data-theme="thrive-daylight"] select:focus {
  border-color: #6C63FF !important;
  box-shadow: 0 0 0 3px rgba(108,99,255,0.12) !important;
}

[data-theme="polar-white"] #ths6-profile-sheet .ths6-field,
[data-theme="thrive-daylight"] #ths6-profile-sheet .ths6-field {
  background: #F4F3FF !important;
  border: 1px solid rgba(108, 99, 255, 0.20) !important;
  color: #1E1B4B !important;
}

[data-theme="polar-white"] #ths6-profile-sheet .ths6-field option,
[data-theme="thrive-daylight"] #ths6-profile-sheet .ths6-field option {
  background: #FFFFFF;
  color: #1E1B4B;
}

[data-theme="polar-white"] circle[stroke="rgba(255,255,255,.24)"],
[data-theme="polar-white"] circle[stroke="rgba(255,255,255,0.24)"],
[data-theme="thrive-daylight"] circle[stroke="rgba(255,255,255,.24)"],
[data-theme="thrive-daylight"] circle[stroke="rgba(255,255,255,0.24)"] {
  stroke: rgba(108,99,255,0.13) !important;
}

[data-theme="polar-white"] ::-webkit-scrollbar-track,
[data-theme="thrive-daylight"] ::-webkit-scrollbar-track { background: #F4F3FF; }
[data-theme="polar-white"] ::-webkit-scrollbar-thumb,
[data-theme="thrive-daylight"] ::-webkit-scrollbar-thumb {
  background: rgba(108,99,255,0.25);
  border-radius: 3px;
}
[data-theme="polar-white"] ::-webkit-scrollbar-thumb:hover,
[data-theme="thrive-daylight"] ::-webkit-scrollbar-thumb:hover { background: rgba(108,99,255,0.45); }
