/*
 * PM Tools: shared styles for every tool. Mobile first (works at 360px wide).
 * Fonts come from the theme (Inter for text, Space Grotesk for headings).
 * Amber (--pmt-deadline) is only for deadline and target markers in charts, never for text.
 */

/* pmt:tokens:start - generated from config.json by npm run sync; edit config.json, not this block */
.pmt,
.pmt-pattern,
.pmt-print-sheet {
  --pmt-brand: #1D4ED8;
  --pmt-ink: #111827;
  --pmt-deadline: #F59E0B;
}
/* pmt:tokens:end */

.pmt,
.pmt-pattern,
.pmt-print-sheet {
  --pmt-good: #15803D;
  --pmt-warn: #B45309;
  --pmt-bad: #B91C1C;
  --pmt-muted: #4B5563;
  --pmt-line: #D1D5DB;
  --pmt-field-border: #6B7280;
  --pmt-soft: #F3F4F6;
  --pmt-brand-tint: #EFF6FF;
  --pmt-brand-tint: color-mix(in srgb, var(--pmt-brand) 7%, #fff);
  --pmt-radius: 8px;
  /* Chart series, in this order. Checked for colour-blind separation, 3:1 on white, and kept
     clear of the status colours and the deadline amber. Never used for text. */
  --pmt-series-1: #2A78D6;
  --pmt-series-2: #E4557E;
  --pmt-series-3: #8F9817;
  --pmt-series-4: #544793;
  --pmt-series-5: #AB6CE4;
}

.pmt {
  color: var(--pmt-ink);
  margin: 1.5em 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

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

.pmt [hidden] {
  display: none !important;
}

/* ---------- Tool box ---------- */

.pmt-tool {
  background: #fff;
  border: 1px solid var(--pmt-line);
  border-radius: 12px;
  padding: 16px;
}

.pmt .pmt-title {
  color: var(--pmt-ink);
  font-size: 1.5rem;
  line-height: 1.25;
  margin: 0 0 0.35em;
}

.pmt-intro {
  margin: 0 0 0.5em;
}

.pmt-mode {
  color: var(--pmt-muted);
  font-size: 0.9375em;
  margin: 0 0 1.25em;
}

/* ---------- Fields ---------- */

.pmt-form {
  display: grid;
  gap: 16px;
}

/* Fields sit in grids: one column on phones, two on wider screens (see the media query). */
.pmt-grid {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.pmt-form-lead {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.pmt-form-lead:empty {
  display: none;
}

/* ---------- Choice: a row of radio buttons that looks like a toggle ---------- */

.pmt-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--pmt-soft);
  border-radius: var(--pmt-radius);
}

.pmt-choice-option {
  position: relative;
  display: flex;
  flex: 1 1 0;
  min-width: max-content;
  margin: 0;
}

/* The radio stays in place for the keyboard and screen readers; the text beside it is the target. */
.pmt-choice-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.pmt-choice-option > span {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 6px 12px;
  color: var(--pmt-ink);
  font-weight: 600;
  text-align: center;
  border: 2px solid transparent;
  border-radius: 6px;
}

.pmt-choice-input:checked + span {
  color: var(--pmt-brand);
  background: #fff;
  border-color: var(--pmt-brand);
}

.pmt-choice-input:focus-visible + span {
  outline: 3px solid var(--pmt-brand);
  outline-offset: 2px;
}

/* ---------- Notes beside inputs: not errors, they do not block Calculate ---------- */

.pmt-note {
  margin: 8px 0 0;
  padding: 6px 10px;
  color: var(--pmt-ink);
  font-size: 0.875em;
  background: var(--pmt-soft);
  border-left: 3px solid var(--pmt-muted);
}

/* ---------- Rows that people add and remove ---------- */

.pmt-rows-guide {
  display: grid;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.pmt-rows-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.pmt-rows-list {
  display: grid;
  gap: 8px;
}

/* Small screens: each row is a card. Its title and Remove share the first line, a wide cell
   (the name) has its own line, and the short cells sit side by side. */
.pmt-rows-row {
  display: grid;
  grid-template-columns: repeat(var(--pmt-row-cells, 3), minmax(0, 1fr));
  gap: 6px;
  align-items: end;
  padding: 8px 8px 12px;
  border: 1px solid var(--pmt-line);
  border-radius: var(--pmt-radius);
}

/* The title and Remove share the first line: the title on the left, Remove on the right. */
.pmt-rows-title {
  grid-column: 1 / -1;
  grid-row: 1;
  align-self: center;
  margin: 0;
  padding-right: 7rem;
  font-weight: 700;
}

.pmt .pmt-rows-remove {
  grid-column: 1 / -1;
  grid-row: 1;
  justify-self: end;
  min-height: 36px;
  padding: 4px 8px;
  white-space: nowrap;
  overflow-wrap: normal;
}

.pmt-rows-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pmt-rows-cell-wide,
.pmt-rows-messages {
  grid-column: 1 / -1;
}

/* Three number boxes share a phone's width: less padding leaves room for "100,000". */
.pmt .pmt-rows-cell:not(.pmt-rows-cell-wide) .pmt-input {
  padding-left: 4px;
  padding-right: 4px;
}

.pmt-rows-label {
  font-size: 0.875em;
  font-weight: 600;
}

.pmt-rows-messages .pmt-error,
.pmt-rows-messages .pmt-note {
  margin: 0;
}

.pmt-rows-row-error {
  border-color: var(--pmt-bad);
}

.pmt .pmt-rows-row [aria-invalid="true"] {
  border: 2px solid var(--pmt-bad);
}

.pmt-rows > .pmt-error {
  margin-top: 8px;
}

.pmt-rows-add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 12px;
}

.pmt-rows-add .pmt-help {
  flex: 1 1 220px;
}

/* "Filled 4 rows." or "All rows cleared." with Undo, for 10 seconds. */
.pmt-rows-status:not(:empty) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 8px;
  padding: 6px 12px;
  background: var(--pmt-soft);
  border-left: 3px solid var(--pmt-brand);
}

.pmt .pmt-rows-undo {
  min-height: 36px;
  padding: 4px 8px;
}

/* ---------- Method tabs ---------- */

.pmt-tabs-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pmt-tabs-head .pmt-label {
  margin: 0;
}

.pmt-tabs {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  padding: 4px;
  background: var(--pmt-soft);
  border-radius: var(--pmt-radius);
}

.pmt .pmt-tab {
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 8px 12px;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-transform: none;
  letter-spacing: normal;
  color: var(--pmt-ink);
  background: transparent;
  border: 2px solid transparent;
  border-radius: 6px;
  box-shadow: none;
  cursor: pointer;
}

.pmt .pmt-tab:hover {
  color: var(--pmt-ink);
  background: #fff;
}

.pmt .pmt-tab[aria-selected="true"] {
  color: var(--pmt-brand);
  background: #fff;
  border-color: var(--pmt-brand);
}

.pmt-tabpanel {
  display: grid;
  gap: 16px;
  min-width: 0;
}

/* ---------- Field groups ---------- */

.pmt .pmt-group {
  min-width: 0;
  margin: 0;
  padding: 8px 16px 16px;
  border: 1px solid var(--pmt-line);
  border-radius: var(--pmt-radius);
}

.pmt .pmt-legend {
  padding: 0 4px;
  font-weight: 700;
  color: var(--pmt-ink);
}

.pmt-group > .pmt-help {
  margin-bottom: 12px;
}

.pmt-group > .pmt-error {
  margin-top: 12px;
}

/* ---------- Advanced panel ---------- */

.pmt-advanced {
  min-width: 0;
  border: 1px solid var(--pmt-line);
  border-radius: var(--pmt-radius);
}

.pmt .pmt-advanced-summary {
  display: list-item;
  min-height: 44px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}

.pmt-advanced[open] > .pmt-advanced-summary {
  border-bottom: 1px solid var(--pmt-line);
}

.pmt-advanced-hint {
  display: block;
  color: var(--pmt-muted);
  font-size: 0.875em;
  font-weight: 400;
}

.pmt-advanced-note {
  display: block;
  color: var(--pmt-bad);
  font-size: 0.875em;
}

.pmt-advanced-note:empty {
  display: none;
}

.pmt-advanced > .pmt-grid {
  padding: 16px;
}

.pmt-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.pmt-label {
  font-weight: 600;
}

/* ---------- "?" help: a button after the label, a panel under it ---------- */

.pmt-field-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* The "?" flows right after the label text; the last word and the "?" never split over two lines. */
.pmt-label-row {
  min-width: 0;
}

.pmt-nowrap {
  white-space: nowrap;
}

.pmt .pmt-explain-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  width: 28px;
  height: 28px;
  min-height: 0;
  margin: -4px 0 -4px 8px;
  padding: 0;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  color: var(--pmt-brand);
  background: #fff;
  border: 2px solid var(--pmt-brand);
  border-radius: 50%;
  box-shadow: none;
  cursor: pointer;
}

.pmt .pmt-explain-toggle:hover {
  color: var(--pmt-brand);
  background: var(--pmt-brand-tint);
}

.pmt .pmt-explain-toggle[aria-expanded="true"],
.pmt .pmt-explain-toggle[aria-expanded="true"]:hover {
  color: #fff;
  background: var(--pmt-brand);
}

.pmt-explain {
  margin: 0;
  padding: 10px 12px;
  color: var(--pmt-ink);
  font-size: 0.9375em;
  font-weight: 400;
  line-height: 1.45;
  background: var(--pmt-brand-tint);
  border-left: 3px solid var(--pmt-brand);
  border-radius: 0 6px 6px 0;
}

.pmt-group > .pmt-explain {
  margin: 4px 0 8px;
}

.pmt-help {
  color: var(--pmt-muted);
  font-size: 0.875em;
  line-height: 1.4;
  margin: 0;
}

.pmt .pmt-input {
  font: inherit;
  color: var(--pmt-ink);
  background: #fff;
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--pmt-field-border);
  border-radius: var(--pmt-radius);
  box-shadow: none;
}

.pmt select.pmt-input {
  padding-right: 32px;
}

.pmt-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pmt-unit {
  color: var(--pmt-muted);
  white-space: nowrap;
}

.pmt .pmt-input:focus-visible,
.pmt input[type="checkbox"]:focus-visible,
.pmt .pmt-btn:focus-visible,
.pmt .pmt-tab:focus-visible,
.pmt .pmt-explain-toggle:focus-visible,
.pmt summary:focus-visible,
.pmt a:focus-visible,
.pmt .pmt-notice:focus-visible {
  outline: 3px solid var(--pmt-brand);
  outline-offset: 2px;
}

.pmt-has-error .pmt-input {
  border: 2px solid var(--pmt-bad);
}

.pmt-error {
  color: var(--pmt-bad);
  font-size: 0.875em;
  font-weight: 600;
  margin: 0;
}

.pmt-calc-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.pmt-calc-row .pmt-help {
  flex: 1 1 200px;
}

/* ---------- Buttons ---------- */

.pmt .pmt-btn {
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  padding: 8px 16px;
  border: 2px solid var(--pmt-brand);
  border-radius: var(--pmt-radius);
  background: #fff;
  color: var(--pmt-brand);
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}

.pmt .pmt-btn:hover {
  background: var(--pmt-brand-tint);
  color: var(--pmt-brand);
}

.pmt .pmt-btn-primary {
  background: var(--pmt-brand);
  color: #fff;
}

.pmt .pmt-btn-primary:hover {
  background: #1E40AF;
  background: color-mix(in srgb, var(--pmt-brand) 82%, #000);
  border-color: transparent;
  color: #fff;
}

.pmt .pmt-btn:disabled,
.pmt .pmt-btn:disabled:hover {
  background: #E5E7EB;
  border-color: #9CA3AF;
  color: var(--pmt-muted);
  cursor: not-allowed;
}

.pmt .pmt-btn-quiet,
.pmt .pmt-btn-quiet:hover {
  background: transparent;
  border-color: transparent;
  color: var(--pmt-ink);
  text-decoration: underline;
}

/* ---------- Results ---------- */

.pmt-results {
  border-top: 1px solid var(--pmt-line);
  margin-top: 24px;
  padding-top: 16px;
}

.pmt .pmt-results-title {
  color: var(--pmt-ink);
  font-size: 1.125rem;
  margin: 0 0 0.5em;
}

.pmt-headline {
  margin: 0 0 12px;
  font-size: 1.25em;
  font-weight: 700;
  line-height: 1.35;
}

.pmt-band {
  display: inline-block;
  margin: 0 0 12px;
  padding: 4px 12px;
  border-radius: var(--pmt-radius);
  color: #fff;
  font-weight: 700;
}

.pmt-band-good {
  background: var(--pmt-good);
}

.pmt-band-warn {
  background: var(--pmt-warn);
}

.pmt-band-bad {
  background: var(--pmt-bad);
}

.pmt-band-none {
  background: var(--pmt-muted);
}

/* A band that opens the results, across their full width. */
.pmt-band-banner {
  display: block;
  padding: 10px 14px;
  font-size: 1.125em;
}

.pmt-result-list {
  margin: 0;
}

.pmt-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--pmt-soft);
}

.pmt-row dt {
  margin: 0;
  font-weight: 400;
}

.pmt-row dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pmt-row-main dd {
  color: var(--pmt-brand);
  font-size: 1.5em;
  line-height: 1.2;
}

.pmt-result-extra:empty {
  display: none;
}

/* ---------- Result cards and tables ---------- */

.pmt-stats {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
}

.pmt-stat {
  padding: 12px 14px;
  border: 1px solid var(--pmt-line);
  border-radius: var(--pmt-radius);
}

.pmt-stat p {
  margin: 0;
}

.pmt-stat-label {
  color: var(--pmt-muted);
  font-size: 0.875em;
}

.pmt .pmt-stat-value {
  color: var(--pmt-brand);
  font-size: 1.5em;
  font-weight: 700;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.pmt-stat-note {
  font-size: 0.875em;
}

.pmt .pmt-stat-hint {
  margin-top: 4px;
  color: var(--pmt-muted);
  font-size: 0.875em;
  line-height: 1.4;
}

/* Large cards come first and are coloured by band; the band's name is always written on them. */
.pmt-stats-large {
  display: grid;
  gap: 8px;
  margin: 0 0 8px;
}

.pmt-stat-large {
  padding: 14px 16px;
}

.pmt .pmt-stat-large .pmt-stat-value {
  font-size: 2.25em;
  line-height: 1.15;
}

.pmt-stat-large .pmt-stat-note {
  font-size: 1em;
  font-weight: 700;
}

.pmt-stat-good {
  background: var(--pmt-good);
  border-color: var(--pmt-good);
}

.pmt-stat-warn {
  background: var(--pmt-warn);
  border-color: var(--pmt-warn);
}

.pmt-stat-bad {
  background: var(--pmt-bad);
  border-color: var(--pmt-bad);
}

.pmt .pmt-stat-good p,
.pmt .pmt-stat-warn p,
.pmt .pmt-stat-bad p,
.pmt .pmt-stat-good .pmt-stat-value,
.pmt .pmt-stat-warn .pmt-stat-value,
.pmt .pmt-stat-bad .pmt-stat-value {
  color: #fff;
}

/* Collapsed panels among the results, such as "Other forecasts". */
.pmt-result-panels {
  margin: 8px 0 0;
}

.pmt-result-details .pmt-result-list {
  padding: 0 16px 4px;
}

.pmt-result-details .pmt-row dt {
  flex: 1 1 60%;
}

.pmt-result-details .pmt-row:last-child {
  border-bottom: 0;
}

.pmt-row-hint {
  display: block;
  color: var(--pmt-muted);
  font-size: 0.875em;
  font-weight: 400;
  line-height: 1.4;
}

.pmt-tables {
  display: grid;
  gap: 16px;
  margin: 0 0 8px;
}

.pmt-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.pmt .pmt-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.pmt .pmt-table caption {
  margin-bottom: 4px;
  font-weight: 600;
  text-align: left;
}

/* Words in tables never break in the middle, and numbers with their unit stay on one line. */
.pmt .pmt-table th,
.pmt .pmt-table td {
  padding: 6px 4px;
  text-align: right;
  overflow-wrap: normal;
  border: 0;
  border-bottom: 1px solid var(--pmt-line);
}

.pmt .pmt-table td {
  white-space: nowrap;
}

/* Only very long values and words may wrap, so a table never runs off a phone's screen. */
.pmt .pmt-table td.pmt-table-long {
  white-space: normal;
}

.pmt .pmt-table th.pmt-table-longword {
  min-width: 7em;
  overflow-wrap: anywhere;
}

.pmt .pmt-table th:first-child {
  text-align: left;
}

.pmt .pmt-table thead th {
  color: var(--pmt-muted);
  font-size: 0.875em;
  font-weight: 600;
}

.pmt .pmt-table tbody th {
  font-weight: 400;
}

/* A smaller line under a row's label, such as how a range is worked out. */
.pmt-table-sub {
  display: block;
  color: var(--pmt-muted);
  font-size: 0.8125em;
  font-weight: 400;
  line-height: 1.3;
}

.pmt .pmt-table-highlight th,
.pmt .pmt-table-highlight td {
  font-weight: 700;
  background: var(--pmt-brand-tint);
}

.pmt-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  color: #fff;
  font-size: 0.75em;
  font-weight: 700;
  background: var(--pmt-brand);
  border-radius: 999px;
  vertical-align: 1px;
}

.pmt-result-list:empty {
  display: none;
}

.pmt-result-note {
  margin: 16px 0 0;
  color: var(--pmt-muted);
  font-size: 0.9375em;
}

/* ---------- Charts ---------- */

.pmt-chart-title {
  margin: 4px 0 6px;
  font-weight: 600;
}

/* One stacked bar; 2px white gaps keep neighbouring segments apart. */
.pmt-stack {
  display: flex;
  gap: 2px;
  height: 28px;
  margin: 0 0 8px;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}

.pmt-stack-segment {
  flex: 1 1 0;
  min-width: 3px;
}

.pmt-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border-radius: 3px;
  vertical-align: -1px;
}

.pmt-series-1 {
  background: var(--pmt-series-1);
}

.pmt-series-2 {
  background: var(--pmt-series-2);
}

.pmt-series-3 {
  background: var(--pmt-series-3);
}

.pmt-series-4 {
  background: var(--pmt-series-4);
}

.pmt-series-5 {
  background: var(--pmt-series-5);
}

/* ---------- Warnings ---------- */

.pmt-warnings {
  margin: 16px 0 0;
  padding: 12px 16px;
  border-left: 4px solid var(--pmt-warn);
  border-radius: 0 var(--pmt-radius) var(--pmt-radius) 0;
  background: var(--pmt-soft);
}

.pmt .pmt-warnings-title {
  margin: 0 0 4px;
  color: var(--pmt-ink);
  font-size: 1rem;
}

.pmt-warnings ul {
  margin: 0;
  padding-left: 1.25em;
}

.pmt-warnings li + li {
  margin-top: 4px;
}

.pmt-stale {
  color: var(--pmt-muted);
  font-style: italic;
  margin: 12px 0 0;
}

.pmt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.pmt-action-status p {
  margin: 12px 0 0;
}

.pmt-link-box,
.pmt-copy-box {
  margin-top: 8px;
}

.pmt-link-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pmt-privacy-line {
  color: var(--pmt-muted);
  font-size: 0.875em;
  margin: 16px 0 0;
}

/* ---------- Email unlock panel ---------- */

.pmt-unlock {
  margin-top: 16px;
  padding: 16px;
  border: 2px solid var(--pmt-brand);
  border-radius: 12px;
  background: var(--pmt-brand-tint);
}

.pmt .pmt-unlock-title {
  color: var(--pmt-ink);
  font-size: 1.125rem;
  margin: 0 0 0.25em;
}

.pmt-unlock-lead {
  margin: 0 0 12px;
}

.pmt-unlock-form {
  display: grid;
  gap: 12px;
}

.pmt-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 4px;
  align-items: start;
}

.pmt-check input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--pmt-brand);
}

.pmt-check .pmt-help,
.pmt-check .pmt-error {
  grid-column: 2;
}

.pmt-unlock-note {
  color: var(--pmt-muted);
  font-size: 0.875em;
  margin: 0;
}

.pmt-unlock-note a {
  color: var(--pmt-brand);
}

.pmt-unlock-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pmt-unlock-message {
  margin: 0;
}

.pmt-unlock-message:empty {
  display: none;
}

.pmt-unlock-message-error {
  color: var(--pmt-bad);
  font-weight: 600;
}

.pmt-notice {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-left: 4px solid var(--pmt-good);
  background: #F0FDF4;
  color: var(--pmt-ink);
}

.pmt-notice:empty {
  display: none;
}

/* Honeypot field: off screen, out of the tab order and hidden from screen readers. */
.pmt-hp {
  position: absolute !important;
  left: -10000px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Template library ---------- */

.pmt-library-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.pmt-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--pmt-line);
  border-radius: 12px;
}

.pmt .pmt-card-title {
  color: var(--pmt-ink);
  font-size: 1.125rem;
  margin: 0;
}

.pmt-card-text {
  margin: 0;
}

.pmt-card .pmt-actions {
  margin-top: auto;
  padding-top: 8px;
}

/* ---------- Helpers ---------- */

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

/* ---------- Wider screens ---------- */

@media (min-width: 640px) {
  .pmt-tool {
    padding: 24px;
  }

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

  .pmt-grid-group {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .pmt-field-wide {
    grid-column: 1 / -1;
  }

  /* Rows: one line each, with the cells under the guide's column names. */
  .pmt-rows-guide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pmt-rows-row {
    grid-template-columns: var(--pmt-row-columns);
    gap: 6px 8px;
    align-items: end;
    padding: 0;
    border: 0;
    border-radius: 0;
  }

  .pmt-rows-row + .pmt-rows-row {
    padding-top: 8px;
    border-top: 1px solid var(--pmt-soft);
  }

  .pmt-rows-row-error {
    border-color: var(--pmt-soft);
  }

  .pmt-rows-title {
    grid-column: auto;
    grid-row: auto;
    align-self: end;
    padding: 0 0 10px;
    font-weight: 600;
  }

  .pmt .pmt-rows-remove {
    grid-column: auto;
    grid-row: auto;
    align-self: end;
    min-height: 44px;
  }

  .pmt-rows-cell-wide {
    grid-column: auto;
  }

  .pmt .pmt-rows-cell:not(.pmt-rows-cell-wide) .pmt-input {
    padding-left: 12px;
    padding-right: 12px;
  }

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

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

  .pmt .pmt-table th,
  .pmt .pmt-table td {
    padding: 6px 8px;
  }

  .pmt .pmt-table td.pmt-table-long {
    white-space: nowrap;
  }

  /* Side-by-side fields line up label, help, input and error, even when a help line wraps. */
  @supports (grid-template-rows: subgrid) {
    .pmt-grid > .pmt-field:not(.pmt-field-wide) {
      display: grid;
      grid-row: span 4;
      grid-template-rows: subgrid;
      row-gap: 4px;
    }

    /* When a neighbour's help panel is open, a label stays next to its own help and input. */
    .pmt-grid > .pmt-field:not(.pmt-field-wide) > .pmt-field-head {
      align-self: end;
    }
  }

  .pmt-unlock-form {
    max-width: 560px;
  }

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

/* ---------- Block patterns (inserted from the editor's Patterns panel) ----------
   Core blocks with these classes. Text keeps the theme's fonts and sizes. */

.pmt-pattern {
  color: var(--pmt-ink);
}

.pmt-pattern a:not(.wp-element-button) {
  color: var(--pmt-brand);
}

.pmt-hero {
  padding: 24px 0;
}

.pmt-hero .pmt-hero-lead {
  max-width: 40em;
  color: var(--pmt-muted);
  font-size: 1.125em;
}

.pmt-hero .wp-block-buttons {
  margin: 16px 0 24px;
}

.pmt-hero .wp-block-button__link {
  background: var(--pmt-brand);
  color: #fff;
}

/* One column on phones, as many 16rem cards as fit on wider screens. */
.pmt-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: 16px;
}

.pmt-pattern .pmt-card-grid > * {
  margin: 0;
}

.pmt-tool-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--pmt-line);
  border-radius: 12px;
}

.pmt-tool-card > * {
  margin: 0;
}

.pmt-tool-card .pmt-tool-card-link {
  margin-top: auto;
  font-weight: 600;
}

.pmt-tool-page > h2 {
  margin-top: 2em;
}

.pmt-tool-page .pmt-page-intro {
  font-size: 1.125em;
}

.pmt-related {
  margin-top: 2.5em;
}

.pmt-cta,
.pmt-newsletter {
  padding: 24px;
  border-radius: 12px;
}

.pmt-cta {
  margin: 2.5em 0;
  background: var(--pmt-brand-tint);
  border: 2px solid var(--pmt-brand);
}

.pmt-newsletter {
  background: var(--pmt-soft);
}

.pmt-cta > *,
.pmt-newsletter > * {
  margin-top: 0;
}

/* A sign-up inside a box that has its own heading: no second frame around the form. */
.pmt-unlock-compact {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
}

.pmt-author {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin: 2.5em 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--pmt-line);
}

.pmt-author .pmt-author-photo {
  margin: 0;
}

.pmt-author .pmt-author-photo img {
  width: 72px;
  height: 72px;
  object-fit: cover;
}

.pmt-author-text > * {
  margin: 0 0 4px;
}

@media (min-width: 640px) {
  .pmt-hero {
    padding: 48px 0;
  }

  .pmt-author {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 20px;
  }

  .pmt-author .pmt-author-photo img {
    width: 96px;
    height: 96px;
  }
}

/* ---------- Printing (Export PDF) ---------- */

.pmt-print-sheet {
  display: none;
}

@media print {
  .pmt-noprint,
  .pmt-unlock-slot,
  .pmt-action-status {
    display: none !important;
  }

  html.pmt-printing,
  html.pmt-printing body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  /* Only the inputs, results and site name are printed. */
  html.pmt-printing body > *:not(.pmt-print-sheet) {
    display: none !important;
  }

  html.pmt-printing .pmt-print-sheet {
    display: block;
    color: #000;
    font-size: 11pt;
    line-height: 1.45;
  }

  .pmt-print-sheet .pmt-print-brand {
    font-size: 14pt;
    font-weight: 700;
    margin: 0 0 12pt;
    padding-bottom: 6pt;
    border-bottom: 2px solid var(--pmt-brand);
  }

  .pmt-print-sheet h1 {
    font-size: 18pt;
    margin: 0 0 12pt;
  }

  .pmt-print-sheet h2 {
    font-size: 13pt;
    margin: 14pt 0 6pt;
  }

  .pmt-print-sheet dl {
    margin: 0;
  }

  .pmt-print-sheet .pmt-row {
    display: flex;
    justify-content: space-between;
    gap: 12pt;
    padding: 4pt 0;
    border-bottom: 1px solid #ccc;
    break-inside: avoid;
  }

  .pmt-print-sheet dt,
  .pmt-print-sheet dd {
    margin: 0;
  }

  .pmt-print-sheet dd {
    font-weight: 700;
  }

  .pmt-print-sheet .pmt-headline {
    font-size: 12pt;
    font-weight: 700;
    margin: 0 0 8pt;
  }

  /* Background colours often do not print, so the band keeps its text and gets a border. */
  .pmt-print-sheet .pmt-band {
    display: inline-block;
    background: none !important;
    color: #000 !important;
    border: 1.5pt solid #000;
    border-radius: 4pt;
    padding: 2pt 10pt;
    margin: 0 0 8pt;
    font-weight: 700;
  }

  /* The chart and its swatches are colour, so ask the browser to print it. */
  .pmt-print-sheet .pmt-stack,
  .pmt-print-sheet .pmt-swatch {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .pmt-print-sheet .pmt-stack {
    display: flex;
    gap: 2px;
    height: 16pt;
    margin: 0 0 6pt;
  }

  .pmt-print-sheet .pmt-chart-title {
    margin: 6pt 0 4pt;
    font-weight: 700;
  }

  .pmt-print-sheet .pmt-warnings {
    margin-top: 10pt;
    padding: 6pt 10pt;
    border-left: 3pt solid #000;
    background: none;
  }

  .pmt-print-sheet .pmt-warnings-title {
    font-size: 11pt;
    margin: 0 0 2pt;
  }

  .pmt-print-sheet .pmt-band-banner {
    font-size: 12pt;
  }

  .pmt-print-sheet .pmt-stats,
  .pmt-print-sheet .pmt-stats-large {
    display: flex;
    flex-wrap: wrap;
    gap: 8pt 16pt;
    margin: 0 0 8pt;
  }

  .pmt-print-sheet .pmt-stat {
    flex: 1 1 30%;
    break-inside: avoid;
  }

  .pmt-print-sheet .pmt-stat p {
    margin: 0;
  }

  .pmt-print-sheet .pmt-stat-value {
    font-size: 13pt;
    font-weight: 700;
  }

  /* Background colours often do not print: coloured cards get a border, and say their band in words. */
  .pmt-print-sheet .pmt-stat-good,
  .pmt-print-sheet .pmt-stat-warn,
  .pmt-print-sheet .pmt-stat-bad {
    padding: 4pt 8pt;
    border: 1.5pt solid #000;
  }

  .pmt-print-sheet .pmt-stat-note {
    font-weight: 700;
  }

  .pmt-print-sheet .pmt-stat-hint,
  .pmt-print-sheet .pmt-row-hint,
  .pmt-print-sheet .pmt-table-sub {
    display: block;
    font-size: 9pt;
    color: #333;
  }

  .pmt-print-sheet .pmt-advanced > summary {
    margin-top: 8pt;
    font-weight: 700;
    list-style: none;
  }

  .pmt-print-sheet .pmt-advanced-summary::-webkit-details-marker {
    display: none;
  }

  .pmt-print-sheet .pmt-table {
    width: 100%;
    margin: 6pt 0;
    border-collapse: collapse;
  }

  .pmt-print-sheet .pmt-table caption {
    font-weight: 700;
    text-align: left;
  }

  .pmt-print-sheet .pmt-table th,
  .pmt-print-sheet .pmt-table td {
    padding: 2pt 4pt;
    text-align: right;
    border-bottom: 1px solid #ccc;
  }

  .pmt-print-sheet .pmt-table th:first-child {
    text-align: left;
  }

  .pmt-print-sheet .pmt-tag {
    margin-left: 4pt;
    padding: 0 4pt;
    border: 1px solid #000;
    border-radius: 4pt;
  }

  .pmt-print-sheet .pmt-result-note {
    margin-top: 8pt;
  }

  .pmt-print-sheet .pmt-print-foot {
    margin-top: 18pt;
    font-size: 9pt;
    color: #333;
  }
}
