/* --- Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f7; color: #1d1d1f; line-height: 1.5; }
a { color: #e8600a; text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Navbar --- */
.navbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; background: #fff; border-bottom: 1px solid #e0e0e0; position: sticky; top: 0; z-index: 100; }
.nav-left { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-user { color: #666; font-size: 0.9rem; }
.logo-icon { font-size: 1.3rem; }

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

/* --- Buttons --- */
.btn { display: inline-block; padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer; font-size: 0.9rem; font-weight: 500; transition: all 0.15s; }
.btn-primary { background: #e8600a; color: #fff; }
.btn-primary:hover { background: #d05508; }
.btn-danger { background: #fff; color: #d32f2f; border: 1px solid #d32f2f; }
.btn-danger:hover { background: #d32f2f; color: #fff; }
.btn-outline { background: transparent; border: 1px solid #ccc; color: #666; }
.btn-outline:hover { border-color: #999; color: #333; }
.btn-sm { padding: 4px 12px; font-size: 0.8rem; }
.btn-full { width: 100%; }
.btn-row { display: flex; gap: 12px; margin-top: 16px; }

/* --- Login --- */
.login-body { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); }
.login-card { background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 1.8rem; margin-top: 8px; }
.subtitle { color: #888; font-size: 0.9rem; margin-top: 4px; }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 4px; font-size: 0.9rem; color: #444; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 0.95rem; transition: border-color 0.15s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #e8600a; box-shadow: 0 0 0 3px rgba(232, 96, 10, 0.1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.9rem; }
.checkbox-label input[type="checkbox"] { width: auto; }

/* --- Alerts --- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.9rem; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* --- Dashboard --- */
.header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.header-row h1 { font-size: 1.5rem; }
.count { color: #888; font-weight: 400; }
.filter-form { display: flex; align-items: center; gap: 12px; }
.filter-form select { padding: 6px 12px; border-radius: 8px; border: 1px solid #ddd; font-size: 0.85rem; }
.empty-state { text-align: center; padding: 60px 20px; color: #888; font-size: 1.1rem; }

/* --- Table --- */
.table-wrap { overflow-x: auto; background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
table { width: 100%; border-collapse: collapse; }
thead th { background: #fafafa; padding: 12px 16px; text-align: left; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; color: #666; border-bottom: 2px solid #eee; white-space: nowrap; }
thead th a { color: #666; }
thead th a:hover { color: #e8600a; text-decoration: none; }
tbody td { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; }
tbody tr:hover { background: #fafafa; }
tbody tr:last-child td { border-bottom: none; }
.row-followup { background: #fffbeb; }
.row-followup:hover { background: #fef3c7; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.summary-cell { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #666; font-size: 0.85rem; }

/* --- Badges --- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.badge-hot { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.badge-warm { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.badge-browsing { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.badge-closed { background: #f5f5f5; color: #666; border: 1px solid #ddd; }

/* --- Lead Detail --- */
.back-link { display: inline-block; margin-bottom: 16px; font-size: 0.9rem; }
.lead-header { margin-bottom: 24px; }
.lead-header h1 { font-size: 1.6rem; margin-bottom: 8px; }
.lead-meta { display: flex; flex-wrap: wrap; gap: 16px; color: #666; font-size: 0.9rem; align-items: center; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 20px; }
.card h2 { font-size: 1.1rem; margin-bottom: 16px; color: #333; }
.summary-text { color: #555; line-height: 1.7; }
.muted { color: #999; font-style: italic; }

/* --- Transcript --- */
.transcript { max-height: 500px; overflow-y: auto; }
.transcript-msg { padding: 8px 0; border-bottom: 1px solid #f5f5f5; font-size: 0.85rem; }
.transcript-msg:last-child { border-bottom: none; }
.transcript-assistant strong { color: #e8600a; }
.transcript-user strong { color: #2563eb; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .container { padding: 16px; }
  .two-col { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .header-row { flex-direction: column; align-items: flex-start; }
  .filter-form { flex-wrap: wrap; }
  .lead-meta { flex-direction: column; gap: 4px; }
}
