:root {
  /* EV Fit brand colors */
  --evfit-teal: #345862;
  --evfit-mint: #F4F8F6;
  --evfit-lime: #D4FF3D;
  --evfit-coral: #FF6B5B;
  --evfit-text: #1A2B30;
  --evfit-grey: #E8EDEC;

  /* Semantic aliases */
  --bg: var(--evfit-mint);
  --surface: #FFFFFF;
  --surface-hover: var(--evfit-mint);
  --border: var(--evfit-grey);
  --accent: var(--evfit-teal);
  --accent-light: #4a7188;
  --accent-dim: rgba(52, 88, 98, 0.08);
  --text: var(--evfit-text);
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --cta-primary: var(--evfit-lime);
  --cta-hover: #c9e01f;
  --thinking-purple: #9333EA;
}

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

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0;
}

.app {
  width: 100%;
  height: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: -1px 0 2px rgba(0,0,0,0.05);
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo {
  width: 32px;
  height: 32px;
  background: var(--evfit-teal);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo svg {
  width: 18px;
  height: 18px;
  color: white;
}

.logo-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--evfit-teal);
}

.logo-badge {
  font-size: 11px;
  background: transparent;
  color: var(--evfit-teal);
  border: 1px solid var(--evfit-teal);
  border-radius: 100px;
  padding: 3px 9px;
  margin-left: auto;
  font-weight: 500;
}

/* App container with sidebar */
.app-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  width: 180px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-shrink: 0;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.sidebar-step {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  cursor: default;
}

.sidebar-step.completed {
  background: transparent;
}

.sidebar-step.current {
  background: rgba(52, 88, 98, 0.08);
}

.sidebar-step.future {
  opacity: 0.5;
}

.sidebar-step-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: space-between;
}

.sidebar-step-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.sidebar-step-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.sidebar-step-answer {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  word-break: break-word;
}

.sidebar-step-edit {
  color: var(--text-light);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.sidebar-step-edit:hover {
  color: var(--evfit-teal);
  background: rgba(52, 88, 98, 0.08);
}

/* Chat feed */
#chat-feed {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

#chat-feed::-webkit-scrollbar {
  width: 6px;
}
#chat-feed::-webkit-scrollbar-track {
  background: transparent;
}
#chat-feed::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* Message bubbles */
.message {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  animation: slideIn 0.3s ease-out;
}

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

.agent-message {
  align-self: flex-start;
  max-width: 100%;
}

.user-message {
  align-self: flex-end;
  max-width: 85%;
}

.user-message p {
  background: var(--evfit-teal);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
}

/* Working card */
.working-card {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.thinking-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--thinking-purple);
  flex-shrink: 0;
}

.progress-bar {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--thinking-purple);
  width: 100%;
  animation: pulse 1.5s ease-in-out infinite;
}

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

.status-text {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  min-height: 18px;
}

.working-card.long {
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

.rec-steps {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rec-step {
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 1.5rem;
  position: relative;
  animation: slideIn 0.4s ease-out;
}

.rec-step::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--thinking-purple);
  font-weight: bold;
}

/* Step indicator */
.step-indicator {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Question card */
.question-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
}

/* Options container */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.option input[type='checkbox'] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--evfit-teal);
  flex-shrink: 0;
}

.option label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  cursor: pointer;
}

.opt-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

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

/* Buttons */
.btn {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-next,
.btn-submit {
  background: var(--cta-primary);
  color: var(--evfit-text);
  justify-content: center;
  margin-top: 0.5rem;
}

.btn-next:hover,
.btn-submit:hover {
  background: var(--cta-hover);
}

.btn-secondary {
  background: var(--evfit-teal);
  color: var(--evfit-mint);
  border: none;
  width: 100%;
  justify-content: center;
  margin-top: 0.5rem;
}

.btn-secondary:hover {
  background: var(--accent-light);
}

/* Lead capture card */
.lead-card {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.lead-card p {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 1rem;
  color: var(--text);
}

.lead-card p:first-child {
  font-weight: 600;
  font-size: 15px;
}

.lead-card form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.lead-card input {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}

.lead-card input::placeholder {
  color: var(--text-light);
}

.lead-card input:focus {
  outline: none;
  border-color: var(--evfit-teal);
  box-shadow: 0 0 0 3px rgba(52, 88, 98, 0.08);
}

/* Recommendation heading */
.rec-heading p {
  font-size: 15px;
  font-weight: 600;
  color: var(--evfit-teal);
  margin-bottom: 0.75rem;
}

/* Recommendation container */
.rec-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Match score circular progress */
.match-score-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.match-score-circle {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: conic-gradient(var(--evfit-teal) var(--match-percentage), transparent var(--match-percentage));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.match-score-inner {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
}

.match-score-number {
  font-size: 32px;
  font-weight: 700;
  color: var(--evfit-teal);
}

.match-score-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  user-select: none;
}

/* Individual model card */
.model-card {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

.model-card-hero {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--border);
  display: block;
}

.model-card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.model-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--evfit-teal);
  margin: 0;
  letter-spacing: -0.01em;
}

.model-card-specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.spec-item-grid {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.spec-item-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.spec-item-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.model-card-ctas {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-cta-primary {
  background: var(--cta-primary);
  color: var(--evfit-text);
  text-align: center;
  padding: 0.875rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-cta-primary:hover {
  background: var(--cta-hover);
}

.btn-cta-secondary {
  background: transparent;
  color: var(--evfit-teal);
  border: 1.5px solid var(--evfit-teal);
  text-align: center;
  padding: 0.875rem 1.25rem;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cta-secondary:hover {
  border-color: var(--accent-light);
  color: var(--accent-light);
  background: rgba(52, 88, 98, 0.05);
}

.model-card-ratings {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.rating-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.rating-label {
  color: var(--text-muted);
  font-weight: 500;
}

.rating-value {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.rating-stars {
  display: flex;
  gap: 0.125rem;
}

.star {
  font-size: 14px;
}

.rating-emoji {
  font-size: 16px;
}

.rating-tag {
  display: inline-block;
  background: rgba(52, 88, 98, 0.08);
  color: var(--evfit-teal);
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
}

.model-card-expandable {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.expandable-header {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
  padding: 0.5rem 0;
}

.expandable-header:hover {
  color: var(--evfit-teal);
}

.expandable-content {
  display: none;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}

.expandable-content.open {
  display: block;
}

.expand-chevron {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 12px;
}

.expand-chevron.open {
  transform: rotate(180deg);
}

.model-card-section {
  margin: 1rem 0 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.model-card-section:first-of-type {
  margin: 0;
  padding: 0;
  border: none;
}

.model-card-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 0.5rem 0;
}

.model-card-section p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  margin: 0.5rem 0;
}

.spec-list {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  margin: 0.5rem 0;
}

.spec-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0.5rem 0;
  padding-bottom: 0.5rem;
}

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

.spec-value {
  font-weight: 500;
  color: var(--text);
}

/* Recommendation card (legacy, for text content) */
.rec-card {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 100%;
}

[id^="rec-content"] {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  word-break: break-word;
}

[id^="rec-content"] > *:first-child {
  margin-top: 0;
}

[id^="rec-content"] > *:last-child {
  margin-bottom: 0;
}

[id^="rec-content"] h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--evfit-teal);
  margin: 1rem 0 0.5rem 0;
  letter-spacing: -0.01em;
}

[id^="rec-content"] h4:first-child {
  margin-top: 0;
}

[id^="rec-content"] p {
  margin: 0.75rem 0;
}

[id^="rec-content"] strong {
  color: var(--evfit-teal);
  font-weight: 600;
}

#followup-response {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  word-break: break-word;
}

#followup-response h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--evfit-teal);
  margin: 1rem 0 0.5rem 0;
  letter-spacing: -0.01em;
}

#followup-response p {
  margin: 0.75rem 0;
}

#followup-response strong {
  color: var(--evfit-teal);
  font-weight: 600;
}

/* Follow-up chat bar */
.followup-bar {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

.followup-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  padding: 0.5rem 0;
  color: var(--text);
  font-family: inherit;
  outline: none;
  border-bottom: 1px solid var(--border);
}

.followup-bar input::placeholder {
  color: var(--text-light);
}

.followup-bar input:focus {
  border-bottom-color: var(--evfit-teal);
}

.btn-followup {
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--cta-primary);
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.btn-followup:hover {
  color: var(--cta-hover);
}

/* Conversational input styles */
.opening-input-container,
.agent-message > div:has(.followup-input) {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  width: 100%;
  align-items: flex-end;
}

.opening-input,
.followup-input {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  resize: vertical;
  line-height: 1.5;
}

.opening-input {
  min-height: 90px;
}

.opening-input::placeholder,
.followup-input::placeholder {
  color: var(--text-light);
}

.opening-input:focus,
.followup-input:focus {
  outline: none;
  border-color: var(--evfit-teal);
  box-shadow: 0 0 0 3px rgba(52, 88, 98, 0.08);
}

.agent-message > p.question-text {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.agent-message > p:first-child {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.agent-message > p em {
  color: var(--text-muted);
  font-style: italic;
}

/* Responsive */
@media (max-width: 640px) {
  .app {
    max-width: 100%;
    border-radius: 0;
    box-shadow: none;
    height: 100vh;
  }

  .app-container {
    flex-direction: column;
  }

  .sidebar {
    display: none;
  }

  #chat-feed {
    padding: 1rem;
    gap: 0.75rem;
  }

  .user-message {
    max-width: 90%;
  }

  .btn {
    font-size: 13px;
    padding: 0.7rem 1rem;
  }

  .followup-bar {
    padding: 0.75rem;
  }

  .followup-bar input {
    font-size: 13px;
  }
}
