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

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-hover: #f4f4f5;
  --border: #e4e4e7;
  --border-light: #f4f4f5;
  --text: #18181b;
  --text-secondary: #71717a;
  --text-tertiary: #a1a1aa;
  --accent: #10b981;
  --accent-light: #ecfdf5;
  --accent-dark: #059669;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.03);
  --shadow: 0 2px 8px rgba(0,0,0,.05);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.07);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --duration-fast: 160ms;
  --duration: 200ms;
  --duration-slow: 300ms;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #171717;
  --surface-hover: #262626;
  --border: #2e2e2e;
  --border-light: #1f1f1f;
  --text: #f5f5f5;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --accent: #10b981;
  --accent-light: #052e16;
  --accent-dark: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.2);
  --shadow: 0 2px 8px rgba(0,0,0,.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.4);
}

[data-theme="dark"] .btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="dark"] .btn-danger {
  background: #1c0404;
  border-color: #7f1d1d;
}

[data-theme="dark"] .pill-nav {
  background: #1f1f1f;
}

[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #1f1f1f 25%, #2e2e2e 50%, #1f1f1f 75%);
  background-size: 200% 100%;
}

[data-theme="dark"] .phone-number {
  color: var(--text);
}

/* Override Tailwind hardcoded zinc classes in dark mode */
[data-theme="dark"] .bg-zinc-50 { background: #1f1f1f !important; }
[data-theme="dark"] .bg-zinc-100 { background: #262626 !important; }
[data-theme="dark"] .bg-white { background: var(--surface) !important; }
[data-theme="dark"] .bg-red-50 { background: #1c0404 !important; }
[data-theme="dark"] .border-red-100 { border-color: #7f1d1d !important; }
[data-theme="dark"] .border-zinc-100 { border-color: #2e2e2e !important; }
[data-theme="dark"] .text-zinc-400 { color: #71717a !important; }
[data-theme="dark"] .text-zinc-500 { color: #a1a1aa !important; }
[data-theme="dark"] .text-zinc-600 { color: #d4d4d8 !important; }
[data-theme="dark"] .text-zinc-300 { color: #52525b !important; }
[data-theme="dark"] .bg-emerald-50 { background: #052e16 !important; }
[data-theme="dark"] .bg-amber-50 { background: #451a03 !important; }
[data-theme="dark"] .border-emerald-200 { border-color: #065f46 !important; }
[data-theme="dark"] .border-amber-200 { border-color: #92400e !important; }
[data-theme="dark"] .text-emerald-700 { color: #6ee7b7 !important; }
[data-theme="dark"] .text-amber-700 { color: #fcd34d !important; }

* { box-sizing: border-box; }

body {
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg);
  color: var(--text);
  margin: 0;
}

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  font-size: 0.875rem;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out),
              background var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out),
              border-color var(--duration) var(--ease-out);
  letter-spacing: -0.01em;
  position: relative;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,.2), inset 0 1px 0 rgba(255,255,255,.12);
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    background: var(--accent-dark);
    box-shadow: 0 4px 16px rgba(16,185,129,.25);
  }
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-secondary {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
}

@media (hover: hover) and (pointer: fine) {
  .btn-secondary:hover {
    background: var(--surface-hover);
    border-color: #d4d4d8;
  }
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.5rem 0.75rem;
}

@media (hover: hover) and (pointer: fine) {
  .btn-ghost:hover {
    color: var(--text);
    background: var(--surface-hover);
  }
}

.btn-danger {
  background: #fef2f2;
  color: var(--danger);
  border: 1.5px solid #fecaca;
}

@media (hover: hover) and (pointer: fine) {
  .btn-danger:hover { background: #fee2e2; }
}

/* --- Card --- */

.card {
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

/* --- Inputs --- */

.input {
  width: 100%;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out);
}

.input::placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

input, textarea, select { font-family: inherit; }

/* --- Badge --- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-green {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.badge-gray {
  background: #f4f4f5;
  color: var(--text-secondary);
}

/* --- Pill nav --- */

.pill-nav {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: #f4f4f5;
  border-radius: var(--radius);
}

.pill-nav button {
  flex: 1;
  padding: 0.625rem 1rem;
  border-radius: calc(var(--radius) - 3px);
  border: none;
  font-weight: 600;
  font-size: 0.8125rem;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--duration) var(--ease-out),
              color var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out);
  background: transparent;
  color: var(--text-secondary);
}

.pill-nav button:active {
  transform: scale(0.97);
}

.pill-nav button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* --- Label --- */

.label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

/* --- Stats --- */

.stat {
  text-align: center;
  padding: 0.75rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
}

.stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.375rem;
}

/* --- Phone number --- */

.phone-number {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}

/* --- Divider --- */

.divider {
  height: 1px;
  background: var(--border-light);
  margin: 1rem 0;
}

/* --- Stagger animation --- */

.animate-in > * {
  opacity: 0;
  transform: translateY(8px);
  animation: staggerIn var(--duration-slow) var(--ease-out) forwards;
}

.animate-in > *:nth-child(1) { animation-delay: 0ms; }
.animate-in > *:nth-child(2) { animation-delay: 50ms; }
.animate-in > *:nth-child(3) { animation-delay: 100ms; }
.animate-in > *:nth-child(4) { animation-delay: 150ms; }
.animate-in > *:nth-child(5) { animation-delay: 200ms; }
.animate-in > *:nth-child(6) { animation-delay: 250ms; }
.animate-in > *:nth-child(7) { animation-delay: 300ms; }
.animate-in > *:nth-child(8) { animation-delay: 350ms; }

@keyframes staggerIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Single element fade-in (no stagger) */
.fade-in {
  animation: fadeIn var(--duration-slow) var(--ease-out);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Outcome buttons --- */

.outcome-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--text);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out),
              border-color var(--duration) var(--ease-out),
              background var(--duration) var(--ease-out);
  text-align: left;
}

.outcome-btn:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .outcome-btn:hover {
    border-color: #d4d4d8;
    background: var(--surface-hover);
  }
}

.outcome-btn.selected {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent-dark);
}

.outcome-btn .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: border-color var(--duration) var(--ease-out),
              background var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out);
}

.outcome-btn.selected .dot {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* --- Stage buttons --- */

.stage-btn {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out),
              border-color var(--duration) var(--ease-out),
              background var(--duration) var(--ease-out);
  text-align: left;
  opacity: 0;
  animation: staggerIn var(--duration-slow) var(--ease-out) forwards;
}

.stage-btn:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .stage-btn:hover {
    border-color: #d4d4d8;
    background: var(--surface-hover);
  }
}

.stage-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.stage-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(0,0,0,.06);
}

/* --- Logo mark --- */

.logo-mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, #34d399 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

/* --- Page header --- */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

/* --- Skeleton loader --- */

.skeleton {
  background: linear-gradient(90deg, #f4f4f5 25%, #e4e4e7 50%, #f4f4f5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Reduced motion --- */

@media (prefers-reduced-motion: reduce) {
  .animate-in > * {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .fade-in {
    animation: none;
  }

  .skeleton {
    animation: none;
  }

  .btn,
  .pill-nav button,
  .outcome-btn {
    transition: none;
  }
}
