:root {
  --background:       #0B0E14;
  --foreground:       #E8EAED;
  --card:             #11141C;
  --card-foreground:  #E8EAED;
  --popover:          #11141C;
  --popover-foreground: #E8EAED;
  --primary:          #00E5FF;
  --primary-foreground: #0B0E14;
  --secondary:        #1A1E2E;
  --secondary-foreground: #E8EAED;
  --muted:            #1A1E2E;
  --muted-foreground: #6B7280;
  --accent:           #7C3AED;
  --accent-foreground: #ffffff;
  --destructive:      #EF4444;
  --destructive-foreground: #ffffff;
  --border:           rgba(0, 229, 255, 0.1);
  --input-bg:         #1A1E2E;
  --ring:             rgba(0, 229, 255, 0.4);
  --chart-1:          #00E5FF;
  --chart-2:          #7C3AED;
  --chart-3:          #2ECC71;
  --chart-4:          #FFB020;
  --chart-5:          #EF4444;
  --radius-sm:        6px;
  --radius:           8px;
  --radius-lg:        12px;
  --radius-xl:        16px;
  --font-sans:        'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:        'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --surface-1:        #1A1E2E;
  --surface-2:        #151923;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

::selection { background: rgba(0,229,255,0.3); color: white; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,229,255,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,229,255,0.4); }

a { color: var(--primary); text-decoration: none; }
a:hover { opacity: 0.8; }

[x-cloak] { display: none !important; }

/* ═══ APP SHELL ═══ */
.app-shell { display: flex; min-height: 100vh; }

/* ═══ SIDEBAR ═══ */
.sidebar {
  width: 224px; flex-shrink: 0; position: fixed; top: 0; left: 0;
  height: 100vh; z-index: 50;
  background: var(--background);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #00E5FF, #7C3AED);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 0 12px rgba(0,229,255,0.3);
}

.sidebar-brand-text {
  font-family: var(--font-mono); font-weight: 700;
  font-size: 13px; letter-spacing: 0.1em; color: #fff;
}

.sidebar-user {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 8px;
  background: rgba(255,255,255,0.03);
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
  color: #fff; font-size: 12px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.xp-bar-small .xp-bar-track { height: 4px; }

.sidebar-nav {
  flex: 1; padding: 8px 8px; overflow-y: auto;
}

.sidebar-group-label {
  font-family: var(--font-mono); font-size: 10px;
  color: #525252; text-transform: uppercase;
  letter-spacing: 0.12em; padding: 12px 10px 6px;
}

.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  color: #6B7280; transition: all 0.15s; text-decoration: none;
  font-size: 13px; margin-bottom: 2px;
}

.sidebar-item:hover { background: rgba(255,255,255,0.04); color: #d4d4d8; }

.sidebar-item.active {
  background: rgba(0,229,255,0.08); color: #fff;
  border-left: 2px solid var(--primary); padding-left: 8px;
}

.sidebar-item.active svg {
  color: var(--primary); filter: drop-shadow(0 0 4px rgba(0,229,255,0.5));
}

.sidebar-badge {
  margin-left: auto; background: var(--primary); color: var(--primary-foreground);
  font-size: 10px; font-family: var(--font-mono); font-weight: 700;
  padding: 1px 6px; border-radius: 9999px;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

.sidebar-footer .sidebar-item { font-size: 12px; }
.sidebar-footer .sidebar-item.danger { color: var(--destructive); }
.sidebar-footer .sidebar-item.danger:hover { background: rgba(239,68,68,0.08); }

/* ═══ MAIN AREA ═══ */
.main-area {
  margin-left: 224px; flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ═══ TOPBAR ═══ */
.topbar {
  height: 56px; background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 40;
}

.topbar-title {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
}

.topbar-left {
  display: flex; align-items: center; gap: 12px;
}

.topbar-hamburger {
  display: none; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  color: var(--foreground); cursor: pointer;
}
.topbar-hamburger:hover { background: rgba(255,255,255,0.04); }

.topbar-right {
  display: flex; align-items: center; gap: 16px;
}

.topbar-nav { display: flex; gap: 4px; }

.topbar-nav-btn {
  padding: 4px 10px; border-radius: 4px; font-family: var(--font-mono);
  font-size: 10px; cursor: pointer; background: none; border: 1px solid transparent;
  color: var(--muted-foreground); transition: all 0.15s;
}

.topbar-nav-btn:hover { color: var(--foreground); }

.topbar-nav-btn.active {
  background: rgba(0,229,255,0.1); color: var(--primary);
  border-color: rgba(0,229,255,0.2);
}

/* ═══ CONTENT ═══ */
.content-area {
  flex: 1; padding: 24px;
}

/* ═══ FLASH MESSAGES ═══ */
.flash-messages {
  margin-bottom: 16px;
}

.flash-message {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--card);
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}

.flash-prefix {
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
}

.flash-error { border-color: rgba(239,68,68,0.3); color: var(--destructive); }
.flash-success { border-color: rgba(0,229,255,0.3); }

.flash-error .flash-prefix { color: var(--destructive); }

/* ═══ STATUS BAR ═══ */
.status-bar {
  font-size: 11px; font-family: var(--font-mono);
  color: var(--muted-foreground); letter-spacing: 0.5px;
  padding: 8px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

/* ═══ AVATAR RING ═══ */
.avatar-ring {
  position: relative; display: inline-flex; flex-shrink: 0;
  width: 48px; height: 48px;
}

.avatar-ring svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  transform: rotate(-90deg);
}

.avatar-ring-inner {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}

.avatar-ring-inner div {
  border-radius: 50%; background: #1A1E2E;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff;
  width: 68%; height: 68%; font-size: 12px;
}

/* ═══ LEVEL RING ═══ */
.level-ring {
  position: relative; display: inline-flex; flex-shrink: 0;
  width: 56px; height: 56px;
}

.level-ring svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  transform: rotate(-90deg);
}

.level-ring-inner {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}

.level-ring-inner span {
  font-family: var(--font-mono); font-weight: 700; color: #fff;
  font-size: 16px;
}

/* ═══ XP BAR ═══ */
.xp-bar-wrap { width: 100%; }

.xp-bar-label {
  display: flex; justify-content: space-between; margin-bottom: 4px;
}

.xp-bar-label-current {
  font-family: var(--font-mono); font-size: 12px; color: var(--primary);
}

.xp-bar-label-max {
  font-family: var(--font-mono); font-size: 12px; color: #525252;
}

.xp-bar-track {
  height: 6px; background: #27272A; border-radius: 9999px; overflow: hidden;
}

.xp-bar-fill {
  height: 100%; border-radius: 9999px; transition: width 700ms;
  background: var(--primary);
  box-shadow: 0 0 8px rgba(0,229,255,0.6);
}

/* ═══ LANDING HERO ═══ */
.hero-section, .landing-hero {
  position: relative; min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

.hero-content {
  position: relative; z-index: 1;
  text-align: center; max-width: 640px; padding: 24px;
}

.hero-title {
  font-size: clamp(36px, 8vw, 88px);
  font-weight: 700; color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 16px;
}

.hero-title span { color: var(--primary); }

.hero-sub, .hero-desc {
  font-size: 15px; color: var(--muted-foreground);
  max-width: 480px; margin: 0 auto 32px;
  line-height: 1.6;
}

.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.hero-visual { position: relative; flex: 1; min-height: 400px; }

.hero-section-label {
  font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted-foreground); margin-bottom: 8px;
}

/* ═══ 3D FLOATING CARDS ═══ */
.float-card, .hs-float-card {
  position: absolute; border-radius: 12px;
  background: var(--card);
  border: 1px solid rgba(0,229,255,0.15);
  padding: 14px; max-width: 220px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.hs-float-1 {
  top: 15%; right: 5%;
  animation: hs-float1 6s ease-in-out infinite;
}

.hs-float-2 {
  bottom: 20%; right: 12%;
  animation: hs-float2 7.5s ease-in-out infinite;
}

.hs-float-3 {
  top: 25%; left: 5%;
  animation: hs-float3 9s ease-in-out infinite;
}

.float-card-code { font-family: var(--font-mono); font-size: 9px; color: #6B7280; margin-bottom: 4px; }
.float-card-title { font-size: 12px; font-weight: 600; color: var(--foreground); margin-bottom: 6px; }
.float-card-footer { display: flex; justify-content: space-between; align-items: center; }
.float-card-xp { font-family: var(--font-mono); font-size: 11px; color: var(--primary); font-weight: 700; }
.float-card-type { font-size: 9px; color: #6B7280; font-family: var(--font-mono); }

/* ═══ MARQUEE ═══ */
.marquee-wrap, .landing-marquee {
  overflow: hidden; border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 12px 0; background: var(--card);
}

.marquee-track {
  display: flex; gap: 48px;
  animation: hs-marquee 25s linear infinite;
  white-space: nowrap;
}

.marquee-item {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12px; color: var(--muted-foreground);
}

/* ═══ FEATURES GRID (Landing) ═══ */
.landing-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.feature-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; text-align: center;
  transition: all 0.2s;
}

.feature-card:hover {
  border-color: rgba(0,229,255,0.25);
  box-shadow: 0 0 20px rgba(0,229,255,0.08);
}

.feature-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}

.feature-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.feature-desc { font-size: 12px; color: var(--muted-foreground); }

/* ═══ LANDING CTA ═══ */
.landing-cta {
  text-align: center; padding: 80px 24px;
  border-top: 1px solid var(--border);
}

.cta-card {
  max-width: 480px; margin: 0 auto;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px 32px;
}

.cta-title { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.cta-sub { color: var(--muted-foreground); margin-bottom: 24px; }

/* ═══ TABLE RESPONSIVE ═══ */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ═══ SIDEBAR OVERLAY ═══ */
/* ═══ UI KIT SIDEBAR VARIANTS ═══ */
.sidebar-brand-sub { font-family: var(--font-mono); font-size: 9px; color: #525252; letter-spacing: 0.1em; margin-top: 1px; }

.sidebar-profile {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--primary); background: rgba(0,229,255,0.1);
}
.sidebar-user { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-level { font-family: var(--font-mono); font-size: 9px; color: #525252; }
.sidebar-user-xp { font-family: var(--font-mono); font-size: 9px; color: var(--primary); }

.sidebar-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  font-size: 12px; color: var(--muted-foreground);
  transition: all 0.15s; text-decoration: none; margin-bottom: 2px;
}
.sidebar-nav-item:hover { background: rgba(255,255,255,0.04); color: var(--foreground); }
.sidebar-nav-item.active { background: rgba(0,229,255,0.08); color: var(--primary); }
.sidebar-nav-icon { width: 18px; text-align: center; flex-shrink: 0; font-size: 14px; }

/* ═══ VIEW CONTAINER ═══ */
.view-container { padding: 0; }

/* ═══ LANDING HERO (UI KIT variant) ═══ */
.hero { text-align: center; padding: 60px 0 40px; }
.hero h1 { font-size: 36px; font-weight: 700; margin-bottom: 12px; }
.hero h1 span { color: var(--primary); }
.hero p { color: var(--muted-foreground); font-size: 15px; max-width: 500px; margin: 0 auto 24px; }

/* ═══ FEATURE GRID (UI KIT variant) ═══ */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ═══ IDEA CARD ═══ */
.idea-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.idea-card-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.idea-card-author { font-size: 11px; color: var(--muted-foreground); margin-bottom: 6px; }
.idea-card-desc { font-size: 12px; color: var(--muted-foreground); line-height: 1.4; margin-bottom: 8px; }
.idea-vote { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 12px; color: var(--primary); font-weight: 600; cursor: pointer; }

/* ═══ AGM MSG ═══ */
.agm-msg { padding: 12px 16px; border-radius: 8px; margin-bottom: 6px; display: flex; align-items: flex-start; gap: 10px; }
.agm-msg.info { background: rgba(0,229,255,0.04); border: 1px solid rgba(0,229,255,0.12); }
.agm-msg.warn { background: rgba(255,176,32,0.04); border: 1px solid rgba(255,176,32,0.12); }
.agm-msg.crit { background: rgba(239,68,68,0.04); border: 1px solid rgba(239,68,68,0.12); }
.agm-msg-tag { font-family: var(--font-mono); font-size: 9px; font-weight: 700; flex-shrink: 0; padding: 2px 6px; border-radius: 4px; }
.agm-msg.info .agm-msg-tag { background: rgba(0,229,255,0.15); color: var(--primary); }
.agm-msg.warn .agm-msg-tag { background: rgba(255,176,32,0.15); color: #FFB020; }
.agm-msg.crit .agm-msg-tag { background: rgba(239,68,68,0.15); color: #EF4444; }

.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 49; display: none; }
.sidebar-overlay[x-show="true"] { display: block; }

/* ═══ KEYFRAMES ═══ */
@keyframes hs-float1 {
  0%,100% { transform: perspective(900px) rotateX(-8deg) rotateY(18deg) translateY(0px); }
  50%     { transform: perspective(900px) rotateX(-8deg) rotateY(18deg) translateY(-14px); }
}

@keyframes hs-float2 {
  0%,100% { transform: perspective(900px) rotateX(-4deg) rotateY(22deg) translateY(-8px); }
  50%     { transform: perspective(900px) rotateX(-4deg) rotateY(22deg) translateY(8px); }
}

@keyframes hs-float3 {
  0%,100% { transform: perspective(900px) rotateX(-12deg) rotateY(14deg) translateY(4px); }
  50%     { transform: perspective(900px) rotateX(-12deg) rotateY(14deg) translateY(-12px); }
}

@keyframes hs-marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes hs-pulse-ring {
  0%,100% { box-shadow: 0 0 20px rgba(0,229,255,0.25), 0 0 60px rgba(0,229,255,0.08); }
  50%     { box-shadow: 0 0 40px rgba(0,229,255,0.5),  0 0 100px rgba(0,229,255,0.15); }
}

@keyframes hs-fadeup {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes hs-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

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

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
  .sidebar { width: 64px; }
  .sidebar .sidebar-brand-text,
  .sidebar .sidebar-brand-sub,
  .sidebar .sidebar-user,
  .sidebar .sidebar-user-info,
  .sidebar .level-ring,
  .sidebar .sidebar-group-label,
  .sidebar .sidebar-item .sidebar-item-label,
  .sidebar .sidebar-nav-item span:not(.sidebar-nav-icon) { display: none; }
  .sidebar .sidebar-nav .sidebar-item { justify-content: center; padding: 8px; }
  .sidebar .sidebar-nav .sidebar-nav-item { justify-content: center; }
  .sidebar .sidebar-footer .sidebar-item { justify-content: center; }
  .sidebar .sidebar-badge { font-size: 0; min-width: 8px; width: 8px; height: 8px; padding: 0; border-radius: 50%; }
  .sidebar .sidebar-profile { justify-content: center; }
  .main-area { margin-left: 64px; }
  .topbar-hamburger { display: flex; }
  .sidebar-item { min-height: 44px; }
  .sidebar-nav-item { min-height: 44px; justify-content: center; }
  .btn { min-height: 44px; }
  .sidebar-footer .sidebar-item { min-height: 44px; }
  input, select, textarea { font-size: 16px !important; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .content-area { padding: 16px; }

  .sidebar.expanded { width: 224px; z-index: 50; }
  .sidebar.expanded .sidebar-brand-text,
  .sidebar.expanded .sidebar-brand-sub,
  .sidebar.expanded .sidebar-user,
  .sidebar.expanded .sidebar-user-info,
  .sidebar.expanded .level-ring,
  .sidebar.expanded .sidebar-group-label { display: block; }
  .sidebar.expanded .sidebar-item .sidebar-item-label { display: inline; }
  .sidebar.expanded .sidebar-nav .sidebar-item { justify-content: flex-start; padding: 8px 10px; }
  .sidebar.expanded .sidebar-nav-item span:not(.sidebar-nav-icon) { display: inline; }
  .sidebar.expanded .sidebar-nav .sidebar-nav-item { justify-content: flex-start; }
  .sidebar.expanded .sidebar-footer .sidebar-item { justify-content: flex-start; }
}
@media (max-width: 480px) {
  .float-card { display: none; }
  .modal-overlay .modal-content,
  .modal-overlay .level-up-modal,
  .modal-overlay .onboarding-modal { width: 100vw; height: 100vh; border-radius: 0; max-width: none; max-height: none; }
  .content-area { padding: 12px; }
  .topbar { padding: 0 12px; }
  .topbar-title { font-size: 11px; }
  .landing-features { grid-template-columns: 1fr; }
  .hero-content { padding: 16px; }
  .hero-sub, .hero-desc { font-size: 13px; }
  .landing-cta { padding: 40px 16px; }
  .cta-card { padding: 24px 16px; }
  .hero-section, .landing-hero { min-height: auto; padding: 40px 0; }
  .sidebar { width: 0; overflow: hidden; border-right: none; }
  .sidebar.expanded { width: 224px; }
  .main-area { margin-left: 0; }
  .sidebar-overlay { display: none; }
  .sidebar-overlay[x-show="true"] { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .marquee-track { animation: none; }
}

/* ═══ ERROR PAGES ═══ */
.error-page {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 60vh; text-align: center; padding: 40px 24px;
}
.error-code {
  font-family: var(--font-mono); font-size: 96px; font-weight: 700;
  color: var(--primary); line-height: 1; text-shadow: 0 0 40px rgba(0,229,255,0.2);
}
.error-label {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.2em;
  color: var(--muted-foreground); margin: 8px 0 16px;
}
.error-message {
  color: var(--muted-foreground); margin-bottom: 24px; max-width: 400px;
}
