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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: #333;
  line-height: 1.6;
  background: #fff;
}

a {
  color: #4361ee;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

/* ===== Header ===== */
.site-header {
  background: #1a1a2e;
  color: #fff;
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
  color: #fff;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.site-header nav a {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  transition: color 0.15s;
  text-decoration: none;
}

.site-header nav a:hover {
  color: #fff;
}

.site-header nav a.nav-cta {
  background: #4361ee;
  color: #fff;
  padding: 6px 16px;
  border-radius: 6px;
  font-weight: 500;
}

.site-header nav a.nav-cta:hover {
  background: #3a56d4;
}

/* ===== Messages ===== */
.messages-container {
  padding: 12px 24px;
}

.message {
  padding: 10px 16px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 14px;
}

.message-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.message-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.message-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.message-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ===== Buttons ===== */
.btn-primary {
  display: inline-block;
  background: #4361ee;
  color: #fff;
  padding: 12px 28px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary:hover {
  background: #3a56d4;
  text-decoration: none;
  color: #fff;
}

.btn-primary.btn-full {
  display: block;
  width: 100%;
  text-align: center;
}

.btn-secondary {
  display: inline-block;
  background: #fff;
  color: #333;
  border: 1px solid #ccc;
  padding: 11px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-secondary:hover {
  border-color: #4361ee;
  color: #4361ee;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
  color: #fff;
  padding: 96px 0 80px;
  text-align: center;
}

.hero h1 {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 20px;
  letter-spacing: -0.5px;
}

.hero-sub {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.8);
  max-width: 600px;
  margin: 0 auto 40px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero .btn-secondary {
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.3);
}

.hero .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.6);
  color: #fff;
}

/* ===== Features ===== */
.features {
  padding: 80px 0;
  background: #f8f9ff;
}

.features h2 {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 48px;
  color: #1a1a2e;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.feature-card {
  background: #fff;
  border: 1px solid #e8e8f0;
  border-radius: 12px;
  padding: 28px 24px;
}

.feature-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 17px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
}

/* ===== CTA section ===== */
.cta-section {
  padding: 80px 0;
  text-align: center;
  background: #fff;
}

.cta-section h2 {
  font-size: 32px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 12px;
}

.cta-section p {
  font-size: 16px;
  color: #555;
  margin-bottom: 28px;
}

/* ===== Auth pages ===== */
.auth-page {
  padding: 60px 0;
}

.auth-card {
  max-width: 440px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 36px 40px;
}

.auth-card h1 {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #555;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
  outline: none;
}

.form-group input:focus {
  border-color: #4361ee;
}

.field-error {
  color: #e74c3c;
  font-size: 12px;
  margin-top: 4px;
}

.auth-links {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.auth-legal {
  margin-top: 16px;
  font-size: 12px;
  color: #888;
  text-align: center;
}

/* ===== Dashboard ===== */
.dashboard {
  padding: 40px 0;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.dashboard-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a2e;
}

.dashboard-credits {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.credit-card {
  background: #f8f9ff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 16px 24px;
  min-width: 160px;
}

.credit-label {
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
}

.credit-value {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a2e;
}

.dashboard-docs h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #1a1a2e;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.docs-table th {
  text-align: left;
  padding: 10px 12px;
  background: #f8f9ff;
  border-bottom: 2px solid #e0e0e0;
  font-weight: 600;
  color: #555;
}

.docs-table td {
  padding: 12px 12px;
  border-bottom: 1px solid #f0f0f0;
}

.doc-filename {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.status-uploaded { background: #e8f4f8; color: #0c5460; }
.status-signing { background: #fff3cd; color: #856404; }
.status-signed { background: #d4edda; color: #155724; }
.status-downloaded { background: #e2e3e5; color: #383d41; }
.status-expired { background: #f8d7da; color: #721c24; }
.status-pending_signature { background: #cfe2ff; color: #084298; }
.status-draft { background: #e2e3e5; color: #383d41; }
.status-pending { background: #fff3cd; color: #856404; }
.status-viewed { background: #cfe2ff; color: #084298; }
.status-cancelled { background: #f8d7da; color: #721c24; }

.link-cancel-btn {
  background: none;
  border: none;
  color: #e74c3c;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  text-decoration: underline;
}

.docs-empty {
  text-align: center;
  padding: 60px 0;
  color: #888;
}

/* ===== Upload page ===== */
.upload-page {
  padding: 60px 0;
}

.upload-page h1 {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 8px;
}

.upload-sub {
  color: #888;
  font-size: 14px;
  margin-bottom: 32px;
}

.upload-drop-zone {
  border: 2px dashed #bbb;
  border-radius: 12px;
  padding: 60px 40px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 24px;
}

.upload-drop-zone.drag-over {
  border-color: #4361ee;
  background: rgba(67, 97, 238, 0.04);
}

.drop-zone-icon { font-size: 48px; margin-bottom: 12px; }
.drop-zone-text { font-size: 18px; color: #555; margin-bottom: 4px; }
.drop-zone-subtext { font-size: 14px; color: #999; margin-bottom: 16px; }

.hidden-file-input {
  display: none;
}

.selected-file {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 15px;
  color: #333;
}

.upload-actions {
  text-align: right;
}

/* ===== Pricing page ===== */
.pricing-page {
  padding: 60px 0;
}

.pricing-header {
  text-align: center;
  margin-bottom: 48px;
}

.pricing-header h1 {
  font-size: 36px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 12px;
}

.pricing-header p {
  font-size: 16px;
  color: #666;
}

.pricing-free {
  display: flex;
  justify-content: center;
  margin-bottom: 56px;
}

.pricing-card {
  border: 2px solid #e0e0e0;
  border-radius: 16px;
  padding: 36px 40px;
  text-align: center;
  max-width: 320px;
  width: 100%;
}

.free-card {
  border-color: #4361ee;
}

.plan-name {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #4361ee;
  margin-bottom: 8px;
}

.plan-price {
  font-size: 48px;
  font-weight: 800;
  color: #1a1a2e;
  margin-bottom: 24px;
}

.plan-features {
  list-style: none;
  margin-bottom: 28px;
  text-align: left;
}

.plan-features li {
  padding: 8px 0;
  font-size: 14px;
  color: #555;
  border-bottom: 1px solid #f0f0f0;
}

.plan-features li::before {
  content: '✓ ';
  color: #2ecc71;
  font-weight: 700;
}

.pricing-packs {
  margin-bottom: 56px;
}

.pricing-packs h2 {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a2e;
  text-align: center;
  margin-bottom: 8px;
}

.packs-sub {
  text-align: center;
  color: #888;
  margin-bottom: 32px;
}

.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.pack-card {
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 28px 24px;
  text-align: center;
}

.pack-name {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.pack-credits {
  font-size: 24px;
  font-weight: 700;
  color: #4361ee;
  margin-bottom: 4px;
}

.pack-price {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.pack-per {
  font-size: 12px;
  color: #999;
  margin-bottom: 20px;
}

.pricing-faq {
  max-width: 720px;
  margin: 0 auto;
}

.pricing-faq h2 {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 24px;
}

.faq-item {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #f0f0f0;
}

.faq-item h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 8px;
}

.faq-item p {
  font-size: 14px;
  color: #666;
  line-height: 1.7;
}

/* ===== Billing page ===== */
.billing-page {
  padding: 60px 0;
}

.billing-page h1 {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 8px;
}

.billing-sub {
  font-size: 14px;
  color: #888;
  margin-bottom: 24px;
}

.current-balance {
  background: #f8f9ff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 14px 20px;
  margin-bottom: 32px;
  font-size: 14px;
  color: #555;
}

.billing-note {
  margin-top: 32px;
  font-size: 13px;
  color: #999;
  text-align: center;
}

/* ===== Done / success pages ===== */
.done-page {
  padding: 80px 0;
}

.done-card {
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}

.done-icon {
  font-size: 64px;
  color: #2ecc71;
  margin-bottom: 16px;
  display: block;
}

.done-card h1 {
  font-size: 32px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 12px;
}

.done-card p {
  font-size: 16px;
  color: #555;
  margin-bottom: 28px;
}

.done-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.done-dashboard-link {
  font-size: 13px;
  color: #888;
}

/* ===== Legal pages ===== */
.legal-page {
  padding: 60px 0;
}

.legal-page .container {
  max-width: 720px;
}

.legal-page h1 {
  font-size: 32px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 8px;
}

.legal-updated {
  font-size: 13px;
  color: #999;
  margin-bottom: 32px;
}

.legal-page h2 {
  font-size: 18px;
  font-weight: 600;
  color: #1a1a2e;
  margin: 28px 0 8px;
}

.legal-page p {
  font-size: 14px;
  color: #555;
  line-height: 1.7;
  margin-bottom: 8px;
}

/* ===== Footer ===== */
.site-footer {
  background: #1a1a2e;
  color: rgba(255, 255, 255, 0.6);
  padding: 24px 0;
  text-align: center;
  font-size: 14px;
  margin-top: auto;
}

.site-footer a {
  color: rgba(255, 255, 255, 0.8);
}

.site-footer strong {
  color: #fff;
}

/* ===== Prose pages (About, How It Works) ===== */
.prose-page {
  padding: 56px 0 80px;
}
.prose-hero {
  margin-bottom: 48px;
  max-width: 720px;
}
.prose-hero h1 {
  font-size: 40px;
  font-weight: 800;
  color: #1a1a2e;
  margin-bottom: 16px;
  line-height: 1.2;
}
.prose-lead {
  font-size: 18px;
  color: #555;
  line-height: 1.65;
}
.prose-section {
  margin-bottom: 48px;
  max-width: 760px;
}
.prose-section h2 {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e5e7eb;
}
.prose-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a2e;
  margin: 20px 0 6px;
}
.prose-section p {
  color: #444;
  line-height: 1.7;
  margin-bottom: 12px;
  font-size: .975rem;
}
.prose-section ul, .prose-section ol {
  margin: 8px 0 12px 1.4rem;
  color: #444;
  line-height: 1.7;
  font-size: .975rem;
}
.prose-section li { margin-bottom: 6px; }
.prose-section code {
  font-family: monospace;
  font-size: .875rem;
  background: #f1f5f9;
  padding: .1rem .35rem;
  border-radius: 3px;
}
.prose-section em { color: #666; }
.prose-cta {
  text-align: center;
  padding: 48px 24px;
  background: #f8fafc;
  border-radius: 12px;
}
.prose-cta h2 { font-size: 28px; font-weight: 700; color: #1a1a2e; margin-bottom: 8px; }
.prose-cta p  { color: #555; margin-bottom: 20px; }
.prose-cta-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 16px;
}
.about-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
}
.about-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 8px; color: #1a1a2e; }
.about-card p  { font-size: .9rem; color: #555; line-height: 1.6; margin: 0; }

@media (max-width: 600px) {
  .prose-hero h1 { font-size: 28px; }
  .prose-lead { font-size: 16px; }
  .about-grid { grid-template-columns: 1fr; }
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .hero h1 { font-size: 32px; }
  .hero-sub { font-size: 16px; }
  .hero-actions { flex-direction: column; align-items: center; }
  .features { padding: 56px 0; }
  .auth-card { padding: 28px 20px; }
  .dashboard-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}
