:root {
  --bg: #f4f7fb;
  --bg-deep: #e8eef7;
  --surface: #ffffff;
  --ink: #142033;
  --ink-muted: #5a6a80;
  --line: #d5deea;
  --brand: #0b6e6a;
  --brand-deep: #085652;
  --brand-soft: #d8f0ee;
  --accent: #c45c26;
  --accent-soft: #fde8dc;
  --warn: #9a3412;
  --good: #1b7a4a;
  --better: #0b6e6a;
  --best: #1e3a8a;
  --shadow: 0 10px 30px rgba(20, 32, 51, 0.08);
  --radius: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 280ms;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, #d9f3f1 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #f8e9df 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--brand-deep);
}

.app {
  max-width: 920px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + var(--safe-b));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 30% 28%, #fff8 0 18%, transparent 19%),
    linear-gradient(145deg, #1aa39a, #0b6e6a 55%, #084d4a);
  box-shadow: 0 8px 18px rgba(11, 110, 106, 0.28);
}

.brand-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-sub {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.top-nav {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.7);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.nav-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-muted);
  font-weight: 600;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.nav-btn.is-active {
  background: var(--ink);
  color: #fff;
}

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

.banner {
  background: linear-gradient(90deg, #fff4e8, #ffe9d4);
  color: var(--warn);
  border: 1px solid #f3d2b2;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

.main {
  position: relative;
  flex: 1;
}

.view {
  display: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.view.is-visible {
  display: block;
  opacity: 1;
  transform: none;
}

.view-head h2,
.client-head h2,
.step-panel h3 {
  font-family: var(--display);
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.muted {
  color: var(--ink-muted);
}

.small {
  font-size: 0.88rem;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.client-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.client-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  min-height: 72px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.client-item:hover,
.client-item:focus-visible {
  transform: translateY(-2px);
  border-color: #b7cfe0;
  box-shadow: 0 14px 34px rgba(20, 32, 51, 0.12);
  outline: none;
}

.client-item:active {
  transform: scale(0.99);
}

.client-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  background: linear-gradient(145deg, #3aa8a1, #0b6e6a);
}

.client-item h3 {
  margin: 0;
  font-size: 1.05rem;
}

.client-item p {
  margin: 2px 0 0;
  font-size: 0.88rem;
  color: var(--ink-muted);
}

.reason-pill {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  max-width: 42%;
  text-align: center;
  line-height: 1.2;
}

.back-link {
  border: 0;
  background: transparent;
  color: var(--brand-deep);
  font-weight: 600;
  min-height: 44px;
  padding: 0 4px;
  margin-bottom: 4px;
}

.client-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.progress-track {
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 25%;
  background: linear-gradient(90deg, var(--brand), #1aa39a);
  border-radius: inherit;
  transition: width var(--dur) var(--ease);
}

.progress-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 8px 0 0;
  padding: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-align: center;
}

.progress-steps li.is-done,
.progress-steps li.is-current {
  color: var(--brand-deep);
}

.progress-steps li.is-current {
  font-weight: 700;
}

.step-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 22px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  animation: panel-in var(--dur) var(--ease);
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ask-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
}

fieldset {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 10px;
}

legend {
  padding: 0 6px;
  font-weight: 700;
  font-size: 0.85rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 500;
}

input,
select,
textarea {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

textarea {
  min-height: 72px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 110, 106, 0.15);
}

.toggle {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.toggle input {
  width: 20px;
  height: 20px;
  min-height: 20px;
  accent-color: var(--brand);
}

.toggle.danger span {
  color: var(--warn);
}

.hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--brand-deep);
  font-weight: 600;
}

.fit-card {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(160deg, #eef8f7, #f7fafc);
  border: 1px solid #cfe4e2;
}

.fit-card h4 {
  margin: 0 0 6px;
  font-family: var(--display);
}

.fit-card .reason {
  margin: 0 0 8px;
  font-size: 0.92rem;
}

.fit-card .rule {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.tagline {
  font-style: italic;
  color: var(--accent);
}

.tier-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 14px 0;
}

@media (min-width: 640px) {
  .tier-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .client-head {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
  }
  .progress {
    min-width: 260px;
  }
}

.tier-card {
  position: relative;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fbfcfe;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.tier-card.is-lead {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(11, 110, 106, 0.2), var(--shadow);
  transform: translateY(-2px);
  background: linear-gradient(180deg, #f2fbfa, #fff);
}

.tier-card .badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.tier-card.good .tier-name { color: var(--good); }
.tier-card.better .tier-name { color: var(--better); }
.tier-card.best .tier-name { color: var(--best); }

.tier-name {
  margin: 0;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tier-plan {
  margin: 6px 0 2px;
  font-family: var(--display);
  font-size: 1.05rem;
}

.tier-price {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.tier-price span {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-muted);
}

.true-cost {
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin: 0 0 14px;
}

.copy-fields {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.copy-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.copy-row input {
  flex: 1;
}

.copy-btn {
  min-width: 88px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f3f6fa;
  font-weight: 600;
  transition: background var(--dur) var(--ease);
}

.copy-btn:hover {
  background: var(--brand-soft);
}

.step-footer {
  margin-top: 14px;
  position: sticky;
  bottom: calc(8px + var(--safe-b));
  padding-top: 4px;
  z-index: 3;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
  text-decoration: none;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

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

.btn-primary {
  width: 100%;
  background: linear-gradient(180deg, #12857f, var(--brand));
  color: #fff;
  box-shadow: 0 10px 22px rgba(11, 110, 106, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #15948d, var(--brand-deep));
}

.btn-secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.draft-email {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px dashed #b7c5d6;
  animation: panel-in var(--dur) var(--ease);
}

.draft-badge {
  display: inline-block;
  margin: 0 0 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--warn);
  font-size: 0.8rem;
  font-weight: 700;
}

.draft-email pre {
  white-space: pre-wrap;
  font-family: var(--font);
  font-size: 0.9rem;
  margin: 0 0 12px;
  line-height: 1.5;
}

.stub-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.chip {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 999px;
  background: #e8eef8;
  color: #1e3a5f;
}

.note {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin: 0;
}

/* Dataspheres */
.ask-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 8px;
  z-index: 5;
}

.ask-bar input {
  flex: 1;
  border: 0;
  background: transparent;
  min-height: 44px;
  box-shadow: none;
}

.ask-bar input:focus {
  box-shadow: none;
}

.ask-submit,
.mic-btn {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
}

.ask-submit {
  background: var(--ink);
  color: #fff;
  padding: 0 16px;
}

.mic-btn {
  background: #eef2f7;
}

.answer-card {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: panel-in var(--dur) var(--ease);
}

.answer-card strong {
  display: block;
  margin-bottom: 4px;
  font-family: var(--display);
}

.suggestions {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.suggestions button {
  border: 1px solid var(--line);
  background: #f4f7fb;
  border-radius: 999px;
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--brand-deep);
}

.sphere-stage {
  position: relative;
  height: min(58vh, 460px);
  margin-top: 8px;
  border-radius: var(--radius);
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 120%, #d7e8f5 0%, transparent 55%),
    linear-gradient(180deg, #eef3f9, #e4ebf4);
  border: 1px solid var(--line);
}

.sphere {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  will-change: transform, width, height, opacity;
  transition:
    width 360ms var(--ease),
    height 360ms var(--ease),
    opacity 360ms var(--ease),
    filter 360ms var(--ease);
  pointer-events: none;
}

.sphere::after {
  content: "";
  position: absolute;
  inset: 12% 18% auto 18%;
  height: 28%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, rgba(255, 255, 255, 0.85), transparent 70%);
  opacity: 0.9;
}

.sphere-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: clamp(0.55rem, 2.2vw, 0.72rem);
  font-weight: 700;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  width: 88%;
  max-width: 7.5em;
  line-height: 1.15;
  pointer-events: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sphere-hint {
  text-align: center;
  margin: 10px 0 0;
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 480px) {
  .reason-pill {
    max-width: 38%;
    font-size: 0.7rem;
  }
  .brand-sub {
    display: none;
  }
}
