/* Revenue Goal Calculator: only what shell.css lacks. Palette, faces and the 16px gutter come from shell.css. */

/* ---------- Track record inputs: one row of four fields per year ---------- */
/* Section title with a small blob-tile icon sized to the 18px label beside it. */
.rgc-section-head { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.rgc-section-head > .form-section__title { margin: 0; }
.rgc-section-head__icon { flex: none; width: 28px; height: 28px; }

/* The form's summary alert sits under the card heading, above the first field, so it is in view when the page
   moves to the first field that needs a look. */
.inputs-card > .form-alert { margin: -8px 0 28px; }

/* The share row's text links darken on hover like every other text link (shell.css resets their colour in that row). */
.share-bar__actions .link-action:hover { color: var(--forest-dark); }

/* Keeps a hyphenated word on one line ("pressure-test"). */
.rgc-nowrap { white-space: nowrap; }

/* The chart card's heading is a card-head (icon and Founders card title) inside the figure's caption. */
.rgc-chart > .rgc-chart-head { margin-bottom: 24px; }
.rgc-history-help { margin-bottom: 4px; }
.rgc-year { margin-top: 20px; }
.rgc-year > legend { padding: 0; margin-bottom: 10px; font-weight: 500; font-size: 0.9375rem; color: var(--cool-gray); }
.field-grid.rgc-year-grid { grid-template-columns: 0.6fr 1fr 1fr 1fr; gap: 14px 16px; }

/* ---------- Lever mix: sliders and buttons ---------- */
.rgc-mix-help { margin-bottom: 20px; }
.rgc-sliders { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 28px; }
.rgc-slider { min-width: 0; }
.rgc-slider__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 12px; }
.rgc-slider__head label { font-weight: 500; font-size: 1rem; }
.rgc-slider__value { font-size: 0.9375rem; color: var(--deep-teal); font-weight: 500; font-variant-numeric: tabular-nums; }
.rgc-range { display: block; width: 100%; min-height: 36px; margin: 2px 0 0; accent-color: var(--deep-teal); cursor: pointer; }
.rgc-mix-actions { display: flex; flex-wrap: wrap; gap: 4px 28px; margin: 16px 0 8px; }
.rgc-mix-note { font-size: 0.9375rem; color: var(--cool-gray); margin: 0 0 20px; }

/* ---------- Lever table ---------- */
.rgc-lever-table { min-width: 560px; }
.rgc-lever-table td, .rgc-lever-table th { vertical-align: middle; }
.rgc-lever-table tbody th, .rgc-spend-table tbody th { white-space: nowrap; }
.rgc-measure { display: block; font-weight: 400; font-size: 0.8125rem; color: var(--cool-gray); }
.rgc-chip {
  display: inline-block; padding: 3px 12px; border-radius: 999px; border: 1.5px solid transparent;
  font-size: 0.8125rem; font-weight: 500; line-height: 1.4; white-space: nowrap; color: var(--deep-plum);
}
.rgc-chip--within { background: var(--soft-mint); color: var(--forest-dark); }
.rgc-chip--edge { background: var(--white); border-color: var(--amber); }
.rgc-chip--beyond { background: var(--amber); }
.rgc-chip--nohist { background: #F3F1F7; color: var(--cool-gray); }
.rgc-table-note { margin: 12px 0 0; font-size: 0.9375rem; color: var(--cool-gray); }
.rgc-single { margin: 18px 0 0; }
.rgc-skipped { margin: 12px 0 0; padding-left: 1.1em; font-size: 0.9375rem; color: var(--cool-gray); }

/* ---------- Lever chart: the best-year tick and its legend swatch ---------- */
.rgc-best-tick { stroke: var(--deep-plum); stroke-width: 3; stroke-linecap: round; }
.swatch.rgc-swatch-best { width: 4px; height: 16px; border-radius: 1px; background: var(--deep-plum); }

/* ---------- Spend panel ---------- */
/* A Soft Mint tile inside the spend card. Notes on mint use Deep Plum (Cool Gray falls under 4.5:1 there). */
.rgc-settings { margin: 24px 0 28px; padding: 24px; border-radius: var(--radius-tile); background: var(--soft-mint); }
.rgc-settings .field-help, .rgc-settings .field-optional { color: var(--deep-plum); }
.rgc-settings__title { margin: 0 0 14px; }
.rgc-settings .field-grid + .field-help { margin-top: 14px; }
.rgc-spend-table { min-width: 720px; }
.rgc-spend-table thead th { white-space: normal; vertical-align: bottom; line-height: 1.3; }
/* Long case names wrap inside their column so the table fits the 840px card at desktop. */
.rgc-spend-table thead th.num { white-space: normal; min-width: 6.5em; }
.rgc-spend-table .rgc-strong > * { font-weight: 700; }
.rgc-spend-table td.rgc-flag { font-size: 0.875rem; line-height: 1.4; min-width: 9em; text-align: right; }
.rgc-flag--loss, .rgc-flag--below { font-weight: 500; }
/* A filled amber dot for a loss, an amber ring for "below today": the words carry the meaning, the dot is a cue. */
.rgc-flag--loss .rgc-cell::before, .rgc-flag--below .rgc-cell::before {
  content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%;
  border: 2px solid var(--amber); vertical-align: 0;
}
.rgc-flag--loss .rgc-cell::before { background: var(--amber); }
/* Each cell's column heading, shown only when a phone stacks the table (below). */
.rgc-cell-label { display: none; }
.rgc-spend-none { font-weight: 500; }

/* ---------- What to do next: one advice tile across the card, the hand-off links under it ---------- */
.tile-grid.rgc-next { grid-template-columns: minmax(0, 1fr); }
.rgc-next .tile p { font-size: 1.0625rem; }

/* ---------- What must be true ---------- */
.rgc-must { margin: 0; padding-left: 1.2em; }
.rgc-must li + li { margin-top: 8px; }

/* Labels in the spend settings take two lines' room, so the three inputs line up when one label wraps. */
@media (min-width: 641px) {
  .rgc-settings .field > label { min-height: 2.7em; }
}

/* ---------- Narrower screens ---------- */
@media (max-width: 900px) {
  .rgc-sliders { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}
@media (max-width: 640px) {
  .field-grid.rgc-year-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .rgc-settings { padding: 16px; }
}
/* Phones (480px and below): the lever table and the spend table stack. Each row becomes its heading line, then one
   line per column with the column heading on the left and the value on the right, so values never crowd each
   other and a value never breaks across lines. No sideways scroll. Screen only; print keeps its own rules below. */
@media screen and (max-width: 480px) {
  .rgc-lever-table, .rgc-spend-table { display: block; min-width: 0; width: 100%; }
  .rgc-lever-table caption, .rgc-spend-table caption { display: block; }
  .rgc-lever-table thead, .rgc-spend-table thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .rgc-lever-table tbody, .rgc-spend-table tbody, .rgc-lever-table tr, .rgc-spend-table tr { display: block; }
  .rgc-lever-table tr, .rgc-spend-table tr { padding: 12px 0; border-bottom: 1px solid rgba(188, 182, 206, 0.6); }
  .rgc-lever-table tbody th, .rgc-spend-table tbody th {
    display: block; width: auto; padding: 0 0 6px; border: 0; white-space: normal; font-weight: 700;
  }
  .rgc-lever-table td, .rgc-spend-table td,
  .rgc-spend-table td.rgc-flag {
    display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
    min-width: 0; padding: 3px 0; border: 0; text-align: right; font-size: 0.9375rem; line-height: 1.35;
  }
  .rgc-cell-label { display: block; flex: 1 1 auto; min-width: 0; text-align: left; color: var(--cool-gray); font-size: 0.875rem; }
  .rgc-cell { flex: none; white-space: nowrap; }
  /* The flag sentences are the one value allowed to wrap; they take the wider share of the line. */
  .rgc-spend-table td.rgc-flag .rgc-cell-label { flex: 0 0 38%; }
  .rgc-spend-table td.rgc-flag .rgc-cell { flex: 1 1 auto; white-space: normal; }
  .rgc-spend-table .rgc-strong > td { font-weight: 700; }
  .rgc-spend-table .rgc-strong .rgc-cell-label { font-weight: 400; }
}

/* ---------- Print: the one-page summary keeps the table and the chart, not the controls ---------- */
@media print {
  /* The lever table above the chart already prints the same three rows, so the chart's own table stays hidden. */
  .rgc-chart-table, .rgc-mix-note, .rgc-skipped { display: none !important; }
  .rgc-single { margin-top: 4pt; font-size: 8.5pt; }
  .rgc-measure { display: none; }
  .rgc-chip { padding: 0 6pt; font-size: 8pt; }
  .rgc-lever-table caption { display: none; }
  .rgc-lever-table { min-width: 0; }
  /* At a narrow print width the table wraps inside the card instead of scrolling past its edge. */
  .table-scroll { overflow: visible !important; }
  .rgc-lever-table { width: 100%; }
  .rgc-lever-table th, .rgc-lever-table td, .rgc-chip { white-space: normal !important; }
  /* The "What must be true" list states conversion as a rate (2.50% to 2.55%), so the note can stay on screen only. */
  .rgc-table-note { display: none; }
  .rgc-must li + li { margin-top: 1pt; }
  .card-title { font-size: 11pt; margin-bottom: 4pt; }
  .results-body > * + * { margin-top: 6pt; }
  .results .card { padding: 5pt 10pt; }
  .results .chart-svg { max-height: 120pt; }
  .results .chart-legend { margin-top: 2pt; }
  .rgc-lever-table th, .rgc-lever-table td { padding-block: 2pt; }
  .rgc-chip { border-width: 1px; line-height: 1.25; }
  .results .verdict { padding: 8pt 12pt; }
  .results .verdict__headline { font-size: 11pt; line-height: 1.3; margin-bottom: 4pt; }
  .results .verdict__sub { font-size: 9pt; }
  .results .stat { padding: 4pt 8pt; }
  .rgc-must li { font-size: 9pt; }
  .results .stat__label { line-height: 1.25; }
  .result-block > h3 { font-size: 10.5pt; }
  .next-step p { font-size: 9pt; }
  .rgc-next .tile { padding: 5pt 8pt; border-radius: 6pt; }
  .rgc-next .tile p { font-size: 9pt; }
  .results .card-head { margin-bottom: 4pt; gap: 6pt; }
  .results .card-head__icon { width: 16pt; height: 16pt; }
  .results .chart-svg { max-height: none; }
  .results .chart-legend { font-size: 8pt; }
  .print-sub { margin-bottom: 6pt; }
  /* What to do next prints as a title and one tile, without its own card frame. */
  .results [data-slot="next-block"] { border: 0; padding: 0; }
  .results [data-slot="next-block"] .card-head__icon { display: none; }
  .results .card-title { font-size: 10.5pt; }
  .rgc-must li { font-size: 8.5pt; }
  main > * + * { margin-top: 6pt; }
  /* The lever chart is redrawn at the paper's width with compact rows, so its labels print at 11px. */
  .rgc-chart .chart-row-label, .rgc-chart .chart-value { font-size: 11px; }
  .rgc-chart .chart-tick { font-size: 10px; }
  .results .verdict { padding: 6pt 10pt; }
  .results .chart-title { margin-bottom: 2pt; }
}
