/* ================================================
   MakeLeads.us — Global Design System
   Bold & Sales-Driven Theme
   ================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #FF4D00;
  --primary-dark: #CC3D00;
  --primary-light: #FF6A2B;
  --secondary: #0A0A1A;
  --secondary-light: #12122A;
  --accent: #00D4FF;
  --accent-dark: #00A8CC;
  --success: #00E676;
  --warning: #FFB300;
  --danger: #FF1744;
  --white: #FFFFFF;
  --gray-50: #F8F9FA;
  --gray-100: #F1F3F5;
  --gray-200: #E9ECEF;
  --gray-300: #DEE2E6;
  --gray-400: #ADB5BD;
  --gray-500: #6C757D;
  --gray-600: #495057;
  --gray-700: #343A40;
  --gray-800: #1A1A2E;
  --gray-900: #0D0D1A;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.2);
  --shadow-glow: 0 0 30px rgba(255,77,0,0.3);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  color: var(--gray-700);
  background: var(--white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.15;
  color: var(--secondary);
}
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h3 { font-size: clamp(1.3rem, 3vw, 1.8rem); }
h4 { font-size: 1.25rem; }
p { font-size: 1.05rem; color: var(--gray-600); }

.text-gradient {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Layout --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.container-sm { max-width: 800px; margin: 0 auto; padding: 0 24px; }
.container-lg { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

.section { padding: 80px 0; }
.section-dark { background: var(--secondary); color: var(--white); }
.section-dark h2, .section-dark h3, .section-dark h4 { color: var(--white); }
.section-dark p { color: var(--gray-400); }
.section-gray { background: var(--gray-50); }

.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { flex-direction: column; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.gap-4 { gap: 32px; }

.text-center { text-align: center; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mb-5 { margin-bottom: 48px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  transition: all 0.25s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--white);
  box-shadow: 0 4px 15px rgba(255,77,0,0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(255,77,0,0.5);
}
.btn-secondary {
  background: transparent;
  color: var(--white);
  border: 2px solid rgba(255,255,255,0.3);
}
.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--secondary);
  font-weight: 800;
}
.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0,212,255,0.4);
}
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary);
  color: var(--white);
}
.btn-dark {
  background: var(--secondary);
  color: var(--white);
}
.btn-dark:hover {
  background: var(--secondary-light);
  transform: translateY(-2px);
}
.btn-lg { padding: 18px 44px; font-size: 1.1rem; }
.btn-sm { padding: 10px 20px; font-size: 0.875rem; }
.btn-block { width: 100%; }
.btn-icon { width: 42px; height: 42px; padding: 0; border-radius: 50%; }

/* --- Cards --- */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: all 0.3s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}
.card-dark {
  background: var(--secondary-light);
  border-color: rgba(255,255,255,0.08);
}
.card-dark:hover {
  border-color: var(--primary);
  box-shadow: 0 0 30px rgba(255,77,0,0.15);
}
.card-featured {
  border: 2px solid var(--primary);
  position: relative;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 20px;
}
.badge-primary { background: rgba(255,77,0,0.12); color: var(--primary); }
.badge-accent { background: rgba(0,212,255,0.12); color: var(--accent-dark); }
.badge-success { background: rgba(0,230,118,0.12); color: #00C853; }
.badge-warning { background: rgba(255,179,0,0.12); color: #FF8F00; }
.badge-premium {
  background: linear-gradient(135deg, var(--primary), #FF6A2B);
  color: var(--white);
}

/* --- Forms --- */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--gray-800);
  transition: border-color 0.2s;
  font-family: var(--font-main);
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,77,0,0.1);
}
.form-input-dark {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
  color: var(--white);
}
.form-input-dark:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,77,0,0.15);
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236C757D' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* --- Navigation (Public) --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 16px 0;
  transition: all 0.3s ease;
}
.navbar.scrolled {
  background: rgba(10,10,26,0.95);
  backdrop-filter: blur(12px);
  padding: 10px 0;
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}
.navbar .container { display: flex; align-items: center; justify-content: space-between; }
.nav-logo {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-logo span { color: var(--primary); }
.nav-links { display: flex; align-items: center; gap: 32px; }
.nav-links .mobile-only { display: none; }
.nav-links a {
  color: rgba(255,255,255,0.8);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--primary); }
.nav-cta { display: flex; align-items: center; gap: 16px; }

/* --- Hamburger --- */
.hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; z-index: 1001; }
.hamburger span { width: 28px; height: 3px; background: var(--white); border-radius: 3px; transition: 0.3s; }
.hamburger.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* --- Dashboard Layout --- */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  background: var(--secondary);
  color: var(--white);
  padding: 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-logo {
  padding: 0 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 16px;
  font-size: 1.3rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-logo span { color: var(--primary); }
.sidebar-section {
  padding: 0 16px;
  margin-bottom: 8px;
}
.sidebar-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gray-500);
  padding: 8px;
  font-weight: 600;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--gray-400);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.sidebar-link:hover { background: rgba(255,255,255,0.05); color: var(--white); }
.sidebar-link.active {
  background: rgba(255,77,0,0.15);
  color: var(--primary);
}
.sidebar-link .icon { width: 20px; text-align: center; font-size: 1.1rem; }
.sidebar-link .premium-tag {
  margin-left: auto;
  font-size: 0.65rem;
  background: linear-gradient(135deg, var(--primary), #FF6A2B);
  color: var(--white);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.main-content {
  margin-left: 260px;
  flex: 1;
  background: var(--gray-50);
  min-height: 100vh;
  /* Critical for mobile: without this, any wide child (tables, charts)
     stretches the whole page sideways instead of scrolling in its box. */
  min-width: 0;
  max-width: 100%;
}
.topbar {
  background: var(--white);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-left h2 { font-size: 1.4rem; color: var(--secondary); }
.topbar-right { display: flex; align-items: center; gap: 20px; }
.credit-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,77,0,0.08);
  padding: 8px 16px;
  border-radius: var(--radius-xl);
  font-weight: 700;
  color: var(--primary);
}
.credit-display .credit-icon { font-size: 1.2rem; display: inline-flex; align-items: center; line-height: 0; }
.credit-display .credit-icon svg { display: block; }
.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 700;
  font-size: 0.9rem;
}
.page-content { padding: 32px; }

/* --- Mobile sidebar toggle --- */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--secondary);
  font-size: 1.5rem;
  padding: 4px;
}

/* --- Stats Cards --- */
.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1px solid var(--gray-200);
}
.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 16px;
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--secondary);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--gray-500);
  font-weight: 500;
}

/* --- Tables --- */
.table-wrapper {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 14px 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.data-table td {
  padding: 14px 20px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}
.data-table tr:hover { background: rgba(255,77,0,0.02); }

/* --- Pricing Cards --- */
.pricing-card {
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  position: relative;
  transition: all 0.3s ease;
}
.pricing-card.featured {
  border: 2px solid var(--primary);
  transform: scale(1.05);
}
.pricing-card .pricing-badge {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--primary), #FF6A2B);
  color: var(--white);
  padding: 6px 20px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}
.pricing-card .price {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--white);
  line-height: 1;
  margin: 20px 0 4px;
}
.pricing-card .price-period {
  font-size: 0.9rem;
  color: var(--gray-400);
  margin-bottom: 24px;
}
.pricing-card .pricing-features {
  text-align: left;
  margin-bottom: 32px;
}
.pricing-card .pricing-features li {
  padding: 8px 0;
  color: var(--gray-300);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pricing-card .pricing-features li .check { color: var(--success); font-weight: 700; }

/* --- Tabs --- */
.tabs { display: flex; gap: 4px; background: var(--gray-100); padding: 4px; border-radius: var(--radius-sm); }
.tab-btn {
  padding: 10px 24px;
  background: transparent;
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gray-500);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.tab-btn.active {
  background: var(--white);
  color: var(--secondary);
  box-shadow: var(--shadow-sm);
}
.tab-btn:hover:not(.active) { color: var(--secondary); }

/* --- Search Bar --- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 4px 4px 4px 16px;
}
.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--gray-700);
  padding: 10px 0;
  background: transparent;
}
.search-bar .btn { border-radius: var(--radius-sm); }

/* --- Filter Pills --- */
.filter-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-pill {
  padding: 8px 20px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-xl);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-600);
  background: var(--white);
  cursor: pointer;
  transition: all 0.2s;
}
.filter-pill:hover { border-color: var(--primary); color: var(--primary); }
.filter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

/* --- Lead Cards --- */
.lead-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all 0.3s;
}
.lead-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(255,77,0,0.1);
}
.lead-card .lead-category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.lead-card .lead-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 4px;
}
.lead-card .lead-meta {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-bottom: 16px;
}
.lead-card .lead-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.lead-card .lead-detail {
  font-size: 0.8rem;
  color: var(--gray-500);
}
.lead-card .lead-detail strong {
  color: var(--gray-700);
  display: block;
}
.lead-card .lead-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--gray-100);
}
.lead-card .lead-cost {
  font-weight: 800;
  color: var(--primary);
  font-size: 1.1rem;
}
.lead-card .lead-cost span {
  font-size: 0.8rem;
  color: var(--gray-500);
  font-weight: 500;
}

/* --- Toggle Switch --- */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 26px;
  cursor: pointer;
  transition: 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--white);
  left: 3px;
  bottom: 3px;
  transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }

/* --- Campaign Cards --- */
.campaign-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.campaign-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.campaign-info { flex: 1; }
.campaign-info h4 { font-size: 1rem; margin-bottom: 4px; }
.campaign-info p { font-size: 0.85rem; margin-bottom: 0; }

/* --- Progress Bar --- */
.progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.5s ease;
}

/* --- Alert / Notice --- */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.9rem;
}
.alert-info { background: rgba(0,212,255,0.08); border: 1px solid rgba(0,212,255,0.2); color: var(--accent-dark); }
.alert-warning { background: rgba(255,179,0,0.08); border: 1px solid rgba(255,179,0,0.2); color: #E65100; }
.alert-success { background: rgba(0,230,118,0.08); border: 1px solid rgba(0,230,118,0.2); color: #2E7D32; }

/* --- Footer --- */
.footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 64px 0 32px;
}
.footer h4 { color: var(--white); font-size: 1rem; margin-bottom: 20px; }
.footer a { color: var(--gray-400); font-size: 0.9rem; transition: color 0.2s; }
.footer a:hover { color: var(--primary); }
.footer-links li { margin-bottom: 10px; }
.footer-bottom {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

/* --- Animations --- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(255,77,0,0.3); }
  50% { box-shadow: 0 0 40px rgba(255,77,0,0.6); }
}
.animate-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.animate-in.visible {
  opacity: 1;
  transform: translateY(0);
}
.animate-delay-1 { transition-delay: 0.1s; }
.animate-delay-2 { transition-delay: 0.2s; }
.animate-delay-3 { transition-delay: 0.3s; }
.animate-delay-4 { transition-delay: 0.4s; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .pricing-card.featured { transform: scale(1); }
}
@media (max-width: 768px) {
  .nav-links, .nav-cta { display: none; }
  .hamburger { display: flex; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(10,10,26,0.98);
    backdrop-filter: blur(12px);
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  }
  .nav-links.open .mobile-only { display: block; }
  .section { padding: 48px 0; }
  .grid-3 { grid-template-columns: 1fr; }
  .topbar { padding: 10px 12px; flex-wrap: wrap; row-gap: 8px; }
  .topbar-left h2 { font-size: 1.05rem; }
  .topbar-left .badge { font-size: 0.6rem; padding: 3px 8px; }
  .topbar-right { gap: 12px; margin-left: auto; }
  .credit-display { padding: 6px 10px; font-size: 0.8rem; gap: 6px; }
  .user-avatar { width: 32px; height: 32px; font-size: 0.8rem; }
  .page-content { padding: 12px; }
  .footer-bottom { flex-direction: column; gap: 16px; text-align: center; }
  /* Charts and media never push the page sideways */
  .page-content canvas, .page-content img, .page-content svg { max-width: 100%; }
  /* Modals fit phone screens */
  .modal, .modal-content { max-width: calc(100vw - 24px); }
}
@media (max-width: 480px) {
  .btn-lg { padding: 14px 28px; font-size: 1rem; }
  .container { padding: 0 16px; }
}


/* ---- Profile avatar dropdown ---- */
.avatar-wrap { position: relative; display: flex; align-items: center; }
.avatar-wrap .user-avatar { cursor: pointer; }
.avatar-dropdown {
  display: none; position: absolute; top: calc(100% + 10px); right: 0;
  width: 220px; background: #fff; border: 1px solid var(--gray-200);
  border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  z-index: 1100; overflow: hidden;
}
.avatar-dropdown.open { display: block; }
.avatar-dropdown .avatar-dd-header {
  padding: 14px 16px; border-bottom: 1px solid var(--gray-100);
  font-size: 0.85rem;
}
.avatar-dropdown .avatar-dd-header strong { display: block; color: var(--secondary); font-size: 0.9rem; }
.avatar-dropdown .avatar-dd-header span { color: var(--gray-400); font-size: 0.78rem; word-break: break-all; }
.avatar-dropdown a {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  color: var(--gray-600); font-size: 0.88rem; font-weight: 600; text-decoration: none;
}
.avatar-dropdown a:hover { background: var(--gray-50); color: var(--secondary); }
.avatar-dropdown a.logout { color: #D50000; border-top: 1px solid var(--gray-100); }
.avatar-dropdown a.logout:hover { background: rgba(255,23,68,0.05); }
