/* Growth Plan Tracker: only what shell.css lacks. Palette, faces and the 16px gutter come from the shell. */

/* ---------- Set-up and check-in screens ---------- */
.pci-intro { max-width: 44rem; margin: -8px 0 28px; color: var(--deep-plum); }
.pci-narrow { max-width: 22rem; }
.pci-help-top { margin: -8px 0 20px; max-width: 44rem; }
.pci-detail-intro { max-width: 44rem; margin: 0 0 16px; }
.pci-note { margin: 0 0 24px; padding: 16px 20px; border-radius: var(--radius-tile); background: var(--soft-mint); max-width: 52rem; }
.pci-note p + p { margin-top: 8px; }

.pci-bets { display: grid; gap: 20px; }
.pci-bet {
  position: relative; margin: 0; min-width: 0; padding: 20px 24px 24px;
  border: 1px solid rgba(188, 182, 206, 0.7); border-radius: var(--radius-tile); background: var(--white);
}
.pci-bet__legend { float: left; width: 100%; padding: 0; margin: 0 0 16px; font-weight: 500; font-size: 1.125rem; color: var(--forest-dark); }
.pci-bet__legend + * { clear: both; }
.pci-bet__remove { position: absolute; top: 20px; right: 24px; }
.pci-bet__body { clear: both; display: grid; gap: 16px; }
.pci-bet__body > .field-grid { margin: 0; }
.pci-bet .field-grid { gap: 16px 20px; }
.pci-bet fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
.pci-bet fieldset.field > legend { font-weight: 500; margin-bottom: 8px; padding: 0; }
.pci-stop { margin: 0; }
.pci-add { margin-top: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.pci-add__button[disabled] { opacity: 0.5; cursor: not-allowed; }
.pci-add .field-help { margin: 0; }

.pci-ci-bet { border: 0; padding: 0; min-width: 0; }
.pci-ci-bet + .pci-ci-bet { padding-top: 24px; border-top: 1px solid rgba(188, 182, 206, 0.6); }
.pci-ci-bet__legend { float: left; width: 100%; padding: 0; margin: 0 0 4px; font-weight: 500; font-size: 1.125rem; color: var(--forest-dark); }
.pci-betline { clear: both; margin: 0 0 16px; max-width: 44rem; color: var(--deep-plum); font-variant-numeric: tabular-nums; }

/* ---------- The plan link box ---------- */
.pci-link-card { margin-bottom: 24px; }
.pci-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; max-width: 52rem; margin: 16px 0 12px; }
.pci-link__input { font-size: 0.875rem; color: var(--deep-plum); background: var(--white); text-overflow: ellipsis; min-width: 0; }
.pci-link__line { margin: 0; font-weight: 500; }
.pci-link__privacy { margin: 6px 0 0; color: var(--cool-gray); font-size: 0.9375rem; }
.pci-link__status { margin: 8px 0 0; font-weight: 500; font-size: 0.9375rem; }
.pci-link__status:empty { display: none; }
.pci-changed { margin: 0 0 8px; padding: 10px 14px; border-radius: var(--radius-tile); background: var(--soft-mint); max-width: 52rem; }

/* ---------- Results ---------- */
.pci-care { font-weight: 500; }
.pci-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.pci-stats .stat__value { white-space: normal; }
.pci-card-intro { max-width: 44rem; margin: -6px 0 16px; }

.pci-chip {
  display: inline-flex; align-items: center; min-height: 26px; padding: 2px 12px;
  border-radius: 999px; font-size: 0.8125rem; font-weight: 500; line-height: 1.2; white-space: nowrap;
  border: 1px solid transparent; color: var(--forest-dark);
}
.pci-chip--up { background: var(--soft-mint); }
.pci-chip--neutral { background: #EEF7FB; border-color: var(--sky-blue); color: var(--ocean-blue); }
.pci-chip--down { background: var(--white); border: 2px solid var(--amber); color: var(--deep-plum); }
.pci-chip--down::before { content: ""; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--amber); flex: none; }
.pci-goal-status { margin: 0 0 12px; }

/* Pace chart: a bar for progress on a light track, a dark tick where a steady pace would be. */
.pci-track { fill: #F3F1F7; }
.pci-track-grid { stroke: var(--white); stroke-width: 2; }
.pci-tick { stroke: var(--deep-plum); stroke-width: 3; stroke-linecap: round; }
.pci-row-text { font-size: 13.5px; fill: var(--deep-plum); font-variant-numeric: tabular-nums; }
.pci-row-name { font-weight: 500; fill: var(--forest-dark); }
/* The print copy of the chart (drawn at a fixed 680 wide, see growth-plan-tracker.js): 11px and 10px there print at about
   8.5pt and 7.5pt on Letter or A4, the size of the text around it. */
.pci-pace-print .pci-row-text { font-size: 11px; }
.pci-pace-print .chart-tick { font-size: 10px; }
.pci-swatch-bar { background: linear-gradient(to right, var(--primary-green) 0 33%, var(--ocean-blue) 33% 66%, var(--amber) 66%); }
.pci-swatch-tick { width: 4px; height: 16px; border-radius: 2px; background: var(--deep-plum); }

/* The shell's bar chart draws its zero line a few pixels in from the row labels, so the line ran through the gap
   between words in each bet's name (the label halo covers glyphs, not spaces). Every value here is 0 or more, so the
   bars already start at one left edge; this chart drops the line. */
[data-slot="spend"] .chart-zero { stroke: none; }

/* Bet table: a grid on wide screens, one block per bet below 960px. */
/* Ten columns fit the 1440 card without scrolling: small type, tight cells, the word columns wrap. */
.pci-table { width: 100%; min-width: 760px; font-size: 0.8125rem; line-height: 1.35; }
.pci-table th, .pci-table td { padding: 10px 6px; }
.pci-table th:first-child, .pci-table td:first-child { padding-left: 0; }
.pci-table thead th { white-space: normal; vertical-align: bottom; color: var(--deep-plum); font-size: 0.75rem; }
.pci-table tbody th[scope="row"] { min-width: 8.5rem; max-width: 11rem; vertical-align: top; text-align: left; }
.pci-table td { vertical-align: top; }
/* td 7 is Pace needed from here and td 9 Cost to finish: the two word cells (Spent so far, td 8, never wraps). */
.pci-table td:nth-of-type(7), .pci-table td:nth-of-type(9) { min-width: 7.5rem; }
.pci-table .pci-chip { white-space: nowrap; padding: 2px 8px; font-size: 0.75rem; }
.pci-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pci-table td:nth-of-type(2) { white-space: normal; min-width: 5rem; }
.pci-bet-name { display: block; font-weight: 500; }
.pci-bet-sub { display: block; font-size: 0.8125rem; font-weight: 400; color: var(--cool-gray); }

.pci-lines { margin: 0; padding-left: 1.2em; max-width: 52rem; }
.pci-lines li + li { margin-top: 8px; }
.pci-questions { margin: 0; padding-left: 1.4em; max-width: 52rem; }
.pci-questions li + li { margin-top: 10px; }
.pci-handoff-lead { margin: 16px 0 6px; }
.results-body .card > .handoff { margin-top: 16px; }

/* The shell hides each chart's data table with position: absolute and a 1px width; clip the figure so a wide table
   never adds to the page's scroll width. */
@media screen {
  .results .chart { position: relative; overflow: hidden; }
}

/* ---------- Phones ---------- */
@media (max-width: 700px) {
  .pci-stats .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .pci-bet { padding: 16px; }
  .pci-bet__remove { position: static; margin: 0 0 12px; justify-self: start; }
  .pci-bet .field-grid, .pci-bet .field-grid--3 { grid-template-columns: minmax(0, 1fr); }
  .pci-link { grid-template-columns: minmax(0, 1fr); }
  .pci-link .link-action { justify-self: start; }
}

/* One block per bet wherever the ten columns can't fit the card. The card's inner width drops below the table's
   ~840px at a 960px window; at 900 the last column was cut off behind a sideways scroll inside the card. */
@media screen and (max-width: 960px) {
  .pci-table-wrap { overflow: visible; }
  .pci-table, .pci-table caption, .pci-table tbody, .pci-table tr, .pci-table th, .pci-table td { display: block; min-width: 0; width: auto; max-width: none; }
  .pci-table caption { text-align: left; padding: 0 0 8px; }
  .pci-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .pci-table tbody tr { padding: 14px 0; border-top: 1px solid rgba(188, 182, 206, 0.6); }
  .pci-table tbody tr:first-child { border-top: 0; padding-top: 0; }
  .pci-table tbody th[scope="row"] { padding: 0 0 8px; border: 0; max-width: none; }
  /* Stacked, the bet's name heads its block: a step up from the 13px rows under it so each block starts clearly. */
  .pci-table .pci-bet-name { font-size: 1rem; color: var(--forest-dark); }
  .pci-table td:nth-of-type(n) { min-width: 0; }
  .pci-table td { display: grid; grid-template-columns: min(42%, 13rem) minmax(0, 1fr); gap: 12px; padding: 4px 0; border: 0; white-space: normal; text-align: left; }
  .pci-table td::before { content: attr(data-label); font-weight: 500; color: var(--deep-plum); font-size: 0.875rem; }
  .pci-table .pci-chip { justify-self: start; white-space: normal; }
}

/* ---------- Print: the worked example on one page ----------
   Everything the spec lists prints (verdict, key numbers, pace chart, goal, bet table, stop lines, questions, next
   steps, limits), at small print sizes. The questions and next steps sit side by side, the stop lines above the
   questions. */
@media print {
  @page { margin: 9mm; }
  html, body { font-size: 8pt; line-height: 1.25; }
  main > * + * { margin-top: 6pt; }
  .pci-link-card, .pci-note { display: none !important; }
  .print-title { font-size: 15pt; }
  .print-sub { margin-bottom: 4pt; }

  .results-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 4pt 6pt; align-items: start; font-size: 8pt; line-height: 1.25; }
  .results-body > * { grid-column: 1 / -1; }
  .results-body > .card + .card, .results-body > * + * { margin-top: 0; }
  .results-body > [data-slot="stops"], .results-body > [data-slot="questions"] { grid-column: 1; }
  .results-body > [data-slot="next"] { grid-column: 2; grid-row: span 2; }
  .results-body > [hidden], .results-body > [data-print="hide"], .results-body [data-slot="notes"],
  .results-body .handoff, .pci-handoff-lead { display: none !important; }
  .results-body p, .results-body li { font-size: 8pt; line-height: 1.25; }

  .results-body .card { padding: 4pt 9pt; break-inside: avoid; }
  .results-body .card > .card-head { margin-bottom: 3pt; }
  .results-body .card > .card-head .card-head__icon { display: none; }
  .results-body .card > .card-head .card-title { font-size: 10pt; }

  .results-body .verdict { padding: 6pt 10pt; }
  .results-body .verdict__label { margin-bottom: 1pt; font-size: 7.5pt; }
  .results-body .verdict__headline { font-size: 10.5pt; margin-bottom: 2pt; }
  .results-body .verdict__sub { font-size: 8pt; }
  .verdict__sub + .verdict__sub { margin-top: 1pt; }

  .pci-stats { gap: 4pt; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .pci-stats .stat { padding: 2pt 6pt; }
  .pci-stats .stat__value { font-size: 10.5pt; }
  .pci-stats .stat__label { font-size: 7pt; margin-top: 0; }

  /* The pace chart's data table repeats the bet table's Progress, Time used and Status columns, which print just
     below it, so on paper the chart keeps its bars and labels and drops the duplicate table, title and legend. */
  .pci-pace .chart-table, .pci-pace .chart-title, .pci-pace .chart-legend { display: none !important; }

  [data-slot="goal"] p { margin: 0 0 1pt; }
  .pci-goal-status { display: inline-block; margin: 0 6pt 0 0; }
  [data-slot="goal"] .pci-goal-status + p { display: inline; }

  .pci-table { min-width: 0; font-size: 7pt; line-height: 1.25; }
  .pci-table caption { display: none; }
  .pci-table th, .pci-table td { padding: 1pt 3pt; }
  .pci-table thead th { font-size: 6.5pt; }
  .pci-table tbody th[scope="row"] { min-width: 0; max-width: none; width: 25%; }
  .pci-num { white-space: normal; }
  .pci-chip, .pci-table .pci-chip { min-height: 0; padding: 0 4pt; font-size: 6.5pt; white-space: normal; }
  .pci-chip--down::before { width: 5pt; height: 5pt; margin-right: 3pt; }
  .pci-bet-name { display: block; }
  .pci-bet-sub { display: inline; font-size: 6.5pt; }
  .pci-bet-sub + .pci-bet-sub::before { content: " \0B7  "; }

  .pci-card-intro { font-size: 7.5pt; margin: 0 0 2pt; }
  .results-body .pci-lines li, .results-body .pci-questions li { font-size: 7.5pt; }
  .pci-lines li + li, .pci-questions li + li { margin-top: 1pt; }

  .results-body [data-slot="next"] .next-steps { display: grid; gap: 3pt; }
  .results-body [data-slot="next"] .next-steps > * + * { margin-top: 0; }
  .results-body [data-slot="next"] .next-step { padding: 2pt 5pt; border-radius: 5pt; }
  .results-body [data-slot="next"] .next-step h4 { display: inline; font-size: 7.5pt; margin: 0; }
  .results-body [data-slot="next"] .next-step h4::after { content: ". "; }
  .results-body [data-slot="next"] .next-step p { display: inline; font-size: 7.5pt; line-height: 1.25; }

  /* With the chart's print copy at a readable size, the section padding around the limits is what pushed the
     footer line onto a second sheet. */
  .section:has(> .limits) { padding-top: 2pt; padding-bottom: 0; }
  .print-footer { margin-top: 3pt; }
  /* A run-in heading, as the next-step tiles print theirs, saves the line the footer needed. */
  .limits h2 { display: inline; font-size: 8pt; font-family: var(--font-text); font-weight: 700; margin: 0; }
  .limits h2::after { content: ". "; }
  .limits p { display: inline; font-size: 7.5pt; line-height: 1.3; }
}
