:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #818cf8;
  --bg: #ffffff;
  --bg-alt: #f9fafb;
  --bg-card: #ffffff;
  --text: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --radius: 8px;
  --radius-lg: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #111827;
  --bg-alt: #1f2937;
  --bg-card: #1f2937;
  --text: #f9fafb;
  --text-secondary: #d1d5db;
  --text-muted: #6b7280;
  --border: #374151;
  --border-light: #1f2937;
  --shadow: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,.2);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.3);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* Utility */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 800px; margin: 0 auto; padding: 0 20px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.text-center { text-align: center; }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-muted { color: var(--text-secondary); }
.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; }
.mt-8 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .md-hide { display: none; }
}
@media (max-width: 640px) {
  .sm-hide { display: none; }
  .container { padding: 0 12px; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border: none; border-radius: var(--radius); font-size: .875rem;
  font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:hover { opacity: .9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-alt); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: .75rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* Cards */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow);
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 1.125rem; font-weight: 600; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: .875rem; background: var(--bg);
  color: var(--text); transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.form-textarea { min-height: 100px; resize: vertical; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th { background: var(--bg-alt); padding: 12px 16px; text-align: left; font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); }
tr:hover { background: var(--bg-alt); }
tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; padding: 2px 10px;
  border-radius: 9999px; font-size: .75rem; font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-neutral { background: var(--bg-alt); color: var(--text-secondary); }
[data-theme="dark"] .badge-success { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .badge-warning { background: #78350f; color: #fcd34d; }
[data-theme="dark"] .badge-danger { background: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .badge-info { background: #1e3a5f; color: #93c5fd; }

/* Badge: Free plan */
.badge-free { background: #dbeafe; color: #1e40af; }
/* Badge: Premium plan */
.badge-premium { background: #fde68a; color: #92400e; }

[data-theme="dark"] .badge-free { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-premium { background: #78350f; color: #fcd34d; }

/* Progress bar */
.progress-bar { width: 100%; height: 8px; background: var(--bg-alt); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .3s; }
.progress-fill-primary { background: var(--primary); }
.progress-fill-success { background: var(--success); }
.progress-fill-warning { background: var(--warning); }
.progress-fill-danger { background: var(--danger); }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 20px; border-radius: var(--radius); color: #fff;
  font-size: .875rem; box-shadow: var(--shadow-lg); max-width: 400px;
  animation: slideIn .3s ease;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center; animation: fadeIn .2s;
}
.modal {
  background: var(--bg-card); border-radius: var(--radius-lg); padding: 32px;
  max-width: 500px; width: 90%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Top nav */
.topnav {
  background: var(--bg); border-bottom: 1px solid var(--border);
  padding: 0 20px; position: sticky; top: 0; z-index: 100;
}
.topnav-inner {
  max-width: 1200px; margin: 0 auto; display: flex; align-items: center;
  justify-content: space-between; height: 64px;
}
.topnav-brand { font-size: 1.25rem; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.topnav-brand svg { width: 28px; height: 28px; }
.topnav-links { display: flex; align-items: center; gap: 24px; }
.topnav-links a { color: var(--text-secondary); font-size: .875rem; font-weight: 500; }
.topnav-links a:hover { color: var(--text); text-decoration: none; }
.topnav-actions { display: flex; align-items: center; gap: 12px; }
.topnav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; color: var(--text); }
@media (max-width: 768px) {
  .topnav-links { display: none; }
  .topnav-links.open {
    display: flex; flex-direction: column; position: absolute;
    top: 64px; left: 0; right: 0; background: var(--bg);
    border-bottom: 1px solid var(--border); padding: 16px; gap: 12px;
  }
  .topnav-toggle { display: block; }
}

/* Dashboard layout */
.dash-layout { display: flex; min-height: calc(100vh - 64px); }
.dash-sidebar {
  width: 260px; background: var(--bg-alt); border-right: 1px solid var(--border);
  padding: 20px 0; flex-shrink: 0; overflow-y: auto;
}
.dash-sidebar-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px;
  color: var(--text-secondary); font-size: .875rem; font-weight: 500;
  transition: all .15s; cursor: pointer; border: none; background: none; width: 100%; text-align: left;
}
.dash-sidebar-link:hover { background: var(--border-light); color: var(--text); text-decoration: none; }
.dash-sidebar-link.active { background: rgba(79,70,229,.1); color: var(--primary); font-weight: 600; border-right: 3px solid var(--primary); }
.dash-sidebar-section { padding: 8px 20px 4px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.dash-main { flex: 1; padding: 24px; overflow-x: auto; }
.dash-header { margin-bottom: 24px; }
.dash-title { font-size: 1.5rem; font-weight: 700; }
.dash-subtitle { color: var(--text-secondary); font-size: .875rem; margin-top: 4px; }

/* Stats */
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.stat-label { font-size: .75rem; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .03em; }
.stat-value { font-size: 1.75rem; font-weight: 700; margin-top: 4px; }
.stat-change { font-size: .75rem; margin-top: 4px; }

/* Feature cards */
.feature-card { text-align: center; padding: 32px 24px; }
.feature-icon { width: 48px; height: 48px; margin: 0 auto 16px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.feature-title { font-size: 1.125rem; font-weight: 600; margin-bottom: 8px; }
.feature-desc { font-size: .875rem; color: var(--text-secondary); }

/* Pricing cards */
.pricing-card {
  background: var(--bg-card); border: 2px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; text-align: center;
  transition: transform .2s;
}
.pricing-card:hover { transform: translateY(-4px); }
.pricing-card.popular { border-color: var(--primary); position: relative; }
.pricing-card.popular::before {
  content: 'Most Popular'; position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; padding: 4px 16px; border-radius: 9999px;
  font-size: .75rem; font-weight: 600;
}
.pricing-price { font-size: 2.5rem; font-weight: 700; margin: 16px 0 4px; }
.pricing-period { color: var(--text-secondary); font-size: .875rem; margin-bottom: 24px; }
.pricing-features { list-style: none; text-align: left; margin-bottom: 24px; }
.pricing-features li { padding: 8px 0; font-size: .875rem; display: flex; align-items: center; gap: 8px; }
.pricing-features li::before { content: '✓'; color: var(--success); font-weight: 700; }

/* Hero */
.hero { padding: 80px 0 60px; text-align: center; }
.hero-title { font-size: 3rem; font-weight: 800; line-height: 1.1; margin-bottom: 20px; }
.hero-subtitle { font-size: 1.25rem; color: var(--text-secondary); max-width: 640px; margin: 0 auto 32px; }
.hero-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-preview {
  margin-top: 48px; background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; text-align: left;
  max-width: 900px; margin-left: auto; margin-right: auto;
}
@media (max-width: 640px) {
  .hero { padding: 40px 0 30px; }
  .hero-title { font-size: 1.75rem; }
  .hero-subtitle { font-size: 1rem; }
}

/* Sections */
.section { padding: 64px 0; }
.section-alt { background: var(--bg-alt); }
.section-title { font-size: 2rem; font-weight: 700; text-align: center; margin-bottom: 12px; }
.section-subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 48px; max-width: 600px; margin-left: auto; margin-right: auto; }

/* Footer */
.footer { background: var(--bg-alt); border-top: 1px solid var(--border); padding: 48px 0 24px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 32px; }
@media (max-width: 768px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-brand { font-size: 1.125rem; font-weight: 700; color: var(--primary); margin-bottom: 12px; }
.footer-desc { font-size: .875rem; color: var(--text-secondary); }
.footer-title { font-size: .875rem; font-weight: 600; margin-bottom: 12px; }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { font-size: .875rem; color: var(--text-secondary); }
.footer-links a:hover { color: var(--text); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 24px; display: flex; justify-content: space-between; align-items: center; font-size: .8125rem; color: var(--text-muted); }
@media (max-width: 640px) { .footer-bottom { flex-direction: column; gap: 8px; } }

/* Testimonials */
.testimonial-card { padding: 24px; }
.testimonial-stars { color: #fbbf24; margin-bottom: 8px; }
.testimonial-text { font-size: .875rem; color: var(--text-secondary); margin-bottom: 16px; font-style: italic; }
.testimonial-author { font-weight: 600; font-size: .875rem; }
.testimonial-role { font-size: .75rem; color: var(--text-muted); }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--border); padding: 16px 0; cursor: pointer; }
.faq-question { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: .875rem; }
.faq-answer { margin-top: 8px; font-size: .875rem; color: var(--text-secondary); display: none; }
.faq-item.open .faq-answer { display: block; }
.faq-item.open .faq-arrow { transform: rotate(180deg); }
.faq-arrow { transition: transform .2s; }

/* Scraper preview */
.scraper-demo {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden;
}
.scraper-demo-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.scraper-demo-url { flex: 1; padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: .8125rem; background: var(--bg-alt); color: var(--text-muted); }
.scraper-demo-body { padding: 16px 20px; }
.scraper-demo-stats { display: flex; gap: 24px; margin-bottom: 16px; }
.scraper-demo-stat { font-size: .75rem; color: var(--text-secondary); }
.scraper-demo-stat strong { color: var(--text); font-size: 1rem; display: block; }

/* Checkbox */
.checkbox { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* Star rating */
.stars { color: #fbbf24; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state-title { font-size: 1.125rem; font-weight: 600; margin-bottom: 8px; }
.empty-state-desc { color: var(--text-secondary); font-size: .875rem; margin-bottom: 24px; }

/* Spinner */
.spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive table */
@media (max-width: 768px) {
  .dash-sidebar { display: none; }
  .dash-sidebar.open { display: block; position: fixed; top: 64px; left: 0; bottom: 0; z-index: 50; width: 260px; }
  .dash-main { padding: 16px; }
  table { font-size: .75rem; }
  th, td { padding: 8px 10px; }
}

/* Sidebar toggle for mobile */
.dash-sidebar-toggle {
  display: none; position: fixed; bottom: 20px; right: 20px; z-index: 51;
  width: 48px; height: 48px; border-radius: 50%; background: var(--primary);
  color: #fff; border: none; box-shadow: var(--shadow-lg); cursor: pointer;
  font-size: 1.25rem;
}
@media (max-width: 768px) { .dash-sidebar-toggle { display: flex; align-items: center; justify-content: center; } }
