:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #10b981;
  --accent-dark: #059669;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* Nav */
nav { background: var(--card); border-bottom: 1px solid var(--border); padding: 16px 0; position: sticky; top: 0; z-index: 100; }
nav .container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.logo span { color: var(--accent); }
nav .links { display: flex; gap: 24px; align-items: center; }
nav .links a { color: var(--text-light); font-weight: 500; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; border-radius: 8px; font-weight: 600; font-size: .95rem; border: none; cursor: pointer; transition: all .2s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 8px 16px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Hero */
.hero { padding: 80px 0 60px; text-align: center; }
.hero h1 { font-size: 3rem; line-height: 1.15; margin-bottom: 16px; }
.hero h1 em { font-style: normal; color: var(--primary); }
.hero .subtitle { font-size: 1.25rem; color: var(--text-light); max-width: 600px; margin: 0 auto 32px; }
.hero .pain { background: #fef3c7; border-radius: 8px; padding: 16px 24px; display: inline-block; margin-bottom: 32px; color: #92400e; font-weight: 500; }

/* Features */
.features { padding: 60px 0; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.feature-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; }
.feature-card .icon { font-size: 2rem; margin-bottom: 12px; }
.feature-card h3 { margin-bottom: 8px; }
.feature-card p { color: var(--text-light); }

/* How it works */
.how-it-works { padding: 60px 0; background: var(--card); }
.steps { display: flex; gap: 40px; justify-content: center; flex-wrap: wrap; margin-top: 40px; }
.step { text-align: center; max-width: 250px; }
.step .num { width: 48px; height: 48px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.2rem; margin: 0 auto 16px; }
.step h3 { margin-bottom: 8px; }
.step p { color: var(--text-light); font-size: .9rem; }

/* Pricing */
.pricing { padding: 80px 0; }
.pricing h2 { text-align: center; font-size: 2rem; margin-bottom: 40px; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; max-width: 900px; margin: 0 auto; }
.price-card { background: var(--card); border: 2px solid var(--border); border-radius: var(--radius); padding: 32px; text-align: center; position: relative; }
.price-card.popular { border-color: var(--primary); }
.price-card.popular::before { content: 'MOST POPULAR'; position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--primary); color: white; padding: 4px 16px; border-radius: 20px; font-size: .75rem; font-weight: 700; }
.price-card h3 { margin-bottom: 8px; }
.price-card .price { font-size: 2.5rem; font-weight: 700; color: var(--text); }
.price-card .price span { font-size: 1rem; color: var(--text-light); font-weight: 400; }
.price-card .price-desc { color: var(--text-light); margin-bottom: 24px; }
.price-card ul { list-style: none; text-align: left; margin-bottom: 24px; }
.price-card li { padding: 8px 0; color: var(--text-light); }
.price-card li::before { content: '✓ '; color: var(--accent); font-weight: 700; }

/* Section titles */
section h2 { font-size: 2rem; text-align: center; margin-bottom: 16px; }
section .section-sub { text-align: center; color: var(--text-light); margin-bottom: 40px; }

/* Footer */
footer { padding: 40px 0; text-align: center; color: var(--text-light); border-top: 1px solid var(--border); margin-top: 60px; }

/* Login page */
.auth-container { max-width: 420px; margin: 80px auto; padding: 40px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-lg); text-align: center; }
.auth-container h2 { margin-bottom: 8px; }
.auth-container p { color: var(--text-light); margin-bottom: 24px; }
.auth-container input { width: 100%; padding: 14px 16px; border: 2px solid var(--border); border-radius: 8px; font-size: 1rem; margin-bottom: 16px; outline: none; }
.auth-container input:focus { border-color: var(--primary); }
.auth-container .btn { width: 100%; justify-content: center; }
.auth-message { margin-top: 16px; padding: 12px; border-radius: 8px; }
.auth-message.success { background: #d1fae5; color: #065f46; }
.auth-message.error { background: #fee2e2; color: #991b1b; }

/* App layout */
.app-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 24px 0; min-height: calc(100vh - 70px); }
@media (max-width: 768px) { .app-layout { grid-template-columns: 1fr; } }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; overflow-y: auto; }
.panel h3 { margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

textarea { width: 100%; padding: 14px; border: 2px solid var(--border); border-radius: 8px; font-family: inherit; font-size: .9rem; resize: vertical; outline: none; }
textarea:focus { border-color: var(--primary); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; }

/* Score circle */
.score-container { text-align: center; margin: 24px 0; }
.score-circle { width: 120px; height: 120px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 700; position: relative; }
.score-circle::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--score) * 3.6deg), var(--border) 0); }
.score-circle::after { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: white; }
.score-circle span { position: relative; z-index: 1; }
.score-label { color: var(--text-light); margin-top: 8px; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 20px; cursor: pointer; font-weight: 500; color: var(--text-light); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s; font-size: .9rem; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab:hover { color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Results */
.bullet-list { list-style: none; }
.bullet-list li { padding: 12px 16px; background: var(--bg); border-radius: 8px; margin-bottom: 8px; position: relative; padding-left: 32px; }
.bullet-list li::before { content: '→'; position: absolute; left: 12px; color: var(--primary); font-weight: 700; }

.cover-letter { white-space: pre-wrap; line-height: 1.8; color: var(--text); }

.keyword-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.keyword { padding: 6px 14px; border-radius: 20px; font-size: .85rem; font-weight: 500; }
.keyword.present { background: #d1fae5; color: #065f46; }
.keyword.missing { background: #fee2e2; color: #991b1b; }

.copy-btn { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: .8rem; color: var(--text-light); float: right; }
.copy-btn:hover { border-color: var(--primary); color: var(--primary); }

/* History */
.history-select { width: 100%; padding: 10px 12px; border: 2px solid var(--border); border-radius: 8px; font-size: .9rem; margin-bottom: 16px; background: var(--card); }

/* Loading */
.loading { text-align: center; padding: 40px; }
.spinner { width: 40px; height: 40px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-light); }
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }

/* User bar */
.user-bar { display: flex; align-items: center; gap: 12px; font-size: .9rem; }
.user-bar .plan-badge { padding: 4px 10px; border-radius: 12px; font-size: .75rem; font-weight: 600; text-transform: uppercase; }
.plan-badge.free { background: #e2e8f0; color: #475569; }
.plan-badge.job_seeker { background: #dbeafe; color: #1d4ed8; }
.plan-badge.unlimited { background: #d1fae5; color: #059669; }
