:root {
  --fb-bg: #f8f6fc;
  --fb-surface: #ffffff;
  --fb-surface-2: #f2edf8;
  --fb-surface-3: #e8e0f5;
  --fb-border: rgba(125, 100, 184, 0.08);
  --fb-border-strong: rgba(121, 89, 223, 0.18);
  --fb-text: #0f0c29;
  --fb-text-soft: #302b52;
  --fb-muted: #696387;
  --fb-kicker: #7c3aed;
  --fb-pink: #ec4899;
  --fb-purple: #7c3aed;
  --fb-blue: #2563eb;
  --fb-cyan: #06b6d4;
  --fb-green: #10b981;
  --fb-danger: #f43f5e;
  --fb-warning: #f59e0b;
  --fb-radius: 20px;
  --fb-shadow: 0 20px 40px -15px rgba(93, 73, 153, 0.07), 0 1px 3px rgba(0, 0, 0, 0.02);
  --fb-shadow-soft: 0 10px 25px -10px rgba(100, 82, 160, 0.05);
  --fb-gradient: linear-gradient(135deg, var(--fb-pink) 0%, var(--fb-purple) 52%, var(--fb-blue) 100%);
  --fb-gradient-soft: linear-gradient(135deg, rgba(236, 72, 153, 0.08), rgba(124, 58, 237, 0.06));
}

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

html {
  background-color: #f8f7fc;
  color-scheme: light;
}

body {
  margin: 0;
  color: var(--fb-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background: 
    radial-gradient(circle at 10% 15%, rgba(236, 72, 153, 0.07), transparent 30%),
    radial-gradient(circle at 90% 10%, rgba(37, 99, 235, 0.06), transparent 30%),
    radial-gradient(circle at 50% 80%, rgba(124, 58, 237, 0.05), transparent 40%),
    #f8f7fc;
}

a { color: var(--fb-purple); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--fb-pink); }

/* --- Topbar --- */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--fb-border);
}
.app-topbar::after {
  content: "";
  display: block;
  height: 2px;
  background: var(--fb-gradient);
  opacity: 0.8;
}
.topbar-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fb-text);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--fb-gradient);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.25);
}

.desktop-nav-links { align-items: center; gap: 6px; margin-left: auto; }
.desktop-nav-links .nav-link {
  color: var(--fb-text-soft);
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  background: transparent;
  transition: all 0.2s ease;
}
.desktop-nav-links .nav-link:hover, 
.desktop-nav-links .nav-link.active {
  background: var(--fb-surface-2);
  color: var(--fb-purple);
}

.user-chip {
  align-items: center;
  gap: 8px;
  color: var(--fb-text-soft);
  background: var(--fb-surface);
  border: 1px solid var(--fb-border-strong);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.875rem;
  box-shadow: var(--fb-shadow-soft);
}

.top-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--fb-text);
  background: var(--fb-surface);
  border: 1px solid var(--fb-border-strong);
  box-shadow: var(--fb-shadow-soft);
  transition: transform 0.1s ease;
}
.top-icon-btn:active { transform: scale(0.95); }

/* --- Layout & Typography --- */
.app-main { padding: 24px 16px 100px; max-width: 1180px; margin: 0 auto; }

h1, h2, h3, h4, h5, h6 { color: var(--fb-text); letter-spacing: -0.03em; }
h1 { font-weight: 800; font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.05; }
h2 { font-weight: 750; font-size: clamp(1.4rem, 4vw, 2.2rem); }

.text-secondary, .text-muted, .form-text { color: var(--fb-muted) !important; }

/* --- Cards & Hero --- */
.card, .stat-card {
  position: relative;
  background: var(--fb-surface);
  border: 1px solid var(--fb-border-strong);
  border-radius: var(--fb-radius);
  box-shadow: var(--fb-shadow);
  color: var(--fb-text);
}
.card-body { padding: 20px; }
.stat-card { padding: 20px; height: 100%; }

.app-hero {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  padding: 36px 28px;
  background: linear-gradient(145deg, #ffffff 0%, #f7f3fc 100%);
  border: 1px solid var(--fb-border-strong);
  box-shadow: var(--fb-shadow);
}
.app-hero::before {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 45%; height: 100%;
  background: radial-gradient(circle at 80% 30%, rgba(236, 72, 153, 0.08), transparent 60%);
  pointer-events: none;
}
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.15);
  color: var(--fb-kicker);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
}
.hero-title { max-width: 680px; margin: 0.75rem 0 1rem; }
.hero-copy { color: var(--fb-text-soft); max-width: 600px; font-size: 1.05rem; line-height: 1.5; }

/* --- Buttons --- */
.btn {
  border-radius: 12px;
  font-weight: 700;
  padding: 0.7rem 1.1rem;
  border-width: 1px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-sm { border-radius: 10px; padding: 0.45rem 0.75rem; }
.btn-lg { border-radius: 14px; padding: 0.85rem 1.4rem; }

.btn-primary, .btn-success {
  background: var(--fb-gradient) !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow: 0 10px 20px -5px rgba(124, 58, 237, 0.3);
}
.btn-primary:hover, .btn-success:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  color: #fff !important;
}

.btn-outline-primary, .btn-outline-success {
  background: var(--fb-surface);
  border-color: var(--fb-border-strong);
  color: var(--fb-purple);
}
.btn-outline-primary:hover {
  background: var(--fb-surface-2);
  border-color: var(--fb-purple);
  color: var(--fb-purple);
}

/* --- Forms & Inputs --- */
.form-control, .form-select {
  background: var(--fb-surface);
  border: 1px solid var(--fb-border-strong);
  color: var(--fb-text);
  border-radius: 12px;
  min-height: 46px;
  padding: 0.65rem 0.9rem;
  box-shadow: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus, .form-select:focus {
  background: var(--fb-surface);
  border-color: var(--fb-purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
.form-label { font-weight: 600; color: var(--fb-text-soft); font-size: 0.875rem; }

/* --- Mobile Navigation Bar --- */
.mobile-tabbar {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  height: 68px;
  z-index: 1040;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--fb-border-strong);
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(92, 74, 153, 0.12);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  padding: 4px;
}
.tab-item {
  color: var(--fb-muted);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  font-size: 0.65rem;
  font-weight: 700;
}
.tab-item i { font-size: 1.2rem; }
.tab-item.active { color: var(--fb-purple); }
.tab-main { margin-top: -24px; color: var(--fb-text); }
.tab-main-icon {
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  border-radius: 16px;
  background: var(--fb-gradient);
  color: #fff;
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.3);
  border: 4px solid #f8f7fc;
}

.desktop-only { display: none !important; }

@media(min-width: 992px) {
  .mobile-tabbar { display: none; }
  .desktop-only { display: block !important; }
}