:root {
  color-scheme: light;
  --paper: #f7f5ef;
  --paper-deep: #efede5;
  --surface: #fffefa;
  --surface-soft: #f9f8f3;
  --ink: #15231f;
  --muted: #61706b;
  --line: #d9ddd6;
  --brand: #0f766e;
  --brand-deep: #0d514b;
  --brand-soft: #e5f3ef;
  --danger: #a23b37;
  --shadow: 0 18px 55px rgba(30, 47, 41, 0.09);
  --small-shadow: 0 8px 24px rgba(30, 47, 41, 0.07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% -10%, rgba(15, 118, 110, 0.08), transparent 26rem),
    var(--paper);
  color: var(--ink);
}

body.embed-mode {
  min-height: auto;
  background: transparent;
}

button,
input,
textarea {
  font: inherit;
}

button,
summary,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.35);
  outline-offset: 3px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

a {
  color: inherit;
}

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

.app-shell {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 64px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 46px;
  gap: 18px;
  margin-bottom: 38px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 850;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.wordmark-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 1.15rem;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 8px;
}

.local-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.local-badge span {
  color: #559b76;
  font-size: 0.55rem;
}

.eyebrow,
.contract-label {
  margin-bottom: 9px;
  color: var(--brand);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.primary-button,
.secondary-button,
.danger-button,
.text-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  border-radius: 10px;
  padding: 9px 15px;
  font-weight: 820;
  text-decoration: none;
}

.primary-button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  box-shadow: 0 6px 16px rgba(21, 35, 31, 0.14);
}

.primary-button:hover {
  background: #243832;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.text-button {
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--brand-deep);
}

.text-button:hover {
  background: rgba(15, 118, 110, 0.07);
}

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

.danger-button {
  border: 1px solid #e7b7b2;
  background: #fff7f6;
  color: var(--danger);
}

/* Onboarding */

.onboarding-shell {
  min-height: 100vh;
}

.onboarding-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(380px, 0.88fr);
  align-items: center;
  gap: clamp(38px, 7vw, 92px);
  min-height: calc(100vh - 170px);
  padding-bottom: 60px;
}

.onboarding-copy h1 {
  max-width: 720px;
  margin-bottom: 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.4rem, 7vw, 6.7rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.93;
}

.lede {
  max-width: 680px;
  margin-bottom: 30px;
  color: #40504b;
  font-size: clamp(1.05rem, 1.5vw, 1.28rem);
  line-height: 1.65;
}

.scope-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 190px));
  gap: 9px;
  margin-bottom: 18px;
}

.scope-picker p {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 0.87rem;
  font-weight: 850;
}

.scope-picker button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 780;
}

.scope-picker button[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.start-button {
  gap: 20px;
  min-width: 250px;
}

.privacy-note {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.contract-card {
  border: 1px solid rgba(21, 35, 31, 0.12);
  border-radius: 22px;
  padding: clamp(24px, 4vw, 42px);
  background: rgba(255, 254, 250, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.contract-card ol {
  display: grid;
  gap: 24px;
  margin: 25px 0 0;
  padding: 0;
  list-style: none;
}

.contract-card li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
}

.contract-card li > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #bfc9c3;
  border-radius: 50%;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 900;
}

.contract-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.96rem;
}

.contract-card li p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

/* Embed */

.embed-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  width: 100%;
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  background: var(--surface);
  box-shadow: var(--small-shadow);
}

.embed-card h1 {
  margin-bottom: 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.embed-card p:not(.eyebrow) {
  max-width: 620px;
  margin-bottom: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.embed-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 1.8rem;
}

.embed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

/* Valuation */

.progress-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 420px);
  align-items: end;
  gap: 26px;
  margin-bottom: 22px;
}

.progress-header h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 3vw, 2.65rem);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #dfe3dc;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 260ms ease;
}

.boundary-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 13px;
  align-items: start;
  margin-bottom: 16px;
  border: 1px solid #c9b895;
  border-radius: 12px;
  padding: 12px 15px;
  background: #fff9eb;
}

.boundary-symbol {
  color: #9a6e20;
}

.boundary-banner strong {
  display: block;
  margin-bottom: 2px;
}

.boundary-banner p {
  margin: 0;
  color: #6f6045;
  font-size: 0.84rem;
  line-height: 1.45;
}

.category-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
}

.category-nav button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px 7px 14px;
  background: var(--surface);
  color: #44524d;
  font-size: 0.79rem;
  font-weight: 820;
}

.category-nav button small {
  display: grid;
  place-items: center;
  min-width: 23px;
  height: 23px;
  border-radius: 999px;
  background: #edf0eb;
  color: var(--muted);
  font-size: 0.67rem;
}

.category-nav button[aria-current="step"] {
  border-color: var(--category);
  background: color-mix(in srgb, var(--category) 8%, white);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--category) 42%, white);
}

.category-nav button[aria-current="step"] small {
  background: var(--category);
  color: #fff;
}

.valuation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  align-items: start;
  gap: 20px;
}

.valuation-main {
  min-width: 0;
}

.category-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 10px;
}

.category-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.category-heading .category-dot {
  flex: 0 0 auto;
  color: var(--ink);
  font-weight: 900;
}

.category-dot::before {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--category);
  content: "";
}

.milestone-card {
  position: relative;
  border: 1px solid var(--line);
  border-top: 4px solid var(--category);
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.milestone-card-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 24px 28px 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.current-answer {
  color: var(--brand-deep);
}

.milestone-card > h2,
.milestone-card > .milestone-description,
.change-grid,
.thinking-cue,
.help-link {
  margin-left: 28px;
  margin-right: 28px;
}

.milestone-card > h2 {
  margin-top: 8px;
  margin-bottom: 9px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4.4vw, 3.7rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

#active-milestone-heading:focus {
  outline: none;
}

.milestone-description {
  max-width: 760px;
  margin-bottom: 21px;
  color: #45534e;
  font-size: 1rem;
  line-height: 1.55;
}

.change-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.change-grid > div {
  border: 1px solid #e3e6df;
  border-radius: 11px;
  padding: 12px 13px;
  background: var(--surface-soft);
}

.change-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.change-grid p {
  margin: 0;
  color: #44524d;
  font-size: 0.79rem;
  line-height: 1.45;
}

.thinking-cue {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  margin-bottom: 16px;
  border-radius: 11px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--category) 7%, #f8f8f4);
}

.thinking-cue > span {
  color: var(--category);
  font-size: 1.15rem;
}

.thinking-cue strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.79rem;
}

.thinking-cue p,
.thinking-cue small {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.thinking-cue small {
  display: block;
  margin-top: 4px;
}

.help-link,
.secondary-link {
  min-height: 38px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.price-panel {
  position: relative;
  border-top: 1px solid var(--line);
  padding: 20px 28px 25px;
  background: #fbfaf6;
}

.price-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 12px;
}

.price-heading h3 {
  margin: 0;
  font-size: 0.85rem;
}

.price-heading > span {
  color: var(--muted);
  font-size: 0.69rem;
}

.tier-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.tier-button {
  position: relative;
  min-height: 54px;
  border: 1px solid #cfd5ce;
  border-radius: 10px;
  padding: 10px 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.83rem;
  font-weight: 850;
}

.tier-button:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.tier-button[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.tier-button kbd {
  position: absolute;
  top: 4px;
  right: 5px;
  color: #98a29d;
  font: 600 0.58rem/1 system-ui;
}

.other-tier {
  border-style: dashed;
}

.inline-value-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 9px;
  margin-top: 11px;
}

.inline-value-form label,
.custom-milestone-form label,
.note-form label {
  display: grid;
  gap: 6px;
  color: #46534f;
  font-size: 0.76rem;
  font-weight: 820;
}

.inline-value-form label {
  position: relative;
}

.inline-value-form label span {
  position: absolute;
  bottom: 12px;
  left: 12px;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cfd5ce;
  border-radius: 9px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

.inline-value-form input {
  min-height: 44px;
  padding-left: 26px;
}

.secondary-link {
  margin-top: 8px;
}

.valuation-aside {
  display: grid;
  gap: 12px;
  position: sticky;
  top: 14px;
}

.aside-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
  background: rgba(255, 254, 250, 0.8);
}

.aside-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border-bottom: 1px solid #e6e8e3;
}

.aside-heading h3 {
  margin: 0;
  font-size: 0.78rem;
}

.aside-heading span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
}

.queue-list,
.calibration-list {
  display: grid;
  padding: 5px;
}

.queue-list button,
.calibration-list button {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 43px;
  border: 0;
  border-radius: 8px;
  padding: 7px 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.queue-list button:hover,
.queue-list button[aria-current="true"],
.calibration-list button:hover {
  background: #f0f2ed;
}

.queue-list button > span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.queue-list strong,
.calibration-list strong {
  overflow: hidden;
  font-size: 0.71rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-list small,
.calibration-list small {
  color: var(--muted);
  font-size: 0.65rem;
  white-space: nowrap;
}

.calibration-list button {
  grid-template-columns: 8px minmax(0, 1fr) auto;
}

.calibration-list button > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--category);
}

.empty-copy {
  margin: 0;
  padding: 13px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.aside-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 54px;
  border: 0;
  padding: 10px 13px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.aside-toggle strong,
.aside-toggle small {
  display: block;
}

.aside-toggle strong {
  margin-bottom: 3px;
  font-size: 0.73rem;
}

.aside-toggle small {
  color: var(--muted);
  font-size: 0.65rem;
}

.optional-list {
  max-height: 250px;
  border-top: 1px solid var(--line);
  overflow-y: auto;
}

.saved-coach {
  display: grid;
  grid-template-columns: minmax(190px, 0.75fr) minmax(0, 1.25fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
  scroll-margin-top: 10px;
  border: 1px solid #c7ddd4;
  border-radius: 12px;
  padding: 12px 14px;
  background: #eef8f4;
}

.saved-coach strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.76rem;
}

.saved-coach p {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 5px;
}

.chip-list button {
  min-height: 36px;
  border: 1px solid #b9d4ca;
  border-radius: 999px;
  padding: 5px 9px;
  background: #fff;
  color: #315e50;
  font-size: 0.66rem;
  font-weight: 780;
}

.chip-list button[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 3px 10px rgba(15, 118, 110, 0.18);
}

.chip-list button[aria-pressed="true"]::before {
  margin-right: 4px;
  content: "✓";
}

.chip-list .note-chip[aria-expanded="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.reflection-status {
  grid-column: 1 / -1;
  color: var(--brand-deep) !important;
  font-weight: 800;
}

.reflection-status span {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 3px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 0.68rem;
}

.reflection-status.is-empty {
  display: none;
}

.note-form {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.note-form button {
  min-height: 42px;
  border: 1px solid var(--brand);
  border-radius: 9px;
  padding: 8px 12px;
  background: var(--brand);
  color: white;
  font-weight: 800;
}

.custom-entry-card,
.complete-card {
  padding: 34px;
}

.custom-entry-card h2,
.complete-card h2 {
  margin: 0 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 500;
}

.custom-entry-card > p:not(.eyebrow),
.complete-card p {
  color: var(--muted);
}

.complete-card > span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 900;
}

.custom-milestone-form {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(160px, 0.7fr) auto;
  align-items: end;
  gap: 10px;
  margin-top: 18px;
}

.custom-milestone-form input {
  min-height: 44px;
}

/* Reveal gate */

.reveal-gate-shell {
  min-height: 100vh;
}

.reveal-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 180px);
  padding-bottom: 70px;
  text-align: center;
}

.reveal-gate h1 {
  max-width: 780px;
  margin-bottom: 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 7vw, 6rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.reveal-gate > p:not(.eyebrow) {
  max-width: 640px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.reveal-button {
  min-width: 240px;
  margin-bottom: 8px;
}

.reveal-orbit {
  position: relative;
  width: 88px;
  height: 88px;
  margin-bottom: 26px;
}

.reveal-orbit span {
  position: absolute;
  inset: 0;
  border: 1px solid var(--brand);
  border-radius: 50%;
}

.reveal-orbit span:nth-child(2) {
  transform: rotate(60deg) scaleX(0.45);
}

.reveal-orbit span:nth-child(3) {
  transform: rotate(-60deg) scaleX(0.45);
}

/* Results */

.results-hero,
.result-chart-heading,
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
}

.results-hero {
  margin: 20px 0 28px;
}

.results-hero h1 {
  margin-bottom: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 7vw, 6.4rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.94;
}

.results-hero p:not(.eyebrow) {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.result-chart-card,
.audit-card,
.result-actions-card,
.shared-chart {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--small-shadow);
}

.result-chart-card {
  overflow: hidden;
}

.result-chart-heading {
  padding: 22px 24px 0;
}

.result-chart-heading h2,
.section-heading h2,
.audit-card h2,
.result-actions-card h2 {
  margin-bottom: 4px;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
}

.result-chart-heading p,
.audit-card p,
.result-actions-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.selected-total {
  color: var(--brand-deep);
  font-size: clamp(1.3rem, 2.5vw, 2.1rem);
  font-weight: 900;
  white-space: nowrap;
}

.result-chart {
  width: 100%;
  padding: 8px 18px 0;
}

.result-chart svg,
.shared-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.result-chart-bg {
  fill: #fffefa;
}

.result-grid {
  stroke: #e6e9e3;
  stroke-width: 1;
}

.result-grid.vertical {
  stroke-dasharray: 3 5;
}

.result-axis-label,
.result-axis-title {
  fill: #68756f;
  font-size: 10px;
  font-weight: 650;
}

.result-axis-label.x {
  font-size: 10px;
}

.curve-line-shadow,
.curve-line {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.curve-line-shadow {
  stroke: #d5e9e2;
  stroke-width: 10;
}

.curve-line {
  stroke: var(--brand);
  stroke-width: 4;
}

.curve-point {
  fill: #fff;
  stroke: var(--brand);
  stroke-width: 2;
  cursor: pointer;
}

.curve-target {
  cursor: pointer;
}

.curve-hit {
  fill: transparent;
  pointer-events: all;
}

.curve-point.milestone {
  fill: var(--brand-soft);
}

.curve-point.selected {
  fill: var(--brand);
  stroke: #fff;
  stroke-width: 3;
  filter: drop-shadow(0 2px 5px rgba(15, 118, 110, 0.4));
}

.boundary-line {
  stroke: #a2762d;
  stroke-width: 2;
  stroke-dasharray: 6 5;
}

.selected-interval {
  position: relative;
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  min-height: 88px;
  border-top: 1px solid var(--line);
  padding: 16px 24px 20px;
  background: #fbfaf6;
}

.result-detail-close {
  display: none;
}

.selected-point-summary span,
.selected-point-summary strong,
.selected-point-summary small {
  display: block;
}

.selected-point-summary span {
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
  text-transform: uppercase;
}

.selected-point-summary strong {
  margin: 2px 0;
  font-size: 1.45rem;
}

.selected-point-summary small {
  color: var(--muted);
}

.interval-milestones {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.interval-milestones button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 9px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.interval-milestones span,
.interval-milestones small {
  color: var(--muted);
  font-size: 0.66rem;
}

.interval-milestones strong {
  font-size: 0.72rem;
}

.interval-milestones p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.horizon-section,
.breakdown-section {
  margin-top: 30px;
}

.section-heading {
  margin-bottom: 13px;
}

.section-heading h2 {
  margin: 0;
}

.section-heading > span {
  color: var(--brand-deep);
  font-size: 1.2rem;
  font-weight: 900;
}

.horizon-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.horizon-card {
  display: grid;
  gap: 5px;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.horizon-card:hover {
  border-color: var(--brand);
}

.horizon-card span,
.horizon-card small {
  color: var(--muted);
  font-size: 0.7rem;
}

.horizon-card strong {
  align-self: center;
  font-size: clamp(0.9rem, 1.7vw, 1.25rem);
}

.horizon-card.beyond {
  opacity: 0.65;
  background: #efeee9;
}

.category-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.category-breakdown article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 13px;
  background: var(--surface);
}

.category-swatch {
  width: 10px;
  height: 30px;
  border-radius: 999px;
  background: var(--category);
}

.category-breakdown p {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.category-breakdown strong {
  font-size: 0.83rem;
  white-space: nowrap;
}

.audit-card,
.result-actions-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-top: 30px;
  padding: 22px 24px;
}

.audit-actions,
.result-actions-card > div:nth-child(2),
.dialog-actions {
  display: flex;
  gap: 8px;
}

.audit-actions button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 12px;
  background: #fff;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 800;
}

.audit-actions button[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.add-custom-details {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.add-custom-details summary {
  cursor: pointer;
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 850;
}

/* Share preview and dialog */

.shared-hero {
  max-width: 760px;
  margin: 70px auto 28px;
  text-align: center;
}

.shared-hero h1 {
  margin-bottom: 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 7vw, 5.7rem);
  font-weight: 500;
  letter-spacing: -0.05em;
}

.shared-hero p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.6;
}

.share-preview-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.share-preview-card > div {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #f8f8f4;
}

.share-preview-card span {
  color: var(--muted);
  font-size: 0.68rem;
}

.share-preview-card strong {
  font-size: 1.1rem;
}

.shared-shell > .share-preview-card {
  max-width: 620px;
  margin: 0 auto 18px;
}

.shared-chart {
  max-width: 900px;
  margin: 0 auto 20px;
  padding: 18px;
}

.shared-shell > .category-breakdown {
  max-width: 900px;
  margin: 0 auto;
}

.shared-actions {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-top: 24px;
}

.app-dialog {
  width: min(560px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  border: 0;
  border-radius: 18px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.app-dialog::backdrop {
  background: rgba(18, 31, 27, 0.56);
  backdrop-filter: blur(4px);
}

.dialog-card {
  position: relative;
  overflow-y: auto;
  max-height: calc(100vh - 28px);
  border-radius: 18px;
  padding: 28px;
  background: var(--surface);
}

.dialog-card h2 {
  margin-bottom: 9px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 5vw, 2.7rem);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.dialog-card > p:not(.eyebrow),
.disclosure-list,
.not-shared {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.dialog-close {
  position: absolute;
  top: 13px;
  right: 13px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #f0f1ed;
  color: var(--muted);
  font-size: 1.3rem;
}

.disclosure-list {
  display: grid;
  gap: 5px;
  padding-left: 22px;
}

.not-shared {
  border-left: 3px solid var(--brand);
  padding-left: 12px;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 22px;
}

.fatal-error {
  width: min(760px, calc(100% - 32px));
  margin: 80px auto;
  border: 1px solid #e4bdb9;
  border-radius: 14px;
  padding: 24px;
  background: #fff7f6;
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 28px, 760px);
  }

  .onboarding-grid {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .onboarding-copy {
    padding-top: 30px;
  }

  .valuation-layout {
    grid-template-columns: 1fr;
  }

  .valuation-aside {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    position: static;
  }

  .beyond-card {
    grid-column: 1 / -1;
  }

  .horizon-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .category-breakdown {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 600px);
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(40px, env(safe-area-inset-bottom));
  }

  .app-header {
    min-height: 42px;
    margin-bottom: 24px;
  }

  .wordmark {
    min-height: 44px;
    font-size: 0.78rem;
  }

  .wordmark-mark {
    width: 29px;
    height: 29px;
  }

  .local-badge {
    display: none;
  }

  .header-actions {
    gap: 0;
  }

  .header-actions .text-button {
    min-height: 44px;
    padding: 7px 9px;
    font-size: 0.75rem;
  }

  .onboarding-grid {
    gap: 34px;
    padding-bottom: 30px;
  }

  .onboarding-copy h1 {
    font-size: clamp(3.05rem, 16vw, 4.8rem);
  }

  .scope-picker {
    grid-template-columns: 1fr;
  }

  .scope-picker p {
    grid-column: auto;
  }

  .start-button {
    width: 100%;
  }

  .contract-card {
    border-radius: 16px;
  }

  .embed-card {
    grid-template-columns: 1fr;
    gap: 14px;
    min-height: 0;
    padding: 20px;
  }

  .embed-icon {
    width: 46px;
    height: 46px;
  }

  .embed-card .primary-button {
    width: 100%;
  }

  .progress-header {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .progress-header h1 {
    font-size: 1.7rem;
  }

  .category-nav {
    width: 100%;
  }

  .category-heading {
    display: block;
  }

  .category-heading .category-dot {
    margin-bottom: 5px;
  }

  .milestone-card {
    border-radius: 14px;
  }

  .milestone-card-topline {
    padding: 19px 18px 0;
  }

  .milestone-card > h2,
  .milestone-card > .milestone-description,
  .change-grid,
  .thinking-cue,
  .help-link {
    margin-left: 18px;
    margin-right: 18px;
  }

  .milestone-card > h2 {
    font-size: clamp(2.15rem, 12vw, 3.1rem);
  }

  .change-grid {
    grid-template-columns: 1fr;
  }

  .price-panel {
    position: sticky;
    bottom: 0;
    z-index: 3;
    padding: 16px 14px max(18px, env(safe-area-inset-bottom));
    box-shadow: 0 -12px 28px rgba(21, 35, 31, 0.06);
  }

  .price-heading > span {
    display: none;
  }

  .tier-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tier-button {
    min-height: 48px;
  }

  .inline-value-form,
  .note-form {
    grid-template-columns: 1fr;
  }

  .note-form button {
    min-height: 44px;
  }

  .valuation-aside {
    grid-template-columns: 1fr;
  }

  .beyond-card {
    grid-column: auto;
  }

  .saved-coach {
    grid-template-columns: 1fr;
  }

  .chip-list {
    justify-content: start;
  }

  .chip-list button {
    min-height: 44px;
    padding-inline: 12px;
  }

  .secondary-link,
  .category-nav button,
  .queue-list button,
  .calibration-list button,
  .audit-actions button {
    min-height: 44px;
  }

  .custom-milestone-form {
    grid-template-columns: 1fr;
  }

  .reveal-gate {
    justify-content: start;
    padding-top: 60px;
  }

  .reveal-gate h1 {
    font-size: clamp(3.2rem, 16vw, 4.6rem);
  }

  .results-hero,
  .result-chart-heading,
  .section-heading,
  .audit-card,
  .result-actions-card {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .results-hero h1 {
    font-size: clamp(3.4rem, 17vw, 5rem);
  }

  .results-hero .secondary-button {
    justify-self: start;
  }

  .result-chart-heading {
    gap: 8px;
    padding: 18px 16px 0;
  }

  .result-chart {
    padding: 6px 4px 0;
  }

  .selected-interval {
    display: none;
  }

  .selected-interval.is-open {
    position: fixed;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 20px 16px 18px;
    background: var(--surface);
    box-shadow: 0 18px 70px rgba(14, 30, 25, 0.28);
  }

  .result-detail-close {
    position: absolute;
    top: 8px;
    right: 8px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: #eef0eb;
    color: var(--muted);
    font-size: 1.2rem;
  }

  .interval-milestones {
    display: grid;
  }

  .horizon-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-breakdown {
    grid-template-columns: 1fr;
  }

  .audit-actions,
  .result-actions-card > div:nth-child(2) {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .result-actions-card > div:nth-child(2) {
    grid-template-columns: 1fr;
  }

  .shared-actions,
  .dialog-actions,
  .stacked-mobile {
    display: grid;
    grid-template-columns: 1fr;
  }

  .dialog-card {
    padding: 24px 18px;
  }

  .shared-hero {
    margin-top: 36px;
  }

  .shared-hero h1 {
    font-size: 3.1rem;
  }
}

@media (max-width: 380px) {
  .app-shell {
    width: min(100% - 14px, 366px);
  }

  .wordmark span:last-child {
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .milestone-card-topline,
  .milestone-card > h2,
  .milestone-card > .milestone-description,
  .change-grid,
  .thinking-cue,
  .help-link {
    margin-left: 14px;
    margin-right: 14px;
  }

  .milestone-card-topline {
    padding-left: 14px;
    padding-right: 14px;
  }

  .tier-button {
    padding-inline: 4px;
    font-size: 0.78rem;
  }
}

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