/* ─── Google Fonts ───────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ─── Custom properties ──────────────────────────────────────────────────── */
:root {
  /* Brand colors */
  --bg:              #0D0D14;
  --card-bg:         #12121F;
  --secondary-bg:    #1A1A2E;
  --border:          #1E1E35;
  --purple:          #6C63FF;
  --purple-end:      #a855f7;
  --purple-gradient: linear-gradient(135deg, #6C63FF, #a855f7);
  --red:             #FF6B6B;
  --yellow:          #F7B731;
  --green:           #26de81;
  --blue:            #45aaf2;
  --text-primary:    #E8E6F0;
  --text-secondary:  #9D9DB8;
  --text-muted:      #7070A0;

  /* Layout */
  --sidebar-w:   220px;
  --topnav-h:    60px;

  /* Design tokens */
  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   18px;
  --shadow:      0 4px 24px rgba(0, 0, 0, 0.45);
  --shadow-sm:   0 2px 10px rgba(0, 0, 0, 0.3);
  --transition:  0.2s ease;
}

/* ─── Reset + base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--purple); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--purple-end); }

img { display: block; max-width: 100%; }

button { cursor: pointer; font-family: inherit; }

ul, ol { list-style: none; }

/* ─── Dark scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar              { width: 6px; height: 6px; }
::-webkit-scrollbar-track        { background: var(--bg); }
::-webkit-scrollbar-thumb        { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover  { background: var(--text-muted); }

/* ─── Layout shell ───────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.topnav {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topnav-h);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.main-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topnav-h);
  min-height: 100vh;
}

.page-inner {
  padding: 32px;
  max-width: 1100px;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 190;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ─── Sidebar internals ──────────────────────────────────────────────────── */
.sidebar-logo {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.logo-mark {
  width: 34px;
  height: 34px;
  background: var(--purple-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.logo-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.logo-text span {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 8px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  position: relative;
}

.nav-link:hover {
  background: var(--secondary-bg);
  color: var(--text-primary);
}

.nav-link.active {
  background: rgba(108, 99, 255, 0.15);
  color: var(--purple);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  bottom: 25%;
  width: 3px;
  background: var(--purple);
  border-radius: 0 3px 3px 0;
}

.nav-link svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

/* Progress widget */
.sidebar-widget {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

.widget-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.week-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.week-progress-label strong {
  color: var(--text-primary);
}

/* Apps built widget */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 2px;
}

.app-box {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--secondary-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-box.built {
  background: rgba(108, 99, 255, 0.15);
  border-color: var(--purple);
}

.app-box svg { width: 14px; height: 14px; color: var(--text-muted); }
.app-box.built svg { color: var(--purple); }

/* ─── Top nav internals ──────────────────────────────────────────────────── */
.topnav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}

.hamburger:hover {
  background: var(--secondary-bg);
  color: var(--text-primary);
}

.page-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.points-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--secondary-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--yellow);
}

.points-badge svg { width: 14px; height: 14px; }

/* User avatar + dropdown */
.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-primary);
  transition: background var(--transition);
}

.user-menu-trigger:hover { background: var(--secondary-bg); }

.user-menu-trigger svg { width: 14px; height: 14px; color: var(--text-muted); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 180px;
  box-shadow: var(--shadow);
  padding: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity var(--transition), transform var(--transition);
  z-index: 300;
}

.user-dropdown.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.dropdown-item:hover {
  background: var(--secondary-bg);
  color: var(--text-primary);
}

.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger:hover { background: rgba(255, 107, 107, 0.1); color: var(--red); }

.dropdown-item svg { width: 14px; height: 14px; flex-shrink: 0; }

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

.dropdown-user-info {
  padding: 8px 10px 6px;
}

.dropdown-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.dropdown-user-email {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Avatar ─────────────────────────────────────────────────────────────── */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--purple-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }
.avatar-xl { width: 72px; height: 72px; font-size: 26px; }

/* ─── Card ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card-sm { padding: 16px; }
.card-lg { padding: 32px; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }

.btn-primary {
  background: var(--purple-gradient);
  color: #fff;
  box-shadow: 0 4px 16px rgba(108, 99, 255, 0.3);
}

.btn-primary:hover {
  opacity: 0.9;
  box-shadow: 0 6px 20px rgba(108, 99, 255, 0.45);
  color: #fff;
}

.btn-secondary {
  background: var(--secondary-bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(255, 107, 107, 0.12);
  color: var(--red);
  border: 1px solid rgba(255, 107, 107, 0.25);
}

.btn-danger:hover {
  background: rgba(255, 107, 107, 0.2);
  color: var(--red);
}

.btn-ghost {
  background: none;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: var(--secondary-bg);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge svg { width: 11px; height: 11px; }

.badge-live {
  background: rgba(255, 107, 107, 0.15);
  color: var(--red);
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.badge-video {
  background: rgba(69, 170, 242, 0.12);
  color: var(--blue);
  border: 1px solid rgba(69, 170, 242, 0.25);
}

.badge-free {
  background: rgba(38, 222, 129, 0.12);
  color: var(--green);
  border: 1px solid rgba(38, 222, 129, 0.25);
}

.badge-locked {
  background: rgba(112, 112, 160, 0.12);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge-purple {
  background: rgba(108, 99, 255, 0.12);
  color: var(--purple);
  border: 1px solid rgba(108, 99, 255, 0.25);
}

.badge-yellow {
  background: rgba(247, 183, 49, 0.12);
  color: var(--yellow);
  border: 1px solid rgba(247, 183, 49, 0.25);
}

/* ─── Progress bar ───────────────────────────────────────────────────────── */
.progress {
  height: 6px;
  background: var(--secondary-bg);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--purple-gradient);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-bar.green  { background: linear-gradient(90deg, #26de81, #20c36e); }
.progress-bar.yellow { background: linear-gradient(90deg, #F7B731, #f5a000); }
.progress-bar.blue   { background: linear-gradient(90deg, #45aaf2, #2e86d4); }

.progress-lg { height: 10px; border-radius: 5px; }
.progress-sm { height: 4px; }

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
  transform: translateY(12px) scale(0.98);
  transition: transform var(--transition);
}

.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-lg  { max-width: 640px; }
.modal-xl  { max-width: 800px; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-title { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.modal-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
  margin-left: 12px;
}

.modal-close:hover { background: var(--secondary-bg); color: var(--text-primary); }
.modal-close svg { width: 18px; height: 18px; display: block; }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 28px;
}

/* ─── Toast notifications ────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 600;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: toastIn 0.25s ease forwards;
  max-width: 320px;
  border-left: 3px solid var(--purple);
}

.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--yellow); }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── Flash messages ─────────────────────────────────────────────────────── */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 20px;
}

.flash-success { background: rgba(38, 222, 129, 0.1);  color: var(--green);  border: 1px solid rgba(38, 222, 129, 0.25); }
.flash-error   { background: rgba(255, 107, 107, 0.1); color: var(--red);    border: 1px solid rgba(255, 107, 107, 0.25); }
.flash-info    { background: rgba(69, 170, 242, 0.1);  color: var(--blue);   border: 1px solid rgba(69, 170, 242, 0.25); }
.flash svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ─── Form elements ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--secondary-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.form-input.error { border-color: var(--red); }

.form-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 5px;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239D9DB8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* ─── Typography utilities ───────────────────────────────────────────────── */
.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-purple    { color: var(--purple); }
.text-green     { color: var(--green); }
.text-red       { color: var(--red); }
.text-yellow    { color: var(--yellow); }
.text-blue      { color: var(--blue); }

.text-xs  { font-size: 11px; }
.text-sm  { font-size: 13px; }
.text-md  { font-size: 15px; }
.text-lg  { font-size: 18px; }
.text-xl  { font-size: 22px; }
.text-2xl { font-size: 28px; }

.font-medium  { font-weight: 500; }
.font-semi    { font-weight: 600; }
.font-bold    { font-weight: 700; }

.gradient-text {
  background: var(--purple-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Layout utilities ───────────────────────────────────────────────────── */
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.gap-6  { gap: 24px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.w-full { width: 100%; }
.ml-auto { margin-left: auto; }

/* ─── Stat card ──────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.stat-icon svg { width: 20px; height: 20px; }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── Divider ────────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ─── Empty state ────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  opacity: 0.4;
}

.empty-state p { font-size: 14px; }

/* ─── Table ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--secondary-bg);
}

td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(30, 30, 53, 0.5); }

/* ─── Upgrade CTA banner ─────────────────────────────────────────────────── */
.upgrade-banner {
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.15), rgba(168, 85, 247, 0.1));
  border: 1px solid rgba(108, 99, 255, 0.3);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.upgrade-banner-text strong {
  font-size: 15px;
  color: var(--text-primary);
  display: block;
}

.upgrade-banner-text span {
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── Mobile responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow);
  }

  .topnav {
    left: 0;
  }

  .hamburger {
    display: flex;
    align-items: center;
  }

  .main-content {
    margin-left: 0;
  }

  .page-inner {
    padding: 20px 16px;
  }

  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }

  .topnav-right .points-badge span { display: none; }

  .modal { padding: 24px; }
}

@media (max-width: 480px) {
  .topnav { padding: 0 16px; }

  .page-title { font-size: 14px; }
}

/* ─── Community Switcher ─────────────────────────────────────────────────── */
.comm-switcher {
  position: relative;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.comm-switcher-current {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 14px;
  cursor: pointer;
  transition: background 0.18s;
  user-select: none;
}
.comm-switcher-current:hover { background: rgba(255,255,255,0.03); }
.comm-switcher-current svg   { width: 15px; height: 15px; color: var(--text-muted); margin-left: auto; flex-shrink: 0; }

.comm-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--purple-gradient);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.comm-avatar img { width: 100%; height: 100%; object-fit: cover; }

.comm-switcher-info { flex: 1; min-width: 0; }
.comm-switcher-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.comm-switcher-role {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Dropdown */
.comm-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 8px;
  right: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 300;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  overflow: hidden;
}
.comm-menu.open { display: block; }

.comm-menu-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  padding: 10px 14px 5px;
}
.comm-menu-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 5px 0;
}
.comm-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
  font-family: inherit;
}
.comm-menu-item:hover { background: var(--secondary-bg); color: var(--text-primary); }
.comm-menu-item.active { color: var(--purple); }
.comm-menu-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.comm-menu-item svg:last-child { margin-left: auto; color: var(--purple); }

.comm-menu-avatar {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: var(--purple-gradient);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.comm-menu-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comm-menu-name { flex: 1; }

.comm-menu-item-form { margin: 0; padding: 0; }

/* ─── Gradient text utility ──────────────────────────────────────────────── */
.gradient-text {
  background: var(--purple-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Sidebar brand (platform logo above community switcher) ─────────────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 18px 16px 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.sidebar-brand-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

