@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --navy: #1E293B;
  --navy-light: #334155;
  --navy-dark: #0F172A;
  --amber: #F59E0B;
  --amber-light: #FCD34D;
  --amber-dark: #D97706;
  --white: #FFFFFF;
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --green: #10B981;
  --red: #EF4444;
  --blue: #3B82F6;
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--gray-50);
  color: var(--navy);
  -webkit-tap-highlight-color: transparent;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 28px; border-radius: 12px; font-size: 16px; font-weight: 600;
  border: none; cursor: pointer; transition: all 0.2s; text-decoration: none;
  min-height: 52px; /* Big for dirty hands */
}
.btn-primary { background: var(--amber); color: var(--navy); }
.btn-primary:hover { background: var(--amber-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--navy); color: white; }
.btn-secondary:hover { background: var(--navy-light); }
.btn-outline { background: transparent; border: 2px solid var(--navy); color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: white; }
.btn-danger { background: var(--red); color: white; }
.btn-sm { padding: 8px 16px; font-size: 14px; min-height: 40px; border-radius: 8px; }
.btn-lg { padding: 18px 36px; font-size: 20px; min-height: 60px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== INPUTS ===== */
input, select, textarea {
  width: 100%; padding: 14px 16px; border: 2px solid var(--gray-200);
  border-radius: 10px; font-size: 16px; font-family: inherit;
  transition: border-color 0.2s; background: white;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--amber);
}
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; color: var(--gray-600); }
.form-group { margin-bottom: 20px; }

/* ===== LAYOUT ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.card { background: white; border-radius: 16px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* ===== NAVBAR ===== */
.navbar {
  background: var(--navy); padding: 0 20px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.navbar-brand {
  font-size: 22px; font-weight: 800; color: var(--amber); text-decoration: none;
  display: flex; align-items: center; gap: 8px;
}
.navbar-brand span { color: white; }
.navbar-links { display: flex; gap: 8px; align-items: center; }
.navbar-links a {
  color: var(--gray-300); text-decoration: none; padding: 8px 14px;
  border-radius: 8px; font-weight: 500; font-size: 14px;
}
.navbar-links a:hover, .navbar-links a.active { color: white; background: var(--navy-light); }
.navbar-links .btn { font-size: 14px; min-height: 40px; padding: 8px 20px; }

/* ===== LANDING PAGE ===== */
.hero {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 50%, var(--navy-light) 100%);
  padding: 80px 20px; text-align: center; color: white; min-height: 80vh;
  display: flex; align-items: center;
}
.hero h1 { font-size: clamp(36px, 8vw, 72px); font-weight: 900; line-height: 1.1; margin-bottom: 20px; }
.hero h1 .highlight { color: var(--amber); }
.hero p { font-size: clamp(16px, 3vw, 22px); color: var(--gray-300); max-width: 600px; margin: 0 auto 40px; }

.flow-steps {
  display: flex; gap: 20px; justify-content: center; flex-wrap: wrap;
  margin: 50px auto; max-width: 900px;
}
.flow-step {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px; padding: 30px 24px; flex: 1; min-width: 220px;
  text-align: center;
}
.flow-step .icon { font-size: 48px; margin-bottom: 12px; }
.flow-step .step-num {
  display: inline-block; background: var(--amber); color: var(--navy);
  width: 32px; height: 32px; border-radius: 50%; font-weight: 800;
  line-height: 32px; margin-bottom: 12px; font-size: 14px;
}
.flow-step h3 { font-size: 20px; margin-bottom: 8px; }
.flow-step p { font-size: 14px; color: var(--gray-400); }

.flow-arrow { display: flex; align-items: center; color: var(--amber); font-size: 30px; }
@media (max-width: 768px) { .flow-arrow { display: none; } }

/* Pricing */
.pricing-section { padding: 80px 20px; background: white; }
.pricing-section h2 { text-align: center; font-size: 36px; margin-bottom: 50px; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; max-width: 960px; margin: 0 auto; }
.pricing-card {
  border: 2px solid var(--gray-200); border-radius: 20px; padding: 32px;
  text-align: center; position: relative;
}
.pricing-card.featured { border-color: var(--amber); transform: scale(1.05); }
.pricing-card.featured::before {
  content: 'MOST POPULAR'; position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  background: var(--amber); color: var(--navy); padding: 4px 16px; border-radius: 20px;
  font-weight: 700; font-size: 12px;
}
.pricing-card h3 { font-size: 22px; margin-bottom: 8px; }
.pricing-card .price { font-size: 48px; font-weight: 900; color: var(--navy); margin: 16px 0; }
.pricing-card .price span { font-size: 16px; color: var(--gray-400); font-weight: 400; }
.pricing-card ul { list-style: none; text-align: left; margin: 24px 0; }
.pricing-card li { padding: 8px 0; font-size: 15px; color: var(--gray-600); }
.pricing-card li::before { content: '✓'; color: var(--green); font-weight: 700; margin-right: 10px; }

/* Testimonials */
.testimonials { padding: 60px 20px; background: var(--gray-50); }
.testimonials h2 { text-align: center; font-size: 32px; margin-bottom: 40px; }
.testimonial-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; max-width: 900px; margin: 0 auto; }
.testimonial { background: white; border-radius: 16px; padding: 24px; }
.testimonial .stars { color: var(--amber); font-size: 20px; margin-bottom: 12px; }
.testimonial p { font-size: 15px; color: var(--gray-600); line-height: 1.6; margin-bottom: 16px; }
.testimonial .author { font-weight: 700; font-size: 14px; }
.testimonial .trade { font-size: 13px; color: var(--gray-400); }

/* Footer */
.footer { background: var(--navy-dark); color: var(--gray-400); padding: 40px 20px; text-align: center; font-size: 14px; }

/* ===== DASHBOARD ===== */
.page-header { padding: 24px 0; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.page-header h1 { font-size: 28px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: white; border-radius: 14px; padding: 20px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.stat-card .stat-value { font-size: 32px; font-weight: 800; color: var(--navy); }
.stat-card .stat-label { font-size: 13px; color: var(--gray-400); margin-top: 4px; }
.stat-card.amber .stat-value { color: var(--amber-dark); }
.stat-card.green .stat-value { color: var(--green); }

.proposal-list { display: flex; flex-direction: column; gap: 12px; }
.proposal-item {
  background: white; border-radius: 14px; padding: 16px 20px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06); cursor: pointer;
  transition: transform 0.15s; flex-wrap: wrap; gap: 12px;
}
.proposal-item:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.proposal-item .proposal-info { flex: 1; min-width: 200px; }
.proposal-item .proposal-title { font-weight: 700; font-size: 16px; }
.proposal-item .proposal-client { font-size: 14px; color: var(--gray-500); margin-top: 2px; }
.proposal-item .proposal-meta { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.proposal-item .proposal-amount { font-weight: 700; font-size: 18px; }

.status-badge {
  padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; text-transform: uppercase;
}
.status-draft { background: var(--gray-200); color: var(--gray-600); }
.status-sent { background: #DBEAFE; color: var(--blue); }
.status-viewed { background: #FEF3C7; color: var(--amber-dark); }
.status-accepted { background: #D1FAE5; color: #059669; }
.status-expired { background: #FEE2E2; color: var(--red); }

/* ===== VOICE RECORDER ===== */
.voice-section { text-align: center; padding: 40px 0; }
.record-btn {
  width: 120px; height: 120px; border-radius: 50%; border: none;
  background: var(--amber); color: var(--navy); font-size: 48px;
  cursor: pointer; transition: all 0.3s; display: inline-flex;
  align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
}
.record-btn:hover { transform: scale(1.05); }
.record-btn.recording {
  background: var(--red); color: white;
  animation: pulse 1.5s infinite;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5);
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  50% { box-shadow: 0 0 0 20px rgba(239, 68, 68, 0); }
}
.voice-hint { margin-top: 16px; color: var(--gray-400); font-size: 14px; }
.transcript-box {
  background: var(--gray-100); border-radius: 12px; padding: 20px;
  margin-top: 20px; min-height: 100px; text-align: left;
  font-size: 16px; line-height: 1.6; white-space: pre-wrap;
}
.transcript-box.active { border: 2px solid var(--amber); background: white; }

/* ===== PROPOSAL EDITOR ===== */
.editor-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 900px) { .editor-grid { grid-template-columns: 1fr 360px; } }

.line-items-table { width: 100%; border-collapse: collapse; }
.line-items-table th {
  text-align: left; padding: 10px 12px; background: var(--navy);
  color: white; font-size: 13px; font-weight: 600;
}
.line-items-table th:first-child { border-radius: 10px 0 0 0; }
.line-items-table th:last-child { border-radius: 0 10px 0 0; }
.line-items-table td { padding: 8px 12px; border-bottom: 1px solid var(--gray-100); }
.line-items-table input {
  border: 1px solid transparent; padding: 8px; border-radius: 6px; font-size: 14px;
}
.line-items-table input:focus { border-color: var(--amber); }
.line-items-table .amount-input { width: 100px; text-align: right; }
.line-items-table .drag-handle { cursor: grab; color: var(--gray-300); font-size: 18px; }
.line-items-table .delete-btn { background: none; border: none; color: var(--gray-300); cursor: pointer; font-size: 18px; padding: 4px; }
.line-items-table .delete-btn:hover { color: var(--red); }

.totals-box { background: var(--gray-50); border-radius: 12px; padding: 20px; }
.totals-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 15px; }
.totals-row.total { font-size: 20px; font-weight: 800; border-top: 2px solid var(--navy); padding-top: 12px; margin-top: 8px; }

/* ===== PROPOSAL PUBLIC VIEW ===== */
.proposal-public { max-width: 800px; margin: 0 auto; padding: 20px; }
.proposal-header {
  background: var(--navy); color: white; border-radius: 20px 20px 0 0;
  padding: 30px; display: flex; justify-content: space-between; align-items: center;
}
.proposal-body { background: white; padding: 30px; border-radius: 0 0 20px 20px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }

/* Signature pad */
.signature-pad-container { border: 2px dashed var(--gray-300); border-radius: 12px; margin: 20px 0; }
.signature-pad-container canvas { width: 100%; height: 150px; display: block; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; margin-bottom: 24px; overflow-x: auto; }
.tab {
  padding: 10px 20px; border-radius: 10px; font-weight: 600; font-size: 14px;
  cursor: pointer; background: var(--gray-100); color: var(--gray-500);
  border: none; white-space: nowrap;
}
.tab.active { background: var(--navy); color: white; }

/* ===== LOADING ===== */
.loading-spinner {
  display: inline-block; width: 24px; height: 24px;
  border: 3px solid var(--gray-200); border-top-color: var(--amber);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; flex-direction: column; gap: 16px; color: white;
}
.loading-overlay .loading-spinner { width: 48px; height: 48px; border-width: 4px; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px; padding: 14px 24px;
  border-radius: 12px; color: white; font-weight: 600; font-size: 14px;
  z-index: 2000; transform: translateY(100px); opacity: 0;
  transition: all 0.3s;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 20px;
}
.modal { background: white; border-radius: 20px; padding: 32px; max-width: 500px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal h2 { margin-bottom: 20px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .navbar-links a:not(.btn) { display: none; }
  .hero { padding: 60px 20px; min-height: auto; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== HIDDEN ===== */
.hidden { display: none !important; }

/* ===== AUTH PAGES ===== */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
  padding: 20px;
}
.auth-card {
  background: white; border-radius: 24px; padding: 40px; width: 100%;
  max-width: 420px; text-align: center;
}
.auth-card h1 { font-size: 28px; margin-bottom: 8px; }
.auth-card .subtitle { color: var(--gray-400); margin-bottom: 32px; }
.auth-divider {
  display: flex; align-items: center; gap: 12px; margin: 24px 0;
  color: var(--gray-400); font-size: 13px;
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--gray-200); }
.google-btn {
  width: 100%; padding: 14px; border: 2px solid var(--gray-200); border-radius: 12px;
  background: white; font-size: 16px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.google-btn:hover { background: var(--gray-50); border-color: var(--gray-300); }
