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

:root {
  --bg: #0a0a0f;
  --bg-card: #111118;
  --bg-card-hover: #161622;
  --border: #1e1e2e;
  --border-light: #2a2a3e;
  --text: #e8e8f0;
  --text-muted: #888899;
  --text-dim: #555566;
  --primary: #6366f1;
  --primary-hover: #4f52e0;
  --primary-glow: rgba(99,102,241,0.15);
  --green: #22c55e;
  --green-bg: rgba(34,197,94,0.1);
  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.1);
  --yellow: #f59e0b;
  --yellow-bg: rgba(245,158,11,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

html { scroll-behavior: smooth; }

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

a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(99,102,241,0.35); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-light);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* ---- NAV ---- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: rgba(10,10,15,0.85);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { font-size: 20px; font-weight: 800; color: var(--text); }
.logo-dot { color: var(--primary); }
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-links a:not(.btn) { color: var(--text-muted); font-size: 14px; font-weight: 500; }
.nav-links a:not(.btn):hover { color: var(--text); }

/* ---- LAYOUT ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; }

/* ---- HERO ---- */
.hero {
  padding: 140px 24px 80px;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}
.hero-badge {
  display: inline-block;
  padding: 6px 14px;
  background: var(--primary-glow);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  color: #a5b4fc;
  margin-bottom: 28px;
}
.hero-title {
  font-size: clamp(38px, 6vw, 62px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
.gradient-text {
  background: linear-gradient(135deg, #6366f1, #a78bfa, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 32px;
  line-height: 1.7;
}
.hero-cta { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.hero-cta-note { font-size: 13px; color: var(--text-dim); }

/* ---- DEMO CARD ---- */
.hero-demo { margin-top: 60px; text-align: left; }
.demo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  max-width: 680px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}
.demo-header { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.demo-badge {
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}
.badge-green { background: var(--green-bg); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid rgba(245,158,11,0.2); }
.badge-red { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }

.demo-flags { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.demo-section { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.demo-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.demo-label.red { color: var(--red); }
.demo-label.green { color: var(--green); }
.demo-section ul li { font-size: 13px; color: var(--text-muted); padding: 3px 0; }
.demo-section ul li::before { content: '• '; color: var(--text-dim); }

.demo-proposal-preview { position: relative; overflow: hidden; }
.demo-proposal-preview .demo-label { color: var(--primary); }
.demo-proposal-text { font-size: 14px; color: var(--text-muted); line-height: 1.7; }
.demo-fade {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 40px;
  background: linear-gradient(transparent, var(--bg-card));
}

/* ---- STATS ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  background: var(--bg-card);
}
.stat { text-align: center; }
.stat-num { font-size: 36px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ---- HOW IT WORKS ---- */
.how-it-works { text-align: center; }
.section-title { font-size: clamp(28px, 4vw, 40px); font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; margin-bottom: 48px; }
.section-sub { color: var(--text-muted); font-size: 16px; margin-top: -32px; margin-bottom: 48px; }
.steps { display: flex; align-items: flex-start; gap: 24px; justify-content: center; flex-wrap: wrap; }
.step { max-width: 240px; text-align: left; }
.step-num { font-size: 48px; font-weight: 800; color: var(--border-light); line-height: 1; margin-bottom: 12px; }
.step h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.step p { font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.step-arrow { font-size: 24px; color: var(--text-dim); margin-top: 16px; }

/* ---- FEATURES ---- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.2s, background 0.2s;
}
.feature-card:hover { border-color: var(--primary); background: var(--bg-card-hover); }
.feature-icon { font-size: 28px; margin-bottom: 12px; }
.feature-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--text-muted); line-height: 1.6; }

/* ---- TESTIMONIALS ---- */
.testimonials-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.testimonial {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.testimonial-text { font-size: 15px; color: var(--text-muted); line-height: 1.7; margin-bottom: 20px; font-style: italic; }
.testimonial-author { display: flex; align-items: center; gap: 12px; }
.testimonial-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary-glow);
  border: 1px solid rgba(99,102,241,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #a5b4fc;
  flex-shrink: 0;
}
.testimonial-name { font-size: 14px; font-weight: 600; }
.testimonial-role { font-size: 12px; color: var(--text-dim); }

/* ---- PRICING ---- */
.pricing-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; max-width: 900px; margin: 0 auto; }
.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  position: relative;
}
.pricing-card-featured { border-color: var(--primary); background: linear-gradient(160deg, rgba(99,102,241,0.08), var(--bg-card)); }
.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 100px;
  white-space: nowrap;
}
.pricing-plan { font-size: 14px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.pricing-price { font-size: 42px; font-weight: 800; margin-bottom: 20px; }
.pricing-price span { font-size: 16px; color: var(--text-muted); font-weight: 500; }
.pricing-features { margin-bottom: 24px; }
.pricing-features li { font-size: 14px; color: var(--text-muted); padding: 6px 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.pricing-features li::before { content: '✓'; color: var(--green); font-weight: 700; }

/* ---- FINAL CTA ---- */
.final-cta {
  text-align: center;
  background: radial-gradient(ellipse at center, rgba(99,102,241,0.08) 0%, transparent 70%);
}
.final-cta h2 { font-size: 36px; font-weight: 800; margin-bottom: 12px; }
.final-cta p { color: var(--text-muted); margin-bottom: 28px; }

/* ---- FOOTER ---- */
.footer { border-top: 1px solid var(--border); padding: 32px 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { font-size: 13px; color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }
.footer-copy { font-size: 13px; color: var(--text-dim); }

/* ============================================================
   APP STYLES
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
}
.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; }
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sidebar-nav-item:hover { background: var(--bg); color: var(--text); }
.sidebar-nav-item.active { background: var(--primary-glow); color: var(--primary); }
.sidebar-nav-item .nav-icon { font-size: 16px; width: 20px; }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.plan-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.plan-chip.free { background: var(--border); color: var(--text-muted); }
.plan-chip.solo { background: var(--primary-glow); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.3); }
.plan-chip.agency { background: rgba(245,158,11,0.1); color: var(--yellow); border: 1px solid rgba(245,158,11,0.2); }

/* ---- MAIN CONTENT ---- */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 32px;
  max-width: calc(100vw - 240px);
}

/* ---- VIEWS ---- */
.view { display: none; }
.view.active { display: block; }

.page-title { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.page-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }

/* ---- ANALYZE FORM ---- */
.analyze-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 24px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.form-group textarea,
.form-group input,
.form-group select {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  transition: border-color 0.15s;
  outline: none;
  width: 100%;
}
.form-group textarea:focus,
.form-group input:focus,
.form-group select:focus { border-color: var(--primary); }
.form-group textarea { resize: vertical; min-height: 160px; }

.free-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--yellow-bg);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--yellow);
  margin-bottom: 16px;
}

/* ---- RESULT CARD ---- */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 24px;
}
.result-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.result-title { font-size: 18px; font-weight: 700; }
.result-badges { display: flex; flex-wrap: wrap; gap: 8px; }

.win-score-ring {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  flex-shrink: 0;
  font-weight: 800;
  font-size: 20px;
  border: 3px solid;
}
.win-score-ring.high { border-color: var(--green); color: var(--green); background: var(--green-bg); }
.win-score-ring.medium { border-color: var(--yellow); color: var(--yellow); background: var(--yellow-bg); }
.win-score-ring.low { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.win-score-label { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

.result-body { padding: 24px; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.result-section { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; }
.result-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 10px; }
.flag-list li { font-size: 13px; color: var(--text-muted); padding: 4px 0; display: flex; gap: 8px; }
.flag-list.red li::before { content: '⚠'; }
.flag-list.green li::before { content: '✓'; color: var(--green); }
.requirements-list li { font-size: 13px; color: var(--text); padding: 4px 8px; background: var(--border); border-radius: 4px; margin-bottom: 4px; display: inline-block; margin-right: 4px; }

.analysis-summary {
  padding: 16px;
  background: var(--primary-glow);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 24px;
  color: #c7d2fe;
}

.proposal-section { margin-top: 24px; }
.proposal-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.proposal-section-header h3 { font-size: 16px; font-weight: 700; }
.proposal-actions { display: flex; gap: 8px; }
.proposal-box {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 20px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-muted);
  white-space: pre-wrap;
  min-height: 200px;
}
.proposal-subject {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.proposal-subject strong { color: var(--text-muted); }

.rewrite-area { margin-top: 16px; display: none; }
.rewrite-area.open { display: block; }

/* ---- HISTORY ---- */
.history-list { display: flex; flex-direction: column; gap: 12px; }
.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.history-item:hover { border-color: var(--primary); }
.history-win { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; flex-shrink: 0; }
.history-info { flex: 1; }
.history-title { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.history-meta { font-size: 12px; color: var(--text-dim); display: flex; gap: 12px; }
.history-badges { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.outcome-badge { padding: 3px 8px; border-radius: 100px; font-size: 11px; font-weight: 600; }
.outcome-badge.won { background: var(--green-bg); color: var(--green); }
.outcome-badge.lost { background: var(--red-bg); color: var(--red); }
.outcome-badge.no_response { background: var(--border); color: var(--text-dim); }

/* ---- PROFILE ---- */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}
.profile-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }

/* ---- PRICING PAGE ---- */
.pricing-page { max-width: 960px; margin: 0 auto; padding: 100px 24px 60px; text-align: center; }
.pricing-page h1 { font-size: 40px; font-weight: 800; margin-bottom: 12px; }
.pricing-page .sub { color: var(--text-muted); font-size: 16px; margin-bottom: 48px; }

/* ---- AUTH MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.modal h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.modal p { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.modal-toggle { font-size: 13px; color: var(--text-muted); text-align: center; margin-top: 16px; }
.modal-toggle a { color: var(--primary); cursor: pointer; }
.form-error { font-size: 13px; color: var(--red); margin-top: 8px; display: none; }
.form-error.show { display: block; }

/* ---- UPGRADE BANNER ---- */
.upgrade-banner {
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(236,72,153,0.08));
  border: 1px solid rgba(99,102,241,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 p { font-size: 14px; color: var(--text); }
.upgrade-banner p span { color: var(--text-muted); font-size: 13px; display: block; margin-top: 2px; }

/* ---- LOADING ---- */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---- TOAST ---- */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideUp 0.2s ease;
  max-width: 320px;
}
.toast.success { background: var(--green-bg); border: 1px solid rgba(34,197,94,0.3); color: var(--green); }
.toast.error { background: var(--red-bg); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }
.toast.info { background: var(--primary-glow); border: 1px solid rgba(99,102,241,0.3); color: #a5b4fc; }
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: 1fr; }
  .testimonials-grid { grid-template-columns: 1fr; }
  .pricing-cards { grid-template-columns: 1fr; }
  .demo-flags { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; max-width: 100vw; }
  .form-row { grid-template-columns: 1fr; }
  .steps { flex-direction: column; align-items: center; }
  .step-arrow { transform: rotate(90deg); }
}
