/* ============================================================
   LEAD MACHINE DASHBOARD
   Color system: desaturated warm earth tones for ADHD-friendly UI
   Based on: ColorArchive dark-mode guide, UX Planet 60-30-10
   ============================================================ */

:root {
  /* Base (60%) */
  --bg-base: #1a1814;
  --bg-surface: #252219;
  --bg-elevated: #3a3530;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);

  /* Text */
  --text-primary: #f5f0eb;
  --text-secondary: rgba(245, 240, 235, 0.6);
  --text-muted: rgba(245, 240, 235, 0.35);

  /* Accent (10%) */
  --accent-mustard: #C49A2A;
  --accent-mustard-bg: rgba(196, 154, 42, 0.06);
  --accent-mustard-border: rgba(196, 154, 42, 0.15);
  --accent-olive: #7A8B5A;
  --accent-olive-bg: rgba(122, 139, 90, 0.1);
  --accent-orange: #B86B3A;
  --accent-orange-bg: rgba(184, 107, 58, 0.12);
  --accent-orange-border: rgba(184, 107, 58, 0.3);
  --accent-sand: #c4a97d;

  /* Functional */
  --status-new: #C49A2A;
  --status-responded: #7A8B5A;
  --status-replied: #B86B3A;
  --status-booked: #7A8B5A;
  --status-lost: rgba(245, 240, 235, 0.25);
  --status-paused: rgba(245, 240, 235, 0.35);

  /* Layout */
  --max-width: 960px;
  --radius: 8px;
  --radius-sm: 4px;
}

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

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.dashboard {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.topbar__brand {
  font-size: 14px;
  color: var(--accent-sand);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  text-decoration: none;
}

.topbar__stats {
  display: flex;
  gap: 16px;
  align-items: center;
}

.topbar__badge {
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
}

.topbar__badge--urgent {
  background: var(--accent-orange-bg);
  color: var(--accent-orange);
  border: 1px solid var(--accent-orange-border);
}

.topbar__badge--auto {
  color: var(--text-muted);
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover {
  color: var(--text-secondary);
}

.tab--active {
  color: var(--accent-mustard);
  border-bottom-color: var(--accent-mustard);
}

.card {
  background: var(--bg-surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card--bordered {
  border-left: 3px solid var(--accent-sand);
}

.card--draft {
  background: var(--accent-mustard-bg);
  border: 1px solid var(--accent-mustard-border);
}

.priority {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.priority__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-orange);
  animation: pulse 2s infinite;
}

.priority__text {
  font-size: 12px;
  color: var(--accent-orange);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s;
  text-decoration: none;
}

.btn:hover {
  opacity: 0.85;
}

.btn--primary {
  background: var(--accent-mustard);
  color: var(--bg-base);
  font-weight: 600;
}

.btn--secondary {
  background: var(--bg-surface);
  color: var(--accent-sand);
  border: 1px solid var(--border-strong);
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn--sm {
  padding: 6px 14px;
  font-size: 12px;
}

.btn--booked {
  background: var(--accent-olive-bg);
  color: var(--accent-olive);
  border: 1px solid rgba(122, 139, 90, 0.3);
}

.btn--lost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.actions {
  display: flex;
  gap: 12px;
  margin: 24px 0;
}

.actions .btn {
  flex: 1;
}

.actions .btn--ghost {
  flex: 0;
}

.progress {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.progress__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.progress__label {
  font-size: 13px;
  color: var(--text-muted);
}

.progress__count {
  font-size: 13px;
  color: var(--accent-olive);
  font-weight: 500;
}

.progress__bar {
  background: var(--border);
  border-radius: var(--radius-sm);
  height: 5px;
  overflow: hidden;
}

.progress__fill {
  background: linear-gradient(90deg, var(--accent-olive), #8a9a65);
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.4s ease;
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge--new {
  background: rgba(196, 154, 42, 0.12);
  color: var(--status-new);
  border: 1px solid rgba(196, 154, 42, 0.25);
}

.badge--responded {
  background: var(--accent-olive-bg);
  color: var(--status-responded);
}

.badge--replied {
  background: var(--accent-orange-bg);
  color: var(--status-replied);
  border: 1px solid var(--accent-orange-border);
}

.badge--booked {
  background: var(--accent-olive-bg);
  color: var(--status-booked);
}

.badge--lost {
  color: var(--status-lost);
  background: rgba(255, 255, 255, 0.03);
}

.badge--paused {
  color: var(--status-paused);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
}

.leads-table th {
  text-align: left;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.leads-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.leads-table tr:hover {
  background: var(--bg-surface);
}

.leads-table a {
  color: var(--text-primary);
  text-decoration: none;
}

.leads-table a:hover {
  color: var(--accent-mustard);
}

.lead-row__name {
  font-weight: 500;
}

.lead-row__meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border-strong);
}

.timeline__item {
  position: relative;
  padding-bottom: 24px;
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__dot {
  position: absolute;
  left: -20px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--accent-sand);
}

.timeline__dot--email {
  border-color: var(--accent-mustard);
}

.timeline__dot--whatsapp {
  border-color: var(--accent-olive);
}

.timeline__dot--sms {
  border-color: var(--accent-orange);
}

.timeline__dot--form {
  border-color: var(--accent-sand);
}

.timeline__time {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.timeline__content {
  font-size: 14px;
  color: var(--text-secondary);
}

.timeline__channel {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-left: 8px;
}

.lead-header {
  margin-bottom: 32px;
}

.lead-header__name {
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.lead-header__meta {
  font-size: 14px;
  color: var(--text-secondary);
}

.lead-header__controls {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.lead-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.lead-info__item {
  background: var(--bg-surface);
  padding: 14px 16px;
  border-radius: var(--radius);
}

.lead-info__label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.lead-info__value {
  font-size: 14px;
  color: var(--text-primary);
}

.login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login__form {
  background: var(--bg-surface);
  padding: 40px;
  border-radius: var(--radius);
  width: 100%;
  max-width: 360px;
}

.login__title {
  font-size: 14px;
  color: var(--accent-sand);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 24px;
  text-align: center;
}

.login__input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-base);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 16px;
  outline: none;
}

.login__input:focus {
  border-color: var(--accent-mustard);
}

.login__error {
  color: var(--accent-orange);
  font-size: 13px;
  margin-bottom: 12px;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
}

.empty-state__heading {
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 8px;
}

.empty-state__text {
  font-size: 14px;
  color: var(--text-secondary);
}

.section-label {
  font-size: 11px;
  color: var(--accent-sand);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .dashboard {
    padding: 0 16px;
  }

  .actions {
    flex-direction: column;
  }

  .lead-info {
    grid-template-columns: 1fr;
  }

  .leads-table th:nth-child(4),
  .leads-table td:nth-child(4) {
    display: none;
  }
}
