:root {
  --bg: #0b0e1a;
  --bg-card: #111827;
  --bg-input: #1e293b;
  --border: rgba(148, 163, 184, 0.15);
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Layout ─── */
.container { max-width: 960px; margin: 0 auto; padding: 24px; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
header h1 { font-size: 1.1rem; font-weight: 700; }
header .user { color: var(--text-secondary); font-size: 0.85rem; }

/* ─── Cards ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}
.card:hover { border-color: rgba(59, 130, 246, 0.3); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.card-title { font-size: 1.1rem; font-weight: 600; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-input); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--text); }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; }
.btn-lg { width: 100%; padding: 14px 24px; font-size: 1rem; }

/* ─── Forms ─── */
input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group { margin-bottom: 16px; }

/* ─── Status badges ─── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-pending { background: rgba(245,158,11,0.15); color: var(--amber); }
.badge-processing { background: rgba(59,130,246,0.15); color: var(--accent); }
.badge-completed { background: rgba(16,185,129,0.15); color: var(--green); }
.badge-failed { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-weekly { background: rgba(139,92,246,0.15); color: #8b5cf6; }
.badge-biweekly { background: rgba(59,130,246,0.15); color: var(--accent); }
.badge-monthly { background: rgba(16,185,129,0.15); color: var(--green); }
.badge-active { background: rgba(16,185,129,0.15); color: var(--green); }
.badge-free { background: rgba(139,92,246,0.15); color: #8b5cf6; }
.badge-past_due { background: rgba(245,158,11,0.15); color: var(--amber); }
.badge-cancelled { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-none { background: rgba(100,116,139,0.15); color: var(--text-muted); }

/* ─── Tables ─── */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
tr:hover td { background: rgba(59,130,246,0.04); }

/* ─── Empty states ─── */
.empty { text-align: center; padding: 48px; color: var(--text-muted); }
.empty p { margin-bottom: 16px; }

/* ─── Misc ─── */
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.section-title h2 { font-size: 1.3rem; font-weight: 700; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.source-list { list-style: none; padding: 0; }
.source-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}
.source-url { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 500px; }
.source-type { color: var(--text-muted); font-size: 0.7rem; text-transform: uppercase; }

/* ─── Modals ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

/* ─── Pricing (logged-in upgrade) ─── */
.pricing-page { max-width: 480px; margin: 60px auto 0; text-align: center; }
.pricing-page h2 { font-size: 1.8rem; margin-bottom: 8px; }
.pricing-subtitle { color: var(--text-secondary); margin-bottom: 32px; font-size: 0.95rem; }

.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}
.pricing-amount { font-size: 3rem; font-weight: 800; margin-bottom: 24px; }
.pricing-amount span { font-size: 1rem; font-weight: 400; color: var(--text-secondary); }

.pricing-features { list-style: none; padding: 0; margin-bottom: 28px; text-align: left; }
.pricing-features li { padding: 6px 0; color: var(--text-secondary); font-size: 0.9rem; }
.pricing-features li::before { content: '\2713  '; color: var(--green); font-weight: bold; }

.coupon-section { margin-bottom: 20px; }
.coupon-row { display: flex; gap: 8px; }
.coupon-row input { flex: 1; }
.coupon-msg { font-size: 0.8rem; margin-top: 6px; min-height: 18px; }
.coupon-valid { color: var(--green); }
.coupon-invalid { color: var(--red); }
.billing-note { color: var(--text-muted); font-size: 0.85rem; margin-top: 20px; }

/* ─── Billing Warning Banner ─── */
.billing-warning {
  background: rgba(245, 158, 11, 0.12);
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--amber);
  text-align: center;
  padding: 10px 24px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ─── Free Tier Banner ─── */
.free-tier-banner {
  background: rgba(59,130,246,0.06);
  border-bottom: 1px solid rgba(59,130,246,0.15);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.free-tier-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--accent);
  background: rgba(59,130,246,0.15);
  padding: 3px 10px;
  border-radius: 4px;
}
.free-tier-usage {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

/* ════════════════════════════════════════════════════
   LANDING PAGE
   ════════════════════════════════════════════════════ */

.landing { overflow-x: hidden; }

/* ─── Nav ─── */
.landing-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(11,14,26,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.landing-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.landing-logo {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}
.landing-nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}
.landing-nav-links a { color: var(--text-secondary); font-size: 0.88rem; font-weight: 500; }
.landing-nav-links a:hover { color: var(--text); text-decoration: none; }

/* ─── Hero ─── */
.landing-hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 100px 24px 80px;
  position: relative;
  background: linear-gradient(160deg, #0b0e1a 0%, #131838 35%, #0f2847 65%, #0b0e1a 100%);
}
.landing-hero-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 30% 40%, rgba(59,130,246,0.12) 0%, transparent 70%),
    radial-gradient(ellipse 500px 350px at 70% 60%, rgba(139,92,246,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 300px 300px at 50% 80%, rgba(16,185,129,0.05) 0%, transparent 70%);
  pointer-events: none;
}
.landing-hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
}
.landing-hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.12;
  margin-bottom: 20px;
  letter-spacing: -0.5px;
}
.landing-hero .subtitle {
  color: var(--text-secondary);
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.7;
  margin-bottom: 36px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}
.cta-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ─── Credibility Bar ─── */
.credibility-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  flex-wrap: wrap;
}
.cred-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
}

/* ─── Landing Sections ─── */
.landing-section {
  padding: 80px 24px;
  max-width: 1100px;
  margin: 0 auto;
}
.landing-section-dark {
  max-width: 100%;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.landing-section-dark > * {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}
.section-heading {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}
.section-sub {
  text-align: center;
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 48px;
}

/* ─── How It Works ─── */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 24px;
  position: relative;
  transition: border-color 0.2s, transform 0.2s;
}
.step-card:hover { border-color: rgba(59,130,246,0.3); transform: translateY(-2px); }
.step-num {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--accent);
  opacity: 0.5;
  letter-spacing: 1px;
}
.step-icon { font-size: 2rem; margin-bottom: 14px; }
.step-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.step-card p { color: var(--text-secondary); font-size: 0.88rem; line-height: 1.6; }

/* ─── Features Grid ─── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.feature-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.2s;
}
.feature-card:hover { border-color: rgba(59,130,246,0.3); }
.feature-icon { font-size: 1.6rem; margin-bottom: 12px; }
.feature-card h4 { font-size: 0.95rem; font-weight: 700; margin-bottom: 6px; }
.feature-card p { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.55; }

/* ─── Landing Pricing ─── */
.pricing-grid-landing {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 680px;
  margin: 0 auto;
}
.price-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  position: relative;
  display: flex;
  flex-direction: column;
}
.price-card-pro {
  border-color: var(--accent);
  box-shadow: 0 0 30px rgba(59,130,246,0.1);
}
.pro-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 4px 14px;
  border-radius: 20px;
}
.price-tier {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.price-amount {
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 20px;
}
.price-amount span {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-secondary);
}
.price-features {
  list-style: none;
  padding: 0;
  margin-bottom: 24px;
  flex: 1;
}
.price-features li {
  padding: 5px 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
}
.price-features li::before {
  content: '\2713  ';
  color: var(--green);
  font-weight: bold;
}

/* ─── Auth Section ─── */
.auth-box {
  max-width: 420px;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px;
}
.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.auth-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.auth-tab:hover { color: var(--text-secondary); }
.auth-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.auth-intro {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 20px;
  text-align: center;
}
.auth-msg {
  display: none;
  margin-top: 14px;
  font-size: 0.85rem;
  text-align: center;
}
.auth-msg-success { color: var(--green); }
.auth-msg-error { color: var(--red); }
.auth-forgot {
  display: block;
  text-align: center;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
}
.auth-forgot:hover { color: var(--accent); }

/* ─── Footer ─── */
.landing-footer {
  text-align: center;
  padding: 36px 24px;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .steps-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .pricing-grid-landing { grid-template-columns: 1fr; }
  .cta-group { flex-direction: column; align-items: center; }
  .cta-group .btn-lg { width: 260px; }
  .credibility-bar { gap: 8px; font-size: 0.7rem; }
  .cred-dot { display: none; }
  .credibility-bar span { display: block; }
  .landing-nav-links a:not(.btn) { display: none; }
  .landing-hero { padding: 80px 20px 60px; }
  .section-heading { font-size: 1.6rem; }
  .source-url { max-width: 200px; }
  .free-tier-banner { flex-direction: column; gap: 8px; text-align: center; }
}

@media (max-width: 480px) {
  .auth-box { padding: 24px 20px; }
  .pricing-card { padding: 24px 20px; }
  .price-card { padding: 24px 20px; }
}
