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

:root {
  --bp-bg: #f7f5f0;
  --bp-surface: #fdfbf6;
  --bp-surface-muted: #f5f3ee;
  --bp-surface-alt: #f0eee9;
  --bp-surface-card: #fdfbf6;
  --bp-text: #2d3e50;
  --bp-text-muted: #6885a1;
  --bp-text-secondary: #2d3e50;
  --bp-text-subtle: #666666;
  --bp-text-faint: #98a4af;
  --bp-border: #d6d1c6;
  --bp-border-strong: #c9c9c9;
  --bp-border-hover: #6f8da7;
  --bp-primary: #6885a1;
  --bp-primary-hover: #5f7a94;
  --bp-primary-contrast: #ffffff;
  --bp-primary-soft: #e8eef4;
  --bp-primary-soft-hover: #dde6ee;
  --bp-primary-strong: #2d3e50;
  --bp-secondary: #f2c94c;
  --bp-secondary-hover: #e6be47;
  --bp-secondary-contrast: #2d3e50;
  /* Warm stroke for outline icons (tips, section marks) */
  --bp-warm-stroke: #c9a227;
  --bp-success: #059669;
  --bp-success-bg: #f0fdf4;
  --bp-success-border: #bbf7d0;
  --bp-error: #991b1b;
  --bp-error-bg: #fef2f2;
  --bp-error-border: #fecaca;
  --bp-radius-sm: 12px;
  --bp-radius-md: 16px;
  --bp-radius-lg: 30px;
  --bp-radius-input: 10px;
  --bp-shadow-sm: 0 8px 18px rgba(0, 0, 0, 0.08);
  --bp-shadow-md: 0 12px 24px rgba(0, 0, 0, 0.12);
  --bp-focus-ring: 0 0 0 3px rgba(104, 133, 161, 0.35);
  --bp-disabled-bg: #9ca3af;
  --bp-font-body: 'Montserrat', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --bp-font-heading: 'Montserrat', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --font-sans: 'Montserrat', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

html,
body {
  max-width: 100vw;
  overflow-x: hidden;
  font-family: var(--bp-font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bp-bg);
  color: var(--bp-text);
  line-height: 1.6;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.card {
  background: var(--bp-surface);
  border-radius: var(--bp-radius-sm);
  padding: 2rem;
  box-shadow: var(--bp-shadow-sm);
}

h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  font-family: var(--bp-font-heading);
}

h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-family: var(--bp-font-heading);
}

.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

input[type='text'],
input[type='email'],
select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius-input);
  font-size: 1rem;
  transition: border-color 0.2s;
}

input[type='text']:focus,
input[type='email']:focus,
select:focus {
  outline: none;
  border-color: var(--bp-primary);
  box-shadow: var(--bp-focus-ring);
}

input[type='text']::placeholder,
input[type='email']::placeholder,
select::placeholder {
  color: var(--bp-text-muted);
}

button {
  background-color: var(--bp-primary);
  color: var(--bp-primary-contrast);
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--bp-radius-lg);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

button:hover:not(:disabled) {
  background-color: var(--bp-primary-hover);
}

button:disabled {
  background-color: var(--bp-disabled-bg);
  cursor: not-allowed;
}

.error {
  background-color: var(--bp-error-bg);
  border: 1px solid var(--bp-error-border);
  color: var(--bp-error);
  padding: 1rem;
  border-radius: var(--bp-radius-sm);
  margin-bottom: 1rem;
}

.success {
  background-color: var(--bp-success-bg);
  border: 1px solid var(--bp-success-border);
  color: var(--bp-success);
  padding: 1rem;
  border-radius: var(--bp-radius-sm);
  margin-bottom: 1rem;
}

.loading {
  text-align: center;
  padding: 2rem;
  color: var(--bp-text-muted);
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.radio-option {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--bp-border-strong);
  border-radius: var(--bp-radius-input);
  cursor: pointer;
  transition: all 0.2s;
}

.radio-option:hover {
  border-color: var(--bp-primary);
  background-color: var(--bp-primary-soft);
}

.radio-option input[type='radio'] {
  margin-right: 0.75rem;
  cursor: pointer;
}

.radio-option label {
  margin: 0;
  cursor: pointer;
  font-weight: normal;
}

.done-message {
  text-align: center;
  padding: 2rem 0;
}

.done-message h1 {
  color: var(--bp-primary);
  margin-bottom: 1rem;
}

.done-message p {
  color: var(--bp-text-muted);
  font-size: 1.125rem;
}

/* ------------------------------------------------------------------ */
/*  Intro page                                                        */
/* ------------------------------------------------------------------ */

.intro-card {
  /* Shared steps on a 4px grid: 8, 12, 16, 20, 24 px */
  --intro-space-1: 0.5rem;
  --intro-space-2: 0.75rem;
  --intro-space-3: 1rem;
  --intro-space-4: 1.25rem;
  --intro-space-5: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: var(--intro-space-5);
  position: relative;
}

.intro-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.intro-lang-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: 100%;
}

.intro-lang-fieldset-picks {
  display: flex;
  flex-direction: column;
  gap: var(--intro-space-3);
  width: 100%;
}

.intro-lang-pick-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: var(--intro-space-2) var(--intro-space-3);
}

.intro-lang-pick-text {
  flex: 1 1 12rem;
  min-width: min(100%, 14rem);
  display: flex;
  flex-direction: column;
  gap: calc(var(--intro-space-1) * 0.75);
  padding: 0;
  text-align: left;
}

.intro-lang-pick-notes {
  display: flex;
  flex-direction: column;
  gap: calc(var(--intro-space-1) * 0.75);
  padding: 0;
}

.intro-lang-pick-note-p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--bp-text-secondary);
}

.intro-lang-pick-label {
  margin: 0;
  padding: 0;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--bp-font-heading);
  color: var(--bp-text);
  line-height: 1.35;
  text-align: left;
}

.intro-lang-fieldset {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.intro-lang-btn {
  border: 1px solid var(--bp-border);
  background: var(--bp-surface);
  color: var(--bp-text-secondary);
  border-radius: var(--bp-radius-lg);
  padding: 0.5rem 1.35rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease,
    outline 0.2s ease;
  min-width: 10.5rem;
  flex: 0 0 auto;
}

.intro-lang-btn:hover:not(:disabled) {
  background: var(--bp-secondary);
  border-color: var(--bp-secondary-hover);
  color: var(--bp-secondary-contrast);
  transform: translateY(-3px);
  box-shadow: var(--bp-shadow-md);
}

.intro-lang-btn.active {
  background: var(--bp-primary);
  color: var(--bp-primary-contrast);
  border-color: var(--bp-primary);
}

.intro-lang-btn.active:hover:not(:disabled) {
  background: var(--bp-secondary);
  border-color: var(--bp-secondary-hover);
  color: var(--bp-secondary-contrast);
  outline: 2px solid var(--bp-primary);
  outline-offset: 2px;
}

.intro-lang-btn:focus-visible {
  outline: none;
  box-shadow: var(--bp-focus-ring);
}

.intro-lang-btn:focus-visible:hover:not(:disabled) {
  box-shadow: var(--bp-focus-ring), var(--bp-shadow-md);
}

.intro-lang-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.intro-lang-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

@media (max-width: 520px) {
  .intro-lang-pick-row {
    flex-direction: column;
    align-items: stretch;
  }

  .intro-lang-btn {
    width: 100%;
    min-width: unset;
  }
}

.intro-step-names {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0.25rem 0 0.75rem 0;
  color: var(--bp-text-muted);
  font-size: 0.8125rem;
}

.intro-step-name {
  position: relative;
  padding-left: 0.75rem;
}

.intro-step-name::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.4rem;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--bp-border);
}

.intro-rest {
  display: flex;
  flex-direction: column;
  gap: var(--intro-space-5);
  margin: 0;
  padding: 0;
}

.intro-divider {
  border: none;
  border-top: 1px solid var(--bp-border);
  margin: 0;
  width: 100%;
}

.intro-project-loading {
  margin: 0;
  color: var(--bp-text-muted);
  font-size: 0.9375rem;
}

.intro-hero {
  margin-top: -0.375rem;
  margin-bottom: -0.5rem;
}

.intro-hero h1 {
  margin: 0;
  text-align: center;
}

.intro-lead {
  margin: 0;
  color: var(--bp-text-secondary);
  font-size: 1rem;
  line-height: 1.6;
}

.intro-section {
  display: flex;
  flex-direction: column;
  gap: var(--intro-space-3);
}

.intro-section h2 {
  margin: 0;
}

.intro-next-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--intro-space-3);
  margin: 0;
}

.intro-next-card {
  background: var(--bp-surface-muted);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius-md);
  padding: var(--intro-space-3) var(--intro-space-4);
  box-shadow: var(--bp-shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--intro-space-2);
}

/* Roadmap tile for current portal step (intake vs post-intake) */
.intro-next-card.intro-next-card-intro-active {
  background: var(--bp-primary-soft);
  border-color: var(--bp-border-hover);
}

.intro-next-card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.intro-next-index {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bp-primary-soft);
  color: var(--bp-primary-strong);
  font-weight: 600;
  font-size: 0.875rem;
  border: 1px solid var(--bp-border);
}

.intro-next-title {
  font-weight: 600;
  color: var(--bp-text);
}

.intro-next-desc {
  color: var(--bp-text-secondary);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.intro-note {
  margin: 0;
  padding: var(--intro-space-2) var(--intro-space-3);
  border-radius: var(--bp-radius-sm);
  background: var(--bp-surface-muted);
  border: 1px solid var(--bp-border);
  color: var(--bp-text-muted);
  font-size: 0.9375rem;
}

.intro-actions {
  margin: 0;
}

/* Match intro vertical rhythm (parent .intro-rest gap replaces default margin-top) */
.intro-rest .ui-button-group {
  margin-top: 0;
  padding-top: var(--intro-space-4);
  gap: var(--intro-space-3);
}

.intro-rest .ui-alert {
  margin-bottom: 0;
}

/* ------------------------------------------------------------------ */
/*  Intake flow                                                       */
/* ------------------------------------------------------------------ */

.intake-progress {
  margin-bottom: 1.5rem;
}

.intake-progress-text {
  font-size: 0.875rem;
  color: var(--bp-text-muted);
  margin-bottom: 0.5rem;
}

.intake-progress-bar {
  height: 4px;
  background-color: var(--bp-border);
  border-radius: 2px;
  overflow: hidden;
}

.intake-progress-fill {
  height: 100%;
  background-color: var(--bp-primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.intake-question {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--bp-text);
  margin-bottom: 1rem;
  line-height: 1.4;
}

.intake-examples {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background-color: var(--bp-surface-muted);
  border-radius: var(--bp-radius-sm);
  border: 1px solid var(--bp-border);
}

.intake-examples-label {
  font-size: 0.8125rem;
  color: var(--bp-text-muted);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.intake-examples ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin: 0;
}

.intake-examples li {
  font-size: 0.8125rem;
  color: var(--bp-text-muted);
  line-height: 1.5;
}

.intake-show-more {
  background: none !important;
  border: none !important;
  color: var(--bp-primary) !important;
  padding: 0.25rem 0 !important;
  font-size: 0.8125rem !important;
  cursor: pointer;
  text-decoration: underline;
  min-height: auto !important;
}

.intake-show-more:hover:not(:disabled) {
  color: var(--bp-primary-hover) !important;
  background: none !important;
}

.intake-textarea {
  width: 100%;
  min-height: 120px;
  padding: 0.75rem 3.25rem 2.5rem 0.75rem;
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius-input);
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s;
}

.intake-textarea-wrap {
  position: relative;
}

.intake-voice-btn {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--bp-primary-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 1;
}

.intake-voice-icon {
  width: 20px;
  height: 20px;
  display: block;
  opacity: 0.9;
}

.intake-voice-wave {
  position: absolute;
  right: 3.25rem;
  bottom: 1.1rem;
  display: inline-flex;
  gap: 4px;
  height: 16px;
  align-items: flex-end;
}

.intake-voice-wave span {
  display: block;
  width: 3px;
  height: 6px;
  border-radius: 999px;
  background: var(--bp-primary);
  animation: voice-bars 1s ease-in-out infinite;
  opacity: 0.7;
}

.intake-voice-wave span:nth-child(2) {
  animation-delay: 0.15s;
  height: 10px;
}

.intake-voice-wave span:nth-child(3) {
  animation-delay: 0.3s;
  height: 8px;
}

.intake-voice-wave span:nth-child(4) {
  animation-delay: 0.45s;
  height: 12px;
}

.intake-voice-preview {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--bp-text-muted);
  max-width: 100%;
  word-break: break-word;
}

.intake-textarea-wrap .intake-voice-preview,
.intake-textarea-wrap .intake-voice-wave {
  position: absolute;
}

.intake-textarea-wrap .intake-voice-preview {
  left: 0.75rem;
  right: 3.25rem;
  bottom: 0.75rem;
  margin: 0;
  padding-right: 0.5rem;
}

.intake-textarea-wrap .intake-voice-wave {
  right: 3.25rem;
  bottom: 1.25rem;
}

@keyframes voice-bars {
  0% {
    transform: scaleY(0.6);
    opacity: 0.5;
  }
  50% {
    transform: scaleY(1.4);
    opacity: 1;
  }
  100% {
    transform: scaleY(0.6);
    opacity: 0.5;
  }
}

.intake-voice-btn:hover:not(:disabled) {
  color: var(--bp-primary);
  background: transparent;
}

.intake-voice-btn.is-listening {
  color: var(--bp-primary);
  background: rgba(104, 133, 161, 0.08);
  box-shadow: 0 0 0 4px rgba(104, 133, 161, 0.12);
}

.intake-voice-btn.is-listening::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 2px solid rgba(104, 133, 161, 0.45);
  animation: voice-pulse 1.2s ease-out infinite;
}

@keyframes voice-pulse {
  0% {
    transform: scale(0.9);
    opacity: 0.6;
  }
  70% {
    transform: scale(1.2);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

.intake-voice-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.intake-textarea:focus {
  outline: none;
  border-color: var(--bp-primary);
  box-shadow: var(--bp-focus-ring);
}

.intake-textarea::placeholder {
  color: var(--bp-text-muted);
}

.intake-hint {
  font-size: 0.8125rem;
  color: var(--bp-text-faint);
  margin-top: 0.375rem;
}

.intake-radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.intake-radio-option {
  display: flex;
  align-items: center;
  padding: 0.625rem 1rem;
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius-input);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bp-surface);
}

.intake-radio-option:hover {
  border-color: var(--bp-primary);
  background-color: var(--bp-primary-soft-hover);
}

.intake-radio-option.selected {
  border-color: var(--bp-primary);
  background-color: var(--bp-primary-soft);
}

.intake-radio-option input[type='radio'] {
  margin-right: 0.75rem;
  cursor: pointer;
  accent-color: var(--bp-primary);
}

.intake-radio-option span {
  font-size: 0.9375rem;
  color: var(--bp-text-secondary);
}

.intake-branch-text {
  margin-top: 0.75rem;
}

.intake-draft-error {
  background-color: var(--bp-error-bg);
  border: 1px solid var(--bp-error-border);
  color: var(--bp-error);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-top: 1rem;
  font-size: 0.8125rem;
}

/* Intake summary */

.intake-summary-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.intake-summary-item {
  padding: 1rem;
  background-color: var(--bp-surface-muted);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius-sm);
}

.intake-summary-question {
  font-size: 0.8125rem;
  color: var(--bp-text-muted);
  margin-bottom: 0.375rem;
  font-weight: 500;
}

.intake-summary-answer {
  font-size: 0.9375rem;
  color: var(--bp-text);
  line-height: 1.5;
  white-space: pre-line;
}

.intake-summary-edit {
  background: none !important;
  border: none !important;
  color: var(--bp-primary) !important;
  padding: 0.25rem 0 !important;
  font-size: 0.8125rem !important;
  cursor: pointer;
  text-decoration: underline;
  margin-top: 0.375rem;
  display: inline-block;
  min-height: auto !important;
}

.intake-summary-edit:hover:not(:disabled) {
  color: var(--bp-primary-hover) !important;
  background: none !important;
}
