:root {
  --ink: #18202a;
  --muted: #66717f;
  --line: #d9dee5;
  --panel: #ffffff;
  --page: #f4f6f8;
  --red: #b92830;
  --red-dark: #831d24;
  --navy: #1e335a;
  --navy-2: #1e335a;
  --navy-3: #24507e;
  --green: #0f7b5f;
  --gold: #b47b16;
  --blue: #315f8f;
  --soft-red: #fff2f3;
  --soft-green: #eef9f5;
  --shadow: 0 18px 50px rgba(24, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

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

.tools-app {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(244, 246, 248, 0) 220px),
    var(--page);
}

.tools-header {
  overflow: hidden;
  border: 1px solid #dfe3e8;
  border-top: 0;
  border-radius: 0 0 18px 18px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(24, 32, 42, 0.06);
}

.tools-title-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(190px, 22vw, 330px);
  gap: clamp(24px, 5vw, 72px);
  align-items: center;
  padding: 32px clamp(24px, 4vw, 42px) 34px;
  color: #ffffff;
  background: var(--navy);
}

.tools-title-copy {
  min-width: 0;
}

.tools-title-copy p {
  margin: 0 0 10px;
  color: #9ecbff;
  font-size: clamp(0.6624rem, 1.152vw, 1.044rem);
  font-weight: 850;
  letter-spacing: 0.07em;
  line-height: 1;
  text-transform: uppercase;
}

.tools-title-copy h1 {
  max-width: 1040px;
  margin: 0 0 12px;
  color: #f0aa3c;
  font-size: clamp(1.512rem, 2.88vw, 3.06rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.tools-title-copy span {
  display: block;
  max-width: 1120px;
  color: rgba(229, 234, 251, 0.78);
  font-size: clamp(0.7776rem, 1.44vw, 1.296rem);
  font-weight: 700;
  line-height: 1.24;
}

.tools-header-logo {
  display: block;
  width: 100%;
  height: auto;
  justify-self: end;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(2.1rem, 4vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 720px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.04rem;
  line-height: 1.5;
}

.tool-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: #ffffff;
}

.tool-tab {
  display: grid;
  min-width: 0;
  min-height: 84px;
  place-items: center;
  align-content: center;
  gap: 9.5px;
  border-right: 1px solid #e2e4e8;
  border-bottom: 4px solid transparent;
  color: #4d4d4a;
  font-size: clamp(0.777rem, 0.987vw, 0.945rem);
  font-weight: 780;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.tool-tab:last-child {
  border-right: 0;
}

.tool-tab:hover {
  background: #f5f8fb;
}

.tool-tab.active {
  color: #174f92;
  border-bottom-color: #8ebced;
  background: #e8f3ff;
}

.tool-tab svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.15;
}

.tool-tab span {
  display: block;
  white-space: nowrap;
}

.tool-view[hidden] {
  display: none;
}

.nav-report-button {
  margin-left: auto;
  min-height: 38px;
  color: #ffffff;
  border-color: var(--navy);
  background: var(--navy);
}

.nav-report-button:hover {
  background: var(--navy-3);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.summary-strip article {
  padding: 18px clamp(16px, 3vw, 28px);
  background: #ffffff;
}

span {
  color: var(--muted);
}

.summary-strip span,
.pace-grid span,
.investment-grid span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

strong {
  display: block;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px clamp(14px, 3vw, 28px) 30px;
  align-items: stretch;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.input-panel {
  align-self: stretch;
  padding: 16px;
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 0;
}

.input-panel .panel-heading {
  padding: 0;
  align-items: center;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.12rem;
}

.featured-heading h2 {
  font-size: 1.28rem;
}

.featured-heading .buy-remaining-title {
  font-size: calc(1.28rem + 4pt);
  margin-bottom: 10px;
}

h3 {
  margin: 16px 0 8px;
  font-size: 0.88rem;
  text-transform: uppercase;
  color: #485260;
}

.panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.ghost-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--navy-2);
  background: #ffffff;
  font-weight: 800;
}

.icon-button {
  width: 34px;
  min-width: 34px;
  padding: 0;
  justify-content: center;
  font-size: 0.92rem;
  line-height: 1;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.copy-status {
  min-height: 0;
  margin: 4px 18px 0;
  color: var(--green);
  font-size: 0.902rem;
  font-weight: 800;
  text-align: right;
}

.report-output {
  display: none;
  width: calc(100% - 36px);
  min-height: 170px;
  margin: 10px 18px 0;
  border: 1px solid #cbd2da;
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  font: 0.82rem/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  resize: vertical;
  white-space: pre;
}

.report-output.visible {
  display: block;
}

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

label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.15;
}

input {
  width: 100%;
  min-height: 34px;
  border: 1px solid #cbd2da;
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--ink);
  background: #ffffff;
}

input:focus {
  outline: 3px solid rgba(49, 95, 143, 0.18);
  border-color: var(--blue);
}

.toggle-field {
  align-content: end;
}

.toggle-field input {
  width: 22px;
  min-height: 22px;
  margin: 6px 0;
  accent-color: var(--navy);
}

.percent-field {
  position: relative;
}

.percent-field input {
  padding-right: 30px;
}

.percent-field::after {
  content: "%";
  position: absolute;
  right: 11px;
  bottom: 9px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
  pointer-events: none;
}

.hh-gauge {
  margin-top: 16px;
  border: 1px solid rgba(30, 51, 90, 0.16);
  border-radius: 8px;
  padding: 18px 16px;
  background: #ffffff;
}

.hh-gauge-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.hh-gauge-heading h3 {
  margin: 0;
}

.hh-gauge-heading strong {
  font-size: 1.42rem;
  text-align: right;
}

.hh-bars {
  display: grid;
  gap: 15px;
}

.hh-bar-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 72px;
  gap: 12px;
  align-items: center;
}

.hh-bar-row span,
.hh-bar-row b {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hh-bar-row b {
  color: var(--ink);
  text-align: right;
}

.hh-track {
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf2;
}

.hh-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 160ms ease;
}

.hh-bar-row:last-child .hh-track i {
  background: var(--gold);
}

.hh-bar-row:last-child .hh-track i.danger-fill {
  background: var(--red);
}

.economics-card {
  margin-top: 16px;
  border: 1px solid rgba(30, 51, 90, 0.16);
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(180deg, #fbfcfd, #f4f8fb);
}

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

.economics-heading h3 {
  margin: 0;
}

.economics-heading strong {
  color: var(--navy);
  font-size: 1.5rem;
  text-align: right;
}

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

.economics-grid article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.economics-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.economics-grid strong {
  font-size: 1.2rem;
}

.clv-card {
  padding: 16px;
  background: linear-gradient(180deg, #ffffff, #f5f9fb);
}

.clv-heading {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 14px;
}

.clv-heading strong {
  font-size: 1.9rem;
  line-height: 1.05;
  text-align: left;
}

.clv-grid {
  gap: 8px;
}

.clv-grid article {
  display: grid;
  align-content: center;
  min-height: 74px;
  padding: 10px 12px;
}

.clv-grid span {
  margin-bottom: 6px;
  font-size: 0.68rem;
}

.clv-grid strong {
  display: block;
  font-size: 1.05rem;
  line-height: 1.2;
}

.target-table {
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 0.8fr;
  gap: 6px;
  align-items: end;
}

.target-table label {
  min-height: 34px;
  align-items: center;
}

.table-head {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.results {
  display: grid;
  gap: 20px;
}

.tool-validation-summary {
  grid-column: 1 / -1;
  border: 1px solid rgba(185, 40, 48, 0.36);
  border-left: 6px solid var(--red);
  border-radius: 10px;
  padding: 15px 18px;
  color: #751d24;
  background: #fff4f4;
  box-shadow: 0 10px 24px rgba(117, 29, 36, 0.08);
}

.tool-validation-summary[hidden] {
  display: none;
}

.tool-validation-summary strong {
  display: block;
  margin-bottom: 4px;
  color: #751d24;
  font-size: 1rem;
}

.tool-validation-summary p {
  margin: 0;
  line-height: 1.45;
}

.tool-validation-summary ul {
  display: grid;
  gap: 5px;
  margin: 10px 0 0;
  padding-left: 22px;
}

.tool-validation-summary a {
  color: #751d24;
  font-weight: 800;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.tool-field-error {
  display: block;
  margin-top: -2px;
  color: #a3222b;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
  text-transform: none;
}

.cashflow-expense-row > .tool-field-error {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0 8px 7px;
  text-align: left;
}

.team-production-grid label > .tool-field-error {
  margin-top: 6px;
}

input.is-input-invalid,
select.is-input-invalid {
  border-color: #b92830 !important;
  background: #fff7f7 !important;
  box-shadow: 0 0 0 3px rgba(185, 40, 48, 0.12) !important;
}

[data-validation-results] {
  transition: opacity 160ms ease, filter 160ms ease;
}

.tool-view.has-validation-errors [data-validation-results] {
  opacity: 0.42;
  filter: grayscale(0.4);
}

button[data-validation-download]:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.placeholder-page {
  padding: 20px clamp(14px, 3vw, 28px) 32px;
}

.placeholder-panel {
  max-width: 880px;
  padding: 26px;
}

.placeholder-panel h2 {
  margin-top: 14px;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
}

.placeholder-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.gain-shell {
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px clamp(14px, 3vw, 28px) 30px;
  align-items: start;
}

.gain-results {
  display: grid;
  gap: 18px;
}

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

.gain-date-card > div,
.gain-date-card > label {
  min-width: 0;
  border: 1px solid rgba(30, 51, 90, 0.16);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.gain-date-card > div {
  display: grid;
  align-content: center;
}

.gain-date-card > label {
  align-content: start;
}

.gain-date-card > label input {
  min-width: 0;
}

.gain-date-card span,
.gain-hero span,
.gain-track-card span,
.scenario-row span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.gain-date-card strong {
  color: var(--navy);
  font-size: 1.35rem;
}

.gain-toggle-field {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.gain-toggle-field span {
  align-self: center;
}

.gain-toggle-field input {
  justify-self: start;
}

.gain-hero {
  display: grid;
  grid-template-columns: minmax(260px, 0.95fr) minmax(0, 1.35fr);
  gap: 16px;
  padding: 18px;
  background:
    linear-gradient(120deg, rgba(15, 123, 95, 0.1), rgba(255, 255, 255, 0) 48%),
    #ffffff;
}

.gain-hero > div:first-child {
  display: grid;
  align-content: center;
}

.gain-hero > div:first-child strong {
  color: var(--navy);
  font-size: clamp(3.2rem, 7vw, 6.5rem);
  line-height: 0.92;
}

.gain-hero p {
  max-width: 540px;
  margin: 10px 0 0;
  color: #46515f;
  font-size: 1rem;
  line-height: 1.45;
}

.gain-hero-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.gain-hero-metrics article {
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.gain-hero-metrics strong {
  font-size: clamp(1.35rem, 2.2vw, 2rem);
}

.gain-track-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.gain-track-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  min-width: 0;
}

.gain-track-card.disabled {
  opacity: 0.56;
}

.gain-track-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.gain-track-head h2 {
  margin: 0;
  font-size: 1.22rem;
}

.gain-track-head strong {
  color: var(--green);
  font-size: 2rem;
  text-align: right;
}

.gain-meter {
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf2;
}

.gain-meter i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--green));
  transition: width 160ms ease;
}

.gain-meter i.behind {
  background: linear-gradient(90deg, var(--red), var(--gold));
}

.gain-meter i.complete {
  background: var(--green);
}

.gain-track-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.gain-track-stats > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.gain-track-stats strong {
  font-size: 1.18rem;
}

.scenario-panel .panel-heading {
  padding-bottom: 0;
}

.scenario-list {
  display: grid;
  gap: 10px;
  padding: 16px 18px 10px;
}

.scenario-row {
  display: grid;
  grid-template-columns: 1fr 1fr 0.65fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.scenario-row strong {
  font-size: 1.22rem;
}

.gain-footnote,
.gain-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.gain-footnote {
  padding: 0 18px 18px;
}

.gain-empty {
  padding: 4px 0;
}

.gain-shell {
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 24px;
  padding-top: 18px;
}

.gain-input-panel {
  display: grid;
  gap: 16px;
  align-content: start;
  padding: 22px;
}

.gain-panel-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.gain-panel-title h2 {
  margin: 5px 0 0;
  font-size: 1.3rem;
}

.gain-section-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.gain-section-kicker::before {
  content: "";
  width: 16px;
  height: 2px;
  background: var(--red);
}

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

.gain-toggle button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--navy);
  background: #ffffff;
  font-weight: 900;
}

.gain-toggle button.active {
  color: #ffffff;
  border-color: var(--navy);
  background: var(--navy);
}

.gain-date-card.compact {
  margin-top: 0;
}

.gain-input-panel label {
  gap: 8px;
}

.gain-input-panel label > span b {
  color: inherit;
}

.gain-input-panel input {
  min-height: 46px;
  font-size: 1.02rem;
  font-weight: 800;
}

.gain-input-note {
  margin: 2px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.gain-results {
  gap: 24px;
}

.gain-pace-card {
  padding: 28px;
  background: #ffffff;
}

.gain-pace-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: baseline;
  margin-bottom: 10px;
}

.gain-pace-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: calc(1.28rem + 4pt);
}

.gain-pace-head strong {
  color: var(--muted);
  font-size: 0.92rem;
  text-align: right;
}

.gain-pace-card p {
  max-width: 800px;
  margin: 0 0 22px;
  color: #46515f;
  font-size: 1rem;
  line-height: 1.48;
}

.gain-progress {
  position: relative;
  height: 46px;
  overflow: hidden;
  border-radius: 8px;
  background: #dfe8ef;
}

.gain-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5fd7a4, var(--green));
  transition: width 160ms ease;
}

.gain-progress i.behind {
  background: linear-gradient(90deg, var(--gold), var(--red));
}

.gain-progress b {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: 0;
  border-left: 3px dashed rgba(6, 28, 24, 0.62);
  transform: translateX(-50%);
}

.gain-progress span {
  position: absolute;
  left: 16px;
  top: 50%;
  z-index: 3;
  transform: translateY(-50%);
  color: #061c18;
  font-size: 0.92rem;
  font-weight: 900;
}

.gain-progress-labels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.gain-progress-labels span:nth-child(2) {
  color: var(--gold);
  font-weight: 900;
  text-align: center;
}

.gain-progress-labels span:nth-child(2) b {
  color: inherit;
}

.gain-progress-labels span:last-child {
  text-align: right;
}

.gain-progress-labels b {
  color: var(--ink);
}

.gain-stat-strip {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.gain-stat-strip article {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 18px;
}

.gain-stat-strip article:last-child {
  border-right: 0;
}

.gain-stat-strip span,
.scenario-head span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.gain-stat-strip strong {
  color: var(--navy);
  font-size: clamp(1.45rem, 2.4vw, 2.05rem);
}

.gain-stat-strip article:nth-child(3) strong,
.gain-stat-strip article:nth-child(4) strong {
  color: var(--red);
}

.gain-stat-strip p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.gain-math-card {
  position: relative;
  cursor: help;
  outline: none;
}

.gain-math-card::after {
  position: absolute;
  top: 9px;
  right: 10px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(30, 51, 90, 0.18);
  border-radius: 50%;
  color: var(--navy);
  background: #ffffff;
  content: "?";
  font-size: 0.63rem;
  font-weight: 900;
  line-height: 1;
  text-transform: lowercase;
}

.gain-math-card > span:first-child {
  padding-right: 28px;
}

.gain-math-card:hover,
.gain-math-card:focus-visible,
.gain-math-card.is-math-open {
  z-index: 80;
  border-color: rgba(240, 170, 60, 0.72);
  box-shadow: 0 10px 28px rgba(30, 51, 90, 0.15);
}

.gain-math-card:focus-visible {
  outline: 3px solid rgba(240, 170, 60, 0.28);
  outline-offset: 2px;
}

.gain-math-popover {
  position: absolute;
  z-index: 90;
  left: 50%;
  bottom: calc(100% + 12px);
  width: min(320px, calc(100vw - 32px));
  padding: 15px 16px;
  visibility: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #ffffff;
  background: var(--navy);
  box-shadow: 0 20px 45px rgba(14, 43, 69, 0.28);
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translate(-50%, 7px);
  transition: opacity 150ms ease, transform 150ms ease, visibility 150ms ease;
}

.gain-math-card:hover .gain-math-popover,
.gain-math-card:focus-visible .gain-math-popover,
.gain-math-card.is-math-open .gain-math-popover {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, 0);
}

.gain-stat-strip .gain-math-card:first-child .gain-math-popover {
  left: 0;
  transform: translateY(7px);
}

.gain-stat-strip .gain-math-card:first-child:hover .gain-math-popover,
.gain-stat-strip .gain-math-card:first-child:focus-visible .gain-math-popover,
.gain-stat-strip .gain-math-card:first-child.is-math-open .gain-math-popover {
  transform: translateY(0);
}

.gain-stat-strip .gain-math-card:last-child .gain-math-popover,
.gain-slider-results .gain-math-card:last-child .gain-math-popover {
  right: 0;
  left: auto;
  transform: translateY(7px);
}

.gain-stat-strip .gain-math-card:last-child:hover .gain-math-popover,
.gain-stat-strip .gain-math-card:last-child:focus-visible .gain-math-popover,
.gain-stat-strip .gain-math-card:last-child.is-math-open .gain-math-popover,
.gain-slider-results .gain-math-card:last-child:hover .gain-math-popover,
.gain-slider-results .gain-math-card:last-child:focus-visible .gain-math-popover,
.gain-slider-results .gain-math-card:last-child.is-math-open .gain-math-popover {
  transform: translateY(0);
}

.gain-math-popover strong,
.gain-stat-strip .gain-math-popover strong,
.gain-slider-results .gain-math-popover strong {
  display: block;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 0 7px !important;
  padding: 0 !important;
  color: var(--gold) !important;
  background: transparent !important;
  font-size: 0.78rem !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  line-height: 1.2 !important;
  overflow: visible !important;
  text-align: left !important;
  text-transform: uppercase !important;
}

.gain-math-popover code {
  display: block;
  margin: 0 0 9px;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.42;
  white-space: normal;
}

.gain-math-popover span,
.gain-stat-strip .gain-math-popover span,
.gain-slider-results .gain-math-popover span {
  display: block;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  color: #dce7f3 !important;
  background: transparent !important;
  font-size: 0.82rem !important;
  font-weight: 500 !important;
  line-height: 1.45 !important;
  white-space: normal !important;
  text-align: left !important;
  text-transform: none !important;
}

.gain-math-popover em {
  display: block;
  margin-top: 8px;
  color: #9fb7cf;
  font-size: 0.74rem;
  font-style: normal;
  line-height: 1.4;
}

.simple-scenario-panel {
  padding: 0;
}

.simple-scenario-panel .panel-heading {
  align-items: end;
  padding: 24px 28px 0;
}

.simple-scenario-panel .panel-heading p {
  font-size: 1rem;
  line-height: 1.48;
}

.simple-scenario-panel .panel-heading > span {
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.scenario-table {
  display: grid;
  padding: 18px 28px 12px;
}

.gain-slider-card {
  display: grid;
  gap: 18px;
  padding: 20px 28px 14px;
}

.gain-slider-top,
.gain-slider-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.gain-slider-top > div,
.gain-slider-results article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.gain-slider-top span,
.gain-slider-results span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.gain-slider-top strong,
.gain-slider-results strong {
  color: var(--navy);
  font-size: clamp(1.22rem, 2vw, 1.75rem);
}

.gain-slider-results #g-slider-comp.danger {
  color: var(--red);
}

.gain-slider-results article.is-profit-positive {
  border-color: rgba(15, 123, 95, 0.34);
  background:
    linear-gradient(135deg, rgba(44, 216, 154, 0.2), rgba(15, 123, 95, 0.08)),
    #edfff8;
  box-shadow: 0 18px 34px rgba(15, 123, 95, 0.2);
}

.gain-slider-results article.is-profit-positive span,
.gain-slider-results article.is-profit-positive strong {
  color: var(--green);
}

.gain-slider-results {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.gain-slider-card input[type="range"] {
  --slider-color: var(--red);
  --slider-fill: 0%;
  appearance: none;
  width: 100%;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.gain-slider-card input[type="range"].is-red {
  --slider-color: var(--red);
}

.gain-slider-card input[type="range"].is-gold {
  --slider-color: var(--gold);
}

.gain-slider-card input[type="range"].is-green {
  --slider-color: var(--green);
}

.gain-slider-card input[type="range"]::-webkit-slider-runnable-track {
  height: 12px;
  border: 1px solid rgba(14, 43, 69, 0.12);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--slider-color) 0 var(--slider-fill), #e4ebf2 var(--slider-fill) 100%);
}

.gain-slider-card input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -7px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--slider-color);
  box-shadow: 0 10px 20px rgba(14, 43, 69, 0.18);
}

.gain-slider-card input[type="range"]::-moz-range-track {
  height: 12px;
  border: 1px solid rgba(14, 43, 69, 0.12);
  border-radius: 999px;
  background: #e4ebf2;
}

.gain-slider-card input[type="range"]::-moz-range-progress {
  height: 12px;
  border-radius: 999px;
  background: var(--slider-color);
}

.gain-slider-card input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--slider-color);
  box-shadow: 0 10px 20px rgba(14, 43, 69, 0.18);
}

.gain-slider-labels {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-height: 20px;
  margin-top: -12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  align-items: start;
}

.gain-slider-labels span {
  white-space: nowrap;
}

.gain-slider-labels > span:first-child {
  justify-self: start;
}

.gain-slider-labels > span:last-child {
  justify-self: end;
}

#g-current-pace-label {
  position: absolute;
  top: -1px;
  transform: translateX(-50%);
  max-width: min(190px, 46vw);
  overflow: hidden;
  border: 1px solid rgba(180, 123, 22, 0.28);
  border-radius: 999px;
  padding: 5px 9px;
  background: #fffaf0;
  color: var(--gold);
  text-align: center;
  text-overflow: ellipsis;
}

#g-current-pace-label.is-capped {
  border-color: rgba(15, 123, 95, 0.28);
  background: #eef9f5;
  color: var(--green);
}

.scenario-head,
.scenario-row {
  display: grid;
  grid-template-columns: 1.15fr 0.9fr 1fr 1fr 0.55fr;
  gap: 14px;
  align-items: center;
}

.scenario-head {
  border-bottom: 1px solid var(--line);
  padding: 0 12px 10px;
}

.scenario-head span {
  margin: 0;
  font-size: 0.7rem;
}

.scenario-row {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 15px 12px;
  background: transparent;
}

.scenario-row-focus {
  border-bottom: 0;
  border-radius: 6px;
  background: #f3f5f8;
}

.scenario-row strong,
.scenario-row b {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.2;
}

.scenario-row strong {
  font-weight: 900;
}

.scenario-row-focus strong {
  color: var(--red);
}

.simple-scenario-panel .gain-footnote {
  margin: 0 28px 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 14px 16px;
  background: #fbfcfd;
}

.gain-takeaway {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.9fr);
  gap: 20px;
  align-items: center;
  padding: 24px 28px;
}

.gain-takeaway h2 {
  margin-bottom: 8px;
  font-size: 1.25rem;
}

.gain-takeaway p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.gain-takeaway-actions {
  display: grid;
  gap: 10px;
}

.gain-takeaway-actions input {
  min-height: 46px;
}

.gain-takeaway-actions button {
  min-height: 44px;
  color: #ffffff;
  border-color: var(--red);
  background: var(--red);
}

.gain-takeaway-actions .copy-status {
  min-height: 18px;
  font-size: 0.82rem;
}

.gain-hidden {
  display: none;
}

.team-shell {
  display: grid;
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
  gap: 24px;
  padding: 18px clamp(14px, 3vw, 28px) 30px;
  align-items: start;
}

.team-input-panel {
  display: grid;
  gap: 16px;
  align-content: start;
  padding: 22px;
}

.team-input-panel input {
  min-height: 44px;
  font-weight: 800;
}

.team-input-group {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.team-input-group h3 {
  margin: 0;
}

.team-mini-ledger {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.team-mini-ledger article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.team-mini-ledger span,
.team-stat-grid span,
.team-hero-card span,
.team-roi-head span,
.team-bar-row span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.team-mini-ledger strong {
  color: var(--navy);
  font-size: 1.08rem;
}

.team-results {
  display: grid;
  gap: 18px;
}

.team-hero-card {
  display: grid;
  grid-template-columns: minmax(190px, 0.82fr) minmax(0, 2.35fr);
  gap: 18px;
  align-items: stretch;
  border-radius: 12px;
  border-left: 9px solid var(--navy);
  border-right: 9px solid var(--navy);
  padding: 20px 24px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 18px 34px rgba(14, 43, 69, 0.1);
}

.team-hero-message {
  display: grid;
  align-content: start;
  gap: 14px;
  padding-top: 3px;
}

.team-hero-message > span {
  color: var(--gold);
  font-size: clamp(0.78rem, 0.95vw, 0.98rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.team-hero-card h2 {
  max-width: 260px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(calc(1.36rem - 4pt), calc(2.05vw - 4pt), calc(1.95rem - 4pt));
  font-weight: 400;
  line-height: 1.18;
}

.team-hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
}

.team-hero-metrics article {
  display: grid;
  min-height: 78px;
  align-content: start;
  justify-items: center;
  gap: 9px;
  padding: 0 clamp(12px, 1.65vw, 26px);
  text-align: center;
}

.team-hero-metrics .gain-math-card {
  padding-right: clamp(34px, 2.5vw, 42px);
}

.team-hero-metrics .gain-math-card::after {
  top: -2px;
  right: 8px;
}

.team-hero-metrics .gain-math-card:first-child .gain-math-popover,
.team-stat-grid .gain-math-card:first-child .gain-math-popover {
  left: 0;
  transform: translateY(7px);
}

.team-hero-metrics .gain-math-card:first-child:hover .gain-math-popover,
.team-hero-metrics .gain-math-card:first-child:focus-visible .gain-math-popover,
.team-hero-metrics .gain-math-card:first-child.is-math-open .gain-math-popover,
.team-stat-grid .gain-math-card:first-child:hover .gain-math-popover,
.team-stat-grid .gain-math-card:first-child:focus-visible .gain-math-popover,
.team-stat-grid .gain-math-card:first-child.is-math-open .gain-math-popover {
  transform: translateY(0);
}

.team-hero-metrics .gain-math-card:last-child .gain-math-popover,
.team-stat-grid .gain-math-card:last-child .gain-math-popover,
.team-production-total .gain-math-popover,
.team-roi-math-heading .gain-math-popover {
  right: 0;
  left: auto;
  transform: translateY(7px);
}

.team-hero-metrics .gain-math-card:last-child:hover .gain-math-popover,
.team-hero-metrics .gain-math-card:last-child:focus-visible .gain-math-popover,
.team-hero-metrics .gain-math-card:last-child.is-math-open .gain-math-popover,
.team-stat-grid .gain-math-card:last-child:hover .gain-math-popover,
.team-stat-grid .gain-math-card:last-child:focus-visible .gain-math-popover,
.team-stat-grid .gain-math-card:last-child.is-math-open .gain-math-popover,
.team-production-total:hover .gain-math-popover,
.team-production-total:focus-visible .gain-math-popover,
.team-production-total.is-math-open .gain-math-popover,
.team-roi-math-heading:hover .gain-math-popover,
.team-roi-math-heading:focus-visible .gain-math-popover,
.team-roi-math-heading.is-math-open .gain-math-popover {
  transform: translateY(0);
}

.team-hero-metrics article + article {
  border-left: 1px solid var(--line);
}

.team-hero-metrics strong {
  color: var(--navy);
  font-size: clamp(2rem, 3.85vw, 3.35rem);
  line-height: 0.95;
}

.team-hero-metrics article:last-child strong {
  color: var(--gold);
}

.team-hero-metrics span {
  color: var(--muted);
  font-size: clamp(0.62rem, 0.82vw, 0.82rem);
  font-weight: 900;
  letter-spacing: 0.07em;
  line-height: 1.25;
  text-transform: uppercase;
}

.team-hero-metrics strong.danger {
  color: var(--red);
}

#tm-five-year-net.positive {
  color: var(--green);
}

.team-production-panel {
  overflow: visible;
}

.team-production-panel .panel-heading {
  align-items: center;
  padding-bottom: 0;
}

.team-production-panel .featured-heading h2,
.team-roi-card .featured-heading h2 {
  font-size: calc(1.28rem + 4pt);
}

.team-production-panel .panel-heading strong {
  color: var(--ink);
  font-size: clamp(calc(1.45rem - 10pt), calc(2.6vw - 10pt), calc(2.25rem - 10pt));
  text-align: right;
}

.team-production-total {
  min-width: min(290px, 42%);
  padding: 8px 38px 8px 8px;
}

.team-production-total::after {
  top: 50%;
  transform: translateY(-50%);
}

.team-production-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.team-production-grid label {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.team-production-label-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  align-items: end;
  font-size: calc(0.8rem + 4pt);
}

.team-production-label-row span:first-child {
  white-space: nowrap;
}

.team-production-label-row span:last-child {
  text-align: right;
}

.team-production-entry {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.team-production-grid input {
  min-height: 36px;
  padding-inline: 8px;
  font-weight: 900;
}

.team-production-grid b {
  color: var(--navy);
  font-size: 1rem;
  line-height: 1.15;
  text-align: right;
}

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

.team-stat-grid article {
  min-width: 0;
  padding: 16px 42px 16px 16px;
}

.team-stat-grid strong {
  color: var(--navy);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
}

.team-stat-grid strong.positive {
  color: var(--green);
}

.team-stat-grid strong.danger {
  color: var(--red);
}

.team-stat-grid p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.team-roi-card {
  padding-bottom: 18px;
}

.team-roi-heading {
  align-items: center;
}

.team-roi-math-heading {
  min-width: 0;
  flex: 1;
  border-radius: 7px;
  padding-right: 54px;
}

.team-tenure-control {
  display: grid;
  flex: 0 0 190px;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.team-tenure-control select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd4df;
  border-radius: 6px;
  padding: 0 34px 0 12px;
  color: var(--navy);
  background-color: #ffffff;
  font: inherit;
  font-size: 0.92rem;
  text-transform: none;
}

.team-roi-table {
  display: grid;
  padding: 18px 28px 12px;
}

.team-roi-head,
.team-roi-row {
  display: grid;
  grid-template-columns: 0.65fr 1fr 1.12fr 1fr 0.62fr;
  gap: 14px;
  align-items: center;
}

.team-roi-head {
  border-bottom: 1px solid var(--line);
  padding: 0 12px 10px;
}

.team-roi-head span {
  margin: 0;
  font-size: 0.7rem;
}

.team-roi-row {
  border-bottom: 1px solid var(--line);
  padding: 15px 12px;
}

.team-roi-row:last-child {
  border-bottom: 0;
}

.team-roi-row strong,
.team-roi-row b {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.2;
}

.team-year-cell {
  display: grid;
  gap: 3px;
}

.team-year-cell em {
  color: var(--muted);
  font-size: 0.64rem;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: uppercase;
}

.team-roi-row b {
  font-weight: 850;
}

.team-roi-row.positive b:nth-child(4),
.team-roi-row.positive b:nth-child(5) {
  color: var(--green);
}

.team-roi-row.danger b:nth-child(4),
.team-roi-row.danger b:nth-child(5) {
  color: var(--red);
}

.team-roi-row.residual {
  background: #f7f9fb;
}

.team-roi-row b.roi-unavailable {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.team-roi-bars {
  display: grid;
  gap: 15px;
  padding: 3px 28px 15px;
}

.team-bar-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) minmax(92px, auto);
  gap: 16px;
  align-items: center;
}

.team-bar-row span {
  margin: 0;
}

.team-bar-row strong {
  color: var(--ink);
  font-size: 0.95rem;
  text-align: right;
}

.team-bar-row.positive strong {
  color: var(--green);
}

.team-bar-row.danger strong {
  color: var(--red);
}

.team-bar-track {
  height: 22px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf2;
}

.team-bar-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.team-bar-row.danger .team-bar-track i {
  background: var(--red);
}

.team-report-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 430px);
  gap: 18px 26px;
  align-items: center;
  border-left: 9px solid var(--navy);
  border-right: 9px solid var(--navy);
  padding: 28px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 18px 34px rgba(14, 43, 69, 0.1);
}

.team-report-card h2,
.team-report-card p {
  margin: 0;
}

.team-report-card > div:first-child > span {
  display: block;
  margin-bottom: 8px;
  color: var(--gold);
  font-size: clamp(0.78rem, 0.95vw, 0.98rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.team-report-card h2 {
  color: var(--ink);
  font-size: clamp(1.55rem, 2.6vw, 2.2rem);
}

.team-report-card p {
  max-width: 720px;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.team-lead-form {
  display: grid;
  gap: 10px;
}

.team-lead-form input {
  min-height: 48px;
  border-color: var(--line);
  color: var(--ink);
  background: #fbfcfd;
  font-weight: 800;
}

.team-lead-form input::placeholder {
  color: #8792a0;
}

.team-lead-form input:focus {
  outline-color: rgba(36, 80, 126, 0.18);
  border-color: rgba(36, 80, 126, 0.52);
}

.team-lead-form button {
  min-height: 52px;
  border-color: var(--red);
  color: #ffffff;
  background: var(--red);
  font-size: 1rem;
  box-shadow: 0 16px 28px rgba(185, 40, 48, 0.24);
}

.team-lead-form button:hover {
  background: var(--red-dark);
}

.team-report-card > .copy-status {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  text-align: right;
}

.cashflow-shell {
  display: grid;
  gap: 18px;
  padding: 18px clamp(14px, 3vw, 28px) 30px;
}

.cashflow-month-card {
  overflow: hidden;
  padding: 0;
}

.cashflow-month-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px 18px 10px;
  color: #ffffff;
  background: var(--navy);
}

.cashflow-month-head span {
  display: block;
  color: #f0c97d;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.cashflow-month-head h2 {
  margin: 3px 0 0;
  color: #ffffff;
  font-size: clamp(1.12rem, 2vw, 1.55rem);
}

.cashflow-month-head strong {
  color: #ffffff;
  font-size: clamp(1.5rem, 3vw, 2.45rem);
  text-align: right;
}

.cashflow-month-head strong.danger {
  color: #ffd5cf;
}

.cashflow-month-tabs {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0;
  padding: 0 18px 12px;
  background: var(--navy);
}

.cashflow-month-tabs button {
  position: relative;
  min-height: 26px;
  border: 0;
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 900;
}

.cashflow-month-tabs button.active {
  color: var(--navy);
  background: #ffffff;
}

.cashflow-month-tabs button.negative:not(.active) {
  color: #ffd5cf;
}

.cashflow-month-tabs button.bonus:not(.active)::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 5px;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--gold);
}

.cashflow-month-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 18px;
}

.cashflow-month-metrics article,
.cashflow-summary-grid article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.cashflow-month-metrics span,
.cashflow-summary-grid span,
.cashflow-expense-group header span,
.cashflow-bar b {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.cashflow-month-metrics strong,
.cashflow-summary-grid strong {
  color: var(--navy);
  font-size: clamp(1.35rem, 2.5vw, 2.1rem);
}

.cashflow-context {
  margin: 0;
  border-top: 1px solid var(--line);
  padding: 10px 18px 12px;
  color: #46515f;
  font-size: 0.88rem;
  line-height: 1.45;
  background: #fbfcfd;
}

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

.cashflow-summary-grid article {
  padding-right: 42px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.cashflow-month-total {
  min-width: min(260px, 42%);
  padding: 8px 38px 8px 8px;
  text-align: right;
}

.cashflow-month-total::after {
  top: 50%;
  transform: translateY(-50%);
}

.cashflow-month-total .gain-math-popover,
.cashflow-summary-grid .gain-math-card:last-child .gain-math-popover,
.cashflow-tax-result:last-child .gain-math-card .gain-math-popover,
.cashflow-expense-math-heading .gain-math-popover {
  right: 0;
  left: auto;
  transform: translateY(7px);
}

.cashflow-month-total:hover .gain-math-popover,
.cashflow-month-total:focus-visible .gain-math-popover,
.cashflow-month-total.is-math-open .gain-math-popover,
.cashflow-summary-grid .gain-math-card:last-child:hover .gain-math-popover,
.cashflow-summary-grid .gain-math-card:last-child:focus-visible .gain-math-popover,
.cashflow-summary-grid .gain-math-card:last-child.is-math-open .gain-math-popover,
.cashflow-tax-result:last-child .gain-math-card:hover .gain-math-popover,
.cashflow-tax-result:last-child .gain-math-card:focus-visible .gain-math-popover,
.cashflow-tax-result:last-child .gain-math-card.is-math-open .gain-math-popover,
.cashflow-expense-math-heading:hover .gain-math-popover,
.cashflow-expense-math-heading:focus-visible .gain-math-popover,
.cashflow-expense-math-heading.is-math-open .gain-math-popover {
  transform: translateY(0);
}

.cashflow-summary-grid .gain-math-card:first-child .gain-math-popover,
.cashflow-tax-result:first-child .gain-math-card .gain-math-popover {
  left: 0;
  transform: translateY(7px);
}

.cashflow-summary-grid .gain-math-card:first-child:hover .gain-math-popover,
.cashflow-summary-grid .gain-math-card:first-child:focus-visible .gain-math-popover,
.cashflow-summary-grid .gain-math-card:first-child.is-math-open .gain-math-popover,
.cashflow-tax-result:first-child .gain-math-card:hover .gain-math-popover,
.cashflow-tax-result:first-child .gain-math-card:focus-visible .gain-math-popover,
.cashflow-tax-result:first-child .gain-math-card.is-math-open .gain-math-popover {
  transform: translateY(0);
}

.cashflow-summary-grid p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.cashflow-chart-card {
  padding-bottom: 18px;
}

.cashflow-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 250px;
  padding: 22px 26px 12px;
}

.cashflow-bar {
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: end;
  justify-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 220px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.cashflow-bar i {
  width: 100%;
  max-width: 44px;
  border-radius: 7px 7px 0 0;
  background: #9fb0c4;
}

.cashflow-bar.bonus i {
  background: var(--gold);
}

.cashflow-bar.negative i {
  background: var(--red);
}

.cashflow-bar.active i {
  outline: 3px solid rgba(30, 51, 90, 0.22);
}

.cashflow-bar-value {
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 900;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.cashflow-bar b {
  margin: 0;
}

.cashflow-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 0 26px;
  color: var(--muted);
  font-size: 0.84rem;
}

.cashflow-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.cashflow-legend i {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #9fb0c4;
}

.cashflow-legend i.bonus {
  background: var(--gold);
}

.cashflow-legend i.negative {
  background: var(--red);
}

.cashflow-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.cashflow-input-panel {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.cashflow-input-panel input {
  min-height: 42px;
  font-weight: 800;
}

.cashflow-revenue-card {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.cashflow-revenue-card h3,
.cashflow-revenue-card p {
  margin: 0;
}

.cashflow-section-math {
  border-radius: 7px;
  padding: 4px 38px 4px 4px;
}

.cashflow-revenue-card h3 {
  color: var(--navy);
}

.cashflow-revenue-card p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.cashflow-revenue-visual {
  display: grid;
  gap: 14px;
}

.cashflow-donut {
  position: relative;
  display: grid;
  place-items: center;
  justify-self: center;
  width: min(210px, 100%);
  aspect-ratio: 1;
  border: 0;
  border-radius: 999px;
  background: #e8edf2;
  box-shadow: inset 0 0 0 1px rgba(30, 51, 90, 0.12), 0 18px 45px rgba(24, 32, 42, 0.12);
}

.cashflow-donut::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: inherit;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(30, 51, 90, 0.12);
}

.cashflow-revenue-list {
  display: grid;
  gap: 7px;
}

.cashflow-revenue-list button {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 9px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
}

.cashflow-revenue-list button.active {
  border-color: rgba(30, 51, 90, 0.35);
  background: #f3f7fb;
}

.cashflow-revenue-list i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.cashflow-revenue-list span {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cashflow-revenue-list strong,
.cashflow-revenue-list b {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  white-space: nowrap;
}

.cashflow-lead-card {
  position: relative;
  display: grid;
  gap: 8px;
  border: 1px solid rgba(30, 51, 90, 0.18);
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff, #f4f8fb);
}

.cashflow-lead-card::before {
  content: "";
  position: absolute;
  top: -15px;
  left: 0;
  right: 0;
  border-top: 1px solid var(--line);
}

.cashflow-lead-card h2,
.cashflow-lead-card p {
  margin: 0;
}

.cashflow-lead-card h2 {
  color: var(--navy);
  font-size: 1.15rem;
}

.cashflow-lead-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.42;
}

.cashflow-lead-card input {
  min-height: 38px;
  font-weight: 800;
}

.cashflow-lead-card button {
  min-height: 38px;
  color: #ffffff;
  border-color: var(--red);
  background: var(--red);
}

.cashflow-lead-card .copy-status {
  min-height: 16px;
  margin: 0;
  font-size: 0.82rem;
}

.cashflow-tax-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.cashflow-tax-card h3,
.cashflow-tax-card p {
  margin: 0;
}

.cashflow-tax-card h3 {
  color: var(--navy);
}

.cashflow-tax-card p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.cashflow-tax-inputs,
.cashflow-tax-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.cashflow-tax-results article {
  display: flex;
  min-width: 0;
  min-height: 42px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 34px 9px 11px;
  background: #ffffff;
}

.cashflow-tax-result {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.cashflow-tax-results .gain-math-card::after {
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  font-size: 0.58rem;
}

.cashflow-tax-result > span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.15;
}

.cashflow-tax-results strong {
  color: var(--navy);
  font-size: clamp(1.08rem, 1.8vw, 1.4rem);
}

.cashflow-expense-panel {
  overflow: visible;
}

.cashflow-expense-math-heading {
  padding-right: 54px;
}

.cashflow-expense-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 14px;
}

.cashflow-expense-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.cashflow-expense-group header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px 12px;
  align-items: center;
  padding: 10px 12px;
  color: #ffffff;
  background: var(--navy);
}

.cashflow-expense-group h3,
.cashflow-expense-group p {
  margin: 0;
}

.cashflow-expense-group h3 {
  color: #ffffff;
  font-size: 1rem;
  text-transform: none;
}

.cashflow-expense-group header p {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
}

.cashflow-expense-group header strong {
  color: #ffffff;
  font-size: 0.95rem;
  text-align: right;
}

.cashflow-expense-group header span {
  width: fit-content;
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--navy);
  background: #f2c167;
  font-size: 0.68rem;
}

.cashflow-expense-rows {
  display: grid;
  gap: 5px;
  padding: 10px 10px 7px;
}

.cashflow-expense-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 118px 24px;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 7px;
}

.cashflow-expense-row em {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  white-space: nowrap;
}

.cashflow-expense-row input {
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 5px 7px;
  background: transparent;
}

.cashflow-expense-row input:focus {
  border-color: var(--line);
  background: #ffffff;
}

.cashflow-expense-row .cf-expense-amount {
  grid-column: 3;
  width: 118px;
  border-color: #dce1e7;
  background: #f7f9fb;
  color: var(--ink);
  font-weight: 850;
  text-align: right;
}

.cashflow-expense-row .cf-remove-row {
  grid-column: 4;
}

.cf-remove-row {
  width: 24px;
  height: 24px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 1rem;
  font-weight: 900;
}

.cf-add-row {
  margin: 0 10px 10px;
  min-height: 30px;
  border-style: dashed;
}

.marketing-shell {
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px clamp(14px, 3vw, 28px) 30px;
  align-items: start;
}

.marketing-results {
  display: grid;
  gap: 20px;
}

.marketing-results > .panel > .panel-heading h2 {
  font-size: calc(1.28rem + 4pt);
}

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

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

.marketing-summary article,
.return-grid article {
  min-width: 0;
  padding: 16px;
}

.marketing-summary article.is-roi-positive {
  border-color: rgba(15, 123, 95, 0.34);
  background:
    linear-gradient(135deg, rgba(44, 216, 154, 0.2), rgba(15, 123, 95, 0.08)),
    #edfff8;
  box-shadow: 0 18px 34px rgba(15, 123, 95, 0.2);
}

.marketing-summary article.is-roi-positive span,
.marketing-summary article.is-roi-positive strong {
  color: var(--green);
}

.return-grid article.return-highlight {
  border-color: rgba(43, 122, 91, 0.28);
  background: linear-gradient(180deg, #ffffff, #f2f9f5);
}

.lifetime-visual {
  display: grid;
  gap: 12px;
}

.lifetime-bars {
  display: grid;
  gap: 9px;
}

.lifetime-row {
  display: grid;
  grid-template-columns: minmax(140px, 190px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.lifetime-row span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.lifetime-row strong {
  color: var(--navy);
  font-size: 1.18rem;
}

.lifetime-track {
  height: 15px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf2;
}

.lifetime-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 160ms ease;
}

.spend-row .lifetime-track i {
  background: var(--gold);
}

.lifetime-row-strong {
  border-color: rgba(43, 122, 91, 0.3);
  background: linear-gradient(180deg, #ffffff, #f2f9f5);
}

.lifetime-row-strong .lifetime-track {
  height: 18px;
}

.compact-return-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.compact-return-grid article {
  padding: 12px;
}

.marketing-takeaway-row {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr);
  gap: 18px;
  align-items: stretch;
}

.return-hero {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.return-hero-main {
  display: grid;
  justify-items: center;
  padding: 17px 16px 19px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  text-align: center;
}

.return-hero-main span {
  color: #3f3f3f;
  font-size: clamp(0.84rem, 1.28vw, 1.08rem);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.return-hero-main strong {
  color: var(--green);
  font-size: clamp(calc(3rem - 10pt), calc(7vw - 10pt), calc(5.5rem - 10pt));
  line-height: 0.95;
  margin: 9px 0 7px;
}

.return-hero-main strong.danger {
  color: var(--red);
}

.return-hero-main p {
  margin: 0;
  color: #3f3f3f;
  font-size: clamp(0.9rem, 1.35vw, 1.12rem);
  font-weight: 700;
}

.return-hero-main b {
  color: var(--ink);
}

.return-hero-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.return-hero-flow article {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 92px;
  padding: 16px;
  border-radius: 12px;
}

.return-hero-flow span {
  font-size: clamp(0.78rem, 1.02vw, 0.92rem);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.return-hero-flow strong {
  font-size: clamp(1.55rem, 2.75vw, 2.3rem);
  line-height: 1;
}

.return-spend {
  color: #7a4308;
  background: #fbefd9;
}

.return-back {
  color: #073d36;
  background: #dcf5ed;
}

.return-arrow {
  color: #6b6b65;
  font-size: clamp(1.55rem, 2.5vw, 2.55rem);
  line-height: 1;
}

.marketing-lead-card {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 24px;
}

.marketing-lead-card h2 {
  margin-bottom: 8px;
  color: var(--navy);
  font-size: 1.5rem;
}

.marketing-lead-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.marketing-lead-actions {
  display: grid;
  gap: 10px;
}

.marketing-lead-actions input {
  min-height: 46px;
}

.marketing-lead-actions button {
  min-height: 44px;
  color: #ffffff;
  border-color: var(--red);
  background: var(--red);
}

.marketing-lead-actions .copy-status {
  min-height: 18px;
  margin: 0;
  font-size: 0.82rem;
}

.marketing-summary span,
.return-grid span,
.source-output span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.source-list {
  display: grid;
  gap: 12px;
  padding: 10px 18px 18px;
}

.source-card {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 42px 12px 12px;
  background: #fbfcfd;
}

.source-card.best-roi-source {
  border-color: rgba(15, 123, 95, 0.42);
  background: #fbfcfd;
  box-shadow:
    0 0 0 2px rgba(15, 123, 95, 0.22),
    0 14px 30px rgba(15, 123, 95, 0.14);
}

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

.source-fields label,
.source-output > div {
  display: grid;
  grid-template-rows: 16px 34px;
  gap: 6px;
  align-items: start;
  min-width: 0;
}

.source-fields label > span,
.source-output span {
  display: flex;
  height: 16px;
  min-height: 16px;
  align-items: flex-end;
  margin: 0;
  line-height: 16px;
  white-space: nowrap;
}

.source-fields input,
.source-output strong {
  height: 34px;
  min-height: 34px;
  max-height: 34px;
}

.source-output {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}

.source-output span {
  text-transform: none;
}

.source-output strong {
  display: grid;
  align-items: center;
  border: 1px solid #d5dae1;
  border-radius: 6px;
  padding: 7px 9px;
  background: #eef2f6;
  color: #5f6a76;
  font-size: 1.05rem;
  line-height: 1.1;
  overflow: hidden;
}

.source-output strong.positive {
  color: var(--green);
}

.source-output strong.danger {
  color: var(--red);
}

.economics-heading.gain-math-card {
  padding-right: 42px;
}

.return-hero-main.gain-math-card {
  padding-right: 42px;
  padding-left: 42px;
}

.return-hero-main.gain-math-card > span:first-child {
  padding-right: 0;
}

.marketing-summary .gain-math-card:last-child .gain-math-popover,
.economics-grid .gain-math-card:last-child .gain-math-popover,
.source-output .gain-math-card .gain-math-popover {
  right: 0;
  left: auto;
  transform: translateY(7px);
}

.marketing-summary .gain-math-card:last-child:hover .gain-math-popover,
.marketing-summary .gain-math-card:last-child:focus-visible .gain-math-popover,
.marketing-summary .gain-math-card:last-child.is-math-open .gain-math-popover,
.economics-grid .gain-math-card:last-child:hover .gain-math-popover,
.economics-grid .gain-math-card:last-child:focus-visible .gain-math-popover,
.economics-grid .gain-math-card:last-child.is-math-open .gain-math-popover,
.source-output .gain-math-card:hover .gain-math-popover,
.source-output .gain-math-card:focus-visible .gain-math-popover,
.source-output .gain-math-card.is-math-open .gain-math-popover {
  transform: translateY(0);
}

.source-output .gain-math-card::after {
  top: -2px;
  right: 1px;
  width: 18px;
  height: 18px;
  font-size: 0.58rem;
}

.source-output .gain-math-card > span:first-child {
  padding-right: 21px;
}

.source-output .gain-math-popover {
  width: min(360px, calc(100vw - 32px));
}

.remove-source {
  position: absolute;
  right: 10px;
  bottom: 14px;
  width: 26px;
  min-width: 26px;
  min-height: 26px;
  padding: 0;
  font-size: 0.74rem;
  line-height: 1;
}

.remove-source:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.progress-list {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.progress-row {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) minmax(120px, auto);
  gap: 14px;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.progress-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.progress-title strong {
  font-size: 1rem;
}

.progress-title span {
  font-size: 0.84rem;
}

.meter {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf2;
}

.meter-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--green));
  transition: width 160ms ease;
}

.progress-value {
  text-align: right;
}

.progress-value strong {
  font-size: 1.18rem;
}

.progress-value span {
  font-size: 0.82rem;
}

.pace-grid,
.investment-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

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

.pace-grid article,
.investment-grid article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.pace-grid p,
.investment-grid p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.payoff-card {
  background: linear-gradient(180deg, #fbfcfd, #f4f9f7);
}

.payoff-bars {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.payoff-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) minmax(86px, auto);
  gap: 10px;
  align-items: center;
}

.payoff-row b,
.payoff-row em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.payoff-row em {
  color: var(--ink);
  text-align: right;
}

.payoff-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf2;
}

.payoff-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
}

.payoff-row:last-child .payoff-track i {
  background: var(--green);
}

.wide {
  grid-column: span 2;
}

.positive {
  color: var(--green);
}

.warning {
  color: var(--gold);
}

.danger {
  color: var(--red);
}

:is(
  .gain-input-panel input:not([type="range"]),
  [data-tool-view="marketing-roi"] .input-panel input,
  .source-fields input,
  .team-input-panel input,
  .team-production-grid input,
  .team-tenure-control select,
  .cashflow-input-panel > label input,
  .cashflow-tax-inputs input,
  .cashflow-expense-row input
) {
  border-color: rgba(205, 151, 58, 0.42);
  background-color: #ffffff;
  box-shadow: none;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

:is(
  .gain-input-panel input:not([type="range"]),
  [data-tool-view="marketing-roi"] .input-panel input,
  .source-fields input,
  .team-input-panel input,
  .team-production-grid input,
  .team-tenure-control select,
  .cashflow-input-panel > label input,
  .cashflow-tax-inputs input,
  .cashflow-expense-row input
):hover {
  border-color: rgba(205, 151, 58, 0.64);
  background-color: #ffffff;
}

:is(
  .gain-input-panel input:not([type="range"]),
  [data-tool-view="marketing-roi"] .input-panel input,
  .source-fields input,
  .team-input-panel input,
  .team-production-grid input,
  .team-tenure-control select,
  .cashflow-input-panel > label input,
  .cashflow-tax-inputs input,
  .cashflow-expense-row input
):focus {
  border-color: var(--blue);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(49, 95, 143, 0.14);
  outline: none;
}

.tools-footer {
  border-top: 1px solid #d8dde4;
  padding: 14px clamp(18px, 4vw, 48px);
  color: #dce4ef;
  background: #13284a;
}

.tools-footer-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.tools-footer-copyright {
  margin: 0;
  color: #bfcbd9;
  font-size: 0.82rem;
  line-height: 1.35;
  white-space: nowrap;
}

.tools-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  justify-content: flex-end;
}

.tools-footer-links a {
  min-height: 36px;
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 36px;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.legal-page {
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
}

.legal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 86px;
  padding: 18px clamp(18px, 4vw, 48px);
  color: #ffffff;
  background: var(--navy);
}

.legal-header img {
  display: block;
  width: min(220px, 42vw);
  height: auto;
}

.legal-back-link {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 7px;
  padding: 0 14px;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 850;
  line-height: 40px;
  text-decoration: none;
}

.legal-shell {
  width: min(860px, calc(100% - 32px));
  margin: 36px auto 52px;
}

.legal-shell > header {
  margin-bottom: 22px;
}

.legal-shell h1 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.05;
}

.legal-effective-date {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.legal-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(22px, 4vw, 40px);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.legal-card section + section {
  margin-top: 28px;
}

.legal-card h2 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 1.15rem;
}

.legal-card p,
.legal-card li {
  color: #4f5b69;
  font-size: 0.95rem;
  line-height: 1.65;
}

.legal-card p {
  margin: 0;
}

.legal-card ul {
  margin: 8px 0 0;
  padding-left: 22px;
}

.legal-card a {
  color: #174f92;
  font-weight: 800;
}

.legal-note {
  border-left: 4px solid var(--gold);
  padding: 14px 16px;
  background: #fff8eb;
}

.legal-note strong {
  color: var(--navy);
}

.legal-footer {
  padding: 24px;
  color: #bdc9d8;
  background: #13284a;
  text-align: center;
}

.legal-footer a {
  color: #ffffff;
}

@media (max-width: 1050px) {
  .tools-header {
    border-radius: 0 0 14px 14px;
  }

  .tool-tab {
    min-height: 70px;
  }

  .gain-shell,
  .workspace,
  .marketing-shell,
  .team-shell {
    grid-template-columns: 1fr;
  }

  .input-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  .tools-title-band {
    grid-template-columns: 1fr;
    gap: 18px;
    padding-block: 24px 26px;
  }

  .tools-header-logo {
    width: min(240px, 58vw);
    justify-self: start;
  }

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

  .tool-tab {
    min-height: 63px;
  }

  .team-tenure-control {
    flex-basis: 170px;
  }

  .gain-hero,
  .summary-strip,
  .pace-grid,
  .investment-grid,
  .marketing-takeaway-row,
  .marketing-summary,
  .return-grid,
  .team-production-grid,
  .team-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gain-hero > div:first-child,
  .gain-hero-metrics,
  .gain-track-grid,
  .scenario-row {
    grid-column: 1 / -1;
  }

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

  .gain-track-grid {
    grid-template-columns: 1fr;
  }

  .gain-stat-strip,
  .cashflow-workspace,
  .cashflow-expense-groups,
  .gain-takeaway,
  .team-hero-card,
  .gain-slider-results {
    grid-template-columns: 1fr;
  }

  .team-hero-card strong {
    text-align: left;
  }

  .team-hero-metrics {
    grid-template-columns: 1fr;
  }

  .team-hero-metrics article {
    min-height: auto;
    justify-items: start;
    padding: 18px 0;
    text-align: left;
  }

  .team-hero-metrics article + article {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .gain-stat-strip article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .gain-stat-strip article:last-child {
    border-bottom: 0;
  }

  .scenario-head,
  .scenario-row {
    grid-template-columns: 1fr 0.85fr 0.95fr 0.95fr 0.55fr;
  }

  .cashflow-summary-grid,
  .cashflow-month-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .source-card,
  .source-fields,
  .source-output {
    grid-template-columns: 1fr;
  }

  .source-card {
    padding: 12px;
  }

  .remove-source {
    position: static;
    justify-self: start;
  }

  .progress-row {
    grid-template-columns: 1fr;
  }

  .lifetime-row {
    grid-template-columns: 1fr;
  }

  .return-hero-flow {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .return-arrow {
    transform: rotate(90deg);
    justify-self: center;
  }

  .progress-value {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .tools-footer {
    padding: 12px 16px 14px;
  }

  .tools-footer-main {
    display: grid;
    gap: 4px;
  }

  .tools-footer-links {
    display: flex;
    gap: 0 16px;
    justify-content: flex-start;
  }

  .tools-footer-links a {
    min-height: 36px;
    border-top: 0;
    line-height: 36px;
  }

  .legal-header {
    align-items: stretch;
    flex-direction: column;
  }

  .legal-header img {
    order: -1;
    width: min(220px, 70vw);
    align-self: center;
  }

  .legal-back-link {
    text-align: center;
  }

  .legal-shell {
    width: min(100% - 20px, 860px);
    margin-top: 20px;
  }

  .legal-card {
    padding: 20px 18px;
  }

  .tools-header {
    border-radius: 0 0 12px 12px;
  }

  .tools-title-band {
    padding: 22px 18px 24px;
  }

  .tools-header-logo {
    width: min(200px, 64vw);
  }

  .tool-tab {
    min-height: 56px;
    gap: 6.5px;
    font-size: 0.735rem;
  }

  .tool-tab svg {
    width: 20px;
    height: 20px;
  }

  .nav-report-button {
    margin-left: 0;
  }

  .gain-date-card,
  .gain-hero,
  .gain-hero-metrics,
  .gain-track-stats,
  .gain-slider-top,
  .scenario-row,
  .cashflow-summary-grid,
  .cashflow-month-metrics,
  .team-mini-ledger,
  .team-production-grid,
  .team-stat-grid,
  .team-report-card,
  .summary-strip,
  .field-grid,
  .pace-grid,
  .investment-grid,
  .marketing-takeaway-row,
  .marketing-summary,
  .return-grid {
    grid-template-columns: 1fr;
  }

  .target-table {
    grid-template-columns: 1fr;
  }

  .table-head {
    display: none;
  }

  .wide {
    grid-column: span 1;
  }

  .payoff-row {
    grid-template-columns: 1fr;
  }

  .payoff-row em {
    text-align: left;
  }

  .gain-panel-title,
  .gain-pace-head,
  .simple-scenario-panel .panel-heading {
    display: grid;
  }

  .team-roi-heading {
    display: grid;
    grid-template-columns: 1fr;
  }

  .team-tenure-control {
    width: 100%;
  }

  .gain-pace-head strong {
    text-align: left;
  }

  .scenario-head {
    display: none;
  }

  .team-roi-head {
    display: none;
  }

  .scenario-row {
    gap: 6px;
  }

  .team-roi-row {
    grid-template-columns: 1fr;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 10px;
    background: #fbfcfd;
  }

  .team-roi-row b::before {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  .team-roi-row b:nth-child(2)::before {
    content: "Annual Revenue";
  }

  .team-roi-row b:nth-child(3)::before {
    content: "Cumulative Revenue";
  }

  .team-roi-row b:nth-child(4)::before {
    content: "Gain / Loss";
  }

  .team-roi-row b:nth-child(5)::before {
    content: "ROI";
  }

  .scenario-row b::before {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  .scenario-row b:nth-child(2)::before {
    content: "Spend";
  }

  .scenario-row b:nth-child(3)::before {
    content: "Variable Comp";
  }

  .scenario-row b:nth-child(4)::before {
    content: "Profit / Loss";
  }

  .scenario-row b:nth-child(5)::before {
    content: "ROI";
  }

  .simple-scenario-panel .panel-heading,
  .scenario-table {
    padding-left: 18px;
    padding-right: 18px;
  }

  .simple-scenario-panel .gain-footnote {
    margin-left: 18px;
    margin-right: 18px;
  }

  .cashflow-month-head,
  .cashflow-month-metrics {
    display: grid;
  }

  .cashflow-month-head strong {
    text-align: left;
  }

  .cashflow-month-tabs {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .cashflow-chart {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    row-gap: 16px;
  }

  .cashflow-bar {
    min-height: 180px;
  }

  .cashflow-expense-row {
    grid-template-columns: 1fr;
  }

  .cashflow-expense-row em,
  .cashflow-expense-row .cf-expense-amount,
  .cashflow-expense-row .cf-remove-row {
    grid-column: auto;
  }

  .cashflow-expense-row .cf-expense-amount {
    width: 100%;
    text-align: left;
  }

  .team-roi-table,
  .team-roi-bars {
    padding-left: 18px;
    padding-right: 18px;
  }

  .team-bar-row {
    grid-template-columns: 1fr;
  }

  .team-bar-row strong {
    text-align: left;
  }
}

/* Phone layout refinements. Everything below is intentionally mobile-only. */
@media (max-width: 560px) {
  body {
    overflow-x: hidden;
  }

  .tools-header {
    box-shadow: 0 9px 24px rgba(24, 32, 42, 0.08);
  }

  .tools-title-band {
    justify-items: center;
    gap: 12px;
    padding: 18px 18px 22px;
  }

  .tools-title-copy {
    display: grid;
    justify-items: center;
    text-align: center;
  }

  .tools-title-copy p {
    margin-bottom: 8px;
    font-size: 0.68rem;
  }

  .tools-title-copy h1 {
    max-width: 20ch;
    margin-bottom: 9px;
    font-size: clamp(1.45rem, 7vw, 1.8rem);
    line-height: 1.08;
  }

  .tools-title-copy span {
    max-width: 34rem;
    font-size: 0.78rem;
    line-height: 1.35;
  }

  .tools-header-logo {
    order: -1;
    width: min(236px, 74vw);
    justify-self: center;
    margin-bottom: 2px;
  }

  .tool-tabs {
    gap: 1px;
    background: #e2e4e8;
  }

  .tool-tab {
    min-height: 64px;
    gap: 7px;
    border-right: 0;
    border-bottom-width: 3px;
    padding: 9px 8px;
    background: #ffffff;
  }

  .tool-tab span {
    white-space: normal;
    line-height: 1.18;
  }

  .gain-shell,
  .marketing-shell,
  .team-shell,
  .cashflow-shell {
    gap: 14px;
    padding: 12px 10px 24px;
  }

  .gain-results,
  .marketing-results,
  .team-results {
    gap: 14px;
  }

  .gain-input-panel,
  .team-input-panel,
  .cashflow-input-panel {
    gap: 14px;
    padding: 16px;
  }

  .gain-input-panel .gain-panel-title,
  .team-input-panel .gain-panel-title,
  .cashflow-input-panel .gain-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .gain-input-panel .gain-panel-title > div,
  .team-input-panel .gain-panel-title > div,
  .cashflow-input-panel .gain-panel-title > div {
    min-width: 0;
  }

  .gain-input-panel .gain-panel-title .ghost-button,
  .team-input-panel .gain-panel-title .ghost-button,
  .cashflow-input-panel .gain-panel-title .ghost-button {
    flex: none;
    margin-left: auto;
  }

  .gain-date-card.compact {
    grid-template-columns: minmax(0, 2fr) minmax(100px, 1fr);
    gap: 8px;
  }

  .gain-date-card.compact > div,
  .gain-date-card.compact > label {
    min-height: 82px;
    overflow: hidden;
    padding: 10px;
  }

  .gain-date-card.compact .gain-planning-date input[type="date"] {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 30px;
    border: 0;
    padding: 2px 0 0;
    color: var(--navy);
    background: transparent;
    box-shadow: none;
    font-size: 16px !important;
    font-weight: 850;
    line-height: 1.2;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
  }

  .gain-date-card.compact .gain-planning-date input[type="date"]::-webkit-date-and-time-value {
    min-width: 0;
    margin: 0;
    text-align: left;
  }

  input:not([type="range"]),
  .team-tenure-control select,
  .ghost-button {
    min-height: 44px;
  }

  .gain-math-popover {
    top: calc(100% + 8px);
    right: auto;
    bottom: auto;
    left: 0;
    width: min(320px, calc(100vw - 52px));
    max-height: min(380px, 62vh);
    overflow-y: auto;
    transform: translateY(-6px);
  }

  .gain-math-card:hover .gain-math-popover,
  .gain-math-card:focus-visible .gain-math-popover,
  .gain-math-card.is-math-open .gain-math-popover {
    transform: translateY(0);
  }

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

  .gain-stat-strip article {
    min-height: 118px;
    padding: 16px;
  }

  .gain-stat-strip article:nth-child(odd):not(:last-child) {
    border-right: 1px solid var(--line);
  }

  .gain-stat-strip article:last-child {
    grid-column: 1 / -1;
    min-height: 104px;
  }

  .gain-stat-strip .gain-math-card:nth-child(even) .gain-math-popover,
  .marketing-summary .gain-math-card:nth-child(even) .gain-math-popover,
  .team-stat-grid .gain-math-card:nth-child(even) .gain-math-popover,
  .cashflow-summary-grid .gain-math-card:nth-child(even) .gain-math-popover {
    right: 0;
    left: auto;
  }

  .gain-pace-card {
    padding: 20px 16px;
  }

  .gain-pace-card p {
    margin-bottom: 18px;
  }

  .gain-progress {
    height: 42px;
  }

  .gain-progress-labels {
    gap: 8px;
    font-size: 0.814rem;
  }

  .gain-slider-card {
    gap: 14px;
    padding: 16px 16px 12px;
  }

  .gain-slider-labels {
    min-height: 38px;
    margin-top: -10px;
    font-size: 0.72rem;
  }

  #g-current-pace-label {
    top: 17px;
    padding: 3px 6px;
    font-size: 0.68rem;
  }

  .simple-scenario-panel .panel-heading,
  .scenario-table {
    padding-right: 16px;
    padding-left: 16px;
  }

  .simple-scenario-panel .gain-footnote {
    margin-right: 16px;
    margin-left: 16px;
  }

  .gain-takeaway,
  .team-report-card,
  .marketing-lead-card {
    padding: 18px;
  }

  .marketing-summary,
  .cashflow-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .marketing-summary article,
  .cashflow-summary-grid article {
    padding: 14px 36px 14px 12px;
  }

  .team-stat-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .team-stat-grid article {
    min-height: 104px;
    padding: 16px 42px 16px 16px;
  }

  .marketing-results > .panel > .panel-heading,
  .team-production-panel .panel-heading {
    display: grid;
    gap: 14px;
  }

  .marketing-results > .panel > .panel-heading .button-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .marketing-results > .panel > .panel-heading .button-row button:last-child {
    grid-column: 1 / -1;
  }

  .source-list {
    padding: 10px 12px 14px;
  }

  .source-card {
    padding: 12px;
  }

  .source-fields,
  .source-output {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 8px;
  }

  .source-fields label,
  .source-output > div {
    grid-template-rows: 18px 44px;
  }

  .source-fields label > span,
  .source-output span {
    height: 18px;
    min-height: 18px;
    font-size: 0.72rem;
    line-height: 18px;
  }

  .source-fields input,
  .source-output strong {
    height: 44px;
    min-height: 44px;
    max-height: 44px;
  }

  .source-output .remove-source {
    grid-column: 2;
    justify-self: end;
    width: 36px;
    min-width: 36px;
    min-height: 36px;
  }

  .hh-gauge {
    padding: 16px 12px;
  }

  .hh-bar-row {
    grid-template-columns: 86px minmax(0, 1fr) 64px;
    gap: 8px;
  }

  .return-hero,
  .return-hero-main,
  .return-hero-flow article {
    padding: 14px;
  }

  .team-hero-card {
    grid-template-columns: 1fr;
    gap: 14px;
    border-right-width: 6px;
    border-left-width: 6px;
    padding: 18px 16px;
  }

  .team-hero-message {
    gap: 8px;
    padding-top: 0;
  }

  .team-hero-card h2 {
    max-width: none;
    font-size: 1.12rem;
    line-height: 1.35;
  }

  .team-hero-metrics {
    grid-template-columns: 1fr;
    border-top: 1px solid var(--line);
  }

  .team-hero-metrics article {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 70px;
    align-content: center;
    align-items: center;
    justify-items: stretch;
    gap: 12px;
    padding: 13px 34px 13px 0;
    text-align: left;
  }

  .team-hero-metrics article + article {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .team-hero-metrics strong,
  .team-hero-card strong {
    grid-column: 2;
    grid-row: 1;
    font-size: 1.55rem;
    line-height: 1;
    text-align: right;
  }

  .team-hero-metrics span {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    font-size: 0.66rem;
    letter-spacing: 0;
    line-height: 1.35;
    text-align: left;
  }

  .team-hero-metrics .gain-math-card {
    padding-right: 34px;
  }

  .team-hero-metrics .gain-math-card::after {
    top: 50%;
    right: 3px;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
  }

  .team-hero-metrics .gain-math-card:first-child .gain-math-popover,
  .team-hero-metrics .gain-math-card:nth-child(2) .gain-math-popover,
  .team-hero-metrics .gain-math-card:last-child .gain-math-popover {
    right: auto;
    left: 0;
  }

  .team-production-total {
    width: 100%;
    min-width: 0;
    padding: 8px 38px 8px 0;
    text-align: left;
  }

  .team-production-panel .panel-heading strong {
    font-size: 1.1rem;
    text-align: left;
  }

  .team-production-grid,
  .team-roi-table,
  .team-roi-bars {
    padding-right: 14px;
    padding-left: 14px;
  }

  .team-production-panel .featured-heading h2,
  .team-roi-card .featured-heading h2 {
    font-size: 1.35rem;
    line-height: 1.2;
  }

  .team-production-label-row,
  .team-production-entry {
    grid-template-columns: minmax(118px, 0.9fr) minmax(0, 1fr);
    gap: 12px;
  }

  .team-production-label-row {
    font-size: 1rem;
  }

  .team-production-grid input {
    min-height: 44px;
  }

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

  .team-roi-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
  }

  .team-year-cell {
    border-bottom: 1px solid var(--line);
    padding-bottom: 9px;
  }

  .team-bar-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 12px;
  }

  .team-bar-row span {
    grid-column: 1;
    grid-row: 1;
  }

  .team-bar-row strong {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }

  .team-bar-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .team-report-card {
    grid-template-columns: 1fr;
    gap: 16px;
    border-right-width: 6px;
    border-left-width: 6px;
    padding: 20px 18px;
  }

  .team-report-card h2 {
    font-size: 1.45rem;
    line-height: 1.2;
  }

  .team-report-card > .copy-status {
    text-align: left;
  }

  .cashflow-month-head {
    gap: 8px;
    padding: 14px 14px 10px;
  }

  .cashflow-month-total {
    min-width: 0;
    padding: 4px 0;
    text-align: left;
  }

  .cashflow-month-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 0 14px 14px;
  }

  .cashflow-month-tabs button {
    min-height: 44px;
  }

  .cashflow-month-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 10px;
  }

  .cashflow-month-metrics article {
    padding: 10px 8px;
  }

  .cashflow-month-metrics span {
    font-size: 0.64rem;
  }

  .cashflow-month-metrics strong {
    font-size: clamp(1rem, 4.6vw, 1.28rem);
  }

  .cashflow-tax-inputs,
  .cashflow-tax-results {
    gap: 8px;
  }

  .cashflow-tax-results article {
    padding: 10px 30px 10px 9px;
  }

  .cashflow-donut {
    width: min(184px, 72vw);
  }

  .cashflow-revenue-list button {
    min-height: 44px;
  }

  .cashflow-expense-groups {
    padding: 10px;
  }

  .cashflow-expense-group header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .cashflow-expense-group header span {
    grid-column: 1 / -1;
  }

  .cashflow-expense-row {
    grid-template-columns: minmax(0, 1fr) 112px 36px;
    gap: 6px;
  }

  .cashflow-expense-row .cf-expense-name {
    grid-column: 1;
  }

  .cashflow-expense-row em {
    grid-column: 1;
    grid-row: 2;
  }

  .cashflow-expense-row .cf-expense-amount {
    grid-column: 2;
    grid-row: 1;
    width: 112px;
    text-align: right;
  }

  .cashflow-expense-row .cf-remove-row {
    grid-column: 3;
    grid-row: 1;
    width: 36px;
    height: 36px;
  }

  .cashflow-chart {
    grid-template-columns: repeat(12, minmax(42px, 1fr));
    gap: 7px;
    min-height: 226px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding: 18px 16px 12px;
    scroll-snap-type: x proximity;
  }

  .cashflow-bar {
    min-height: 196px;
    scroll-snap-align: start;
  }

  .cashflow-chart-card .panel-heading,
  .cashflow-legend {
    padding-right: 16px;
    padding-left: 16px;
  }

  .cashflow-shell {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .cashflow-shell > *,
  .cashflow-month-card,
  .cashflow-summary-grid,
  .cashflow-workspace,
  .cashflow-workspace > *,
  .cashflow-input-panel,
  .cashflow-tax-card,
  .cashflow-tax-inputs,
  .cashflow-tax-results,
  .cashflow-revenue-card,
  .cashflow-revenue-visual,
  .cashflow-revenue-list {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .cashflow-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .cashflow-month-tabs,
  .cashflow-month-metrics,
  .cashflow-summary-grid {
    min-width: 0;
  }

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

  .cashflow-month-metrics article:last-child {
    grid-column: 1 / -1;
  }

  .cashflow-summary-grid article,
  .cashflow-tax-results article {
    overflow: hidden;
  }

  .cashflow-revenue-list button {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 370px) {
  .tool-tab {
    font-size: 0.68rem;
  }

  .gain-stat-strip,
  .marketing-summary,
  .team-stat-grid,
  .cashflow-summary-grid {
    grid-template-columns: 1fr;
  }

  .gain-stat-strip article:last-child {
    grid-column: auto;
  }

  .gain-stat-strip article:nth-child(odd):not(:last-child) {
    border-right: 0;
  }

  .source-fields,
  .source-output {
    grid-template-columns: 1fr;
  }

  .source-output .remove-source {
    grid-column: 1;
  }

  .cashflow-month-metrics {
    grid-template-columns: 1fr;
  }

  .cashflow-expense-row {
    grid-template-columns: minmax(0, 1fr) 36px;
  }

  .cashflow-expense-row .cf-expense-name,
  .cashflow-expense-row .cf-expense-amount {
    grid-column: 1;
    width: 100%;
  }

  .cashflow-expense-row .cf-expense-amount {
    grid-row: 2;
    text-align: left;
  }

  .cashflow-expense-row em {
    grid-row: 3;
  }

  .cashflow-expense-row .cf-remove-row {
    grid-column: 2;
    grid-row: 1;
  }
}
