/* =====================================================================
   Debt Snowball Planner
   Extra styles for this tool only. Everything else comes from
   /assets/styles.css. Colours are always the shared CSS variables, so
   dark mode and any rebrand carry straight through.
   ===================================================================== */

.dp { padding: 2rem 0 1rem; }
.dp-intro .small.muted { margin: 1rem 0 0; }
.dp-counts p { margin-bottom: 0.5rem; }

/* ----- Form fields ----- */

.dp-fields { display: grid; gap: 0 1rem; }
@media (min-width: 36rem) {
  .dp-fields { grid-template-columns: 1fr 1fr; }
  .dp-span { grid-column: 1 / -1; }
}
.dp-hint {
  margin: -0.2rem 0 0.4rem;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-muted);
}
.dp-affix { position: relative; }
.dp-affix > span {
  position: absolute;
  top: 0; bottom: 0;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
}
.dp-affix-pre > span { left: 1rem; }
.dp-affix-pre input { padding-left: 2.1rem; }
.dp-affix-post > span { right: 1rem; }
.dp-affix-post input { padding-right: 2.4rem; }
.dp input[aria-invalid="true"] { border-color: var(--accent); }
.dp-error {
  margin: 0.4rem 0 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}

/* ----- The list of debts ----- */

.dp-debt-list { margin: 0 0 0.5rem; padding: 0; list-style: none; }
.dp-debt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.25rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.dp-debt:first-child { border-top: 1px solid var(--border); }
.dp-debt.is-editing {
  margin: 0 -0.75rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  border-radius: var(--radius-small);
  background: var(--primary-soft);
}
.dp-debt-name { display: block; font-weight: 600; line-height: 1.3; color: var(--heading); overflow-wrap: anywhere; }
.dp-debt-meta { display: block; font-size: 15px; color: var(--text-muted); }
.dp-debt-actions { display: flex; gap: 1.25rem; }
.dp-empty { margin-bottom: 0.5rem; }

.dp-example {
  margin-top: 0.5rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-medium);
  background: var(--surface-alt);
}
.dp-example p { margin-bottom: 0.75rem; }
.dp-full {
  margin-top: 1rem;
  padding: 0.9rem 1.1rem;
  border-left: 6px solid var(--care-border);
  border-radius: 0 var(--radius-medium) var(--radius-medium) 0;
  background: var(--care-bg);
}

.dp-add {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.dp-add h3 { margin-bottom: 1rem; }
.dp-add .dp-error:not([hidden]) + .button-row { margin-top: 0.75rem; }

/* ----- Extra and the tick boxes ----- */

.dp-signs { margin-top: 1.5rem; }
.dp-signs legend { padding: 0; margin-bottom: 0.4rem; }
.dp-signs > p { margin-bottom: 1rem; }
.dp-show .form-status { margin-top: 0.75rem; }

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

.dp-headline {
  margin-bottom: 0.6rem;
  font-size: clamp(2rem, 7.5vw, 2.9rem);
  line-height: 1.15;
}
.dp-headline-date {
  display: inline-block;
  padding: 0 0.35em;
  border-radius: 999px;
  background: var(--band-btn);
  color: var(--band-btn-text);
  line-height: 1.2;
}
.dp-away { font-size: 18px; font-weight: 600; }
.dp-hero > * { position: relative; }
.dp-hero .muted { color: var(--band-muted); }

.dp-stat {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.75rem;
  margin: 1.25rem 0 1rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-medium);
  background: var(--band-line);
}
.dp-stat-label { font-weight: 600; }
.dp-stat-value {
  font-family: var(--font-heading);
  color: var(--band-heading);
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.dp-stat-note { flex-basis: 100%; font-size: 15px; color: var(--band-text); }  /* full text colour: muted is under 4.5:1 on the tinted tile */

.dp-warning {
  margin: 1rem 0 0;
  padding: 0.9rem 1.1rem;
  border-left: 6px solid var(--care-border);
  border-radius: 0 var(--radius-medium) var(--radius-medium) 0;
  background: var(--care-bg);
  color: var(--text);
}
/* On the Deep Forest block the panel stays light, so its text stays dark */
.band .dp-warning { background: var(--mim-cream); color: var(--mim-ink); }

.dp-order .ladder-title { overflow-wrap: anywhere; }
.dp-order .ladder-desc + .ladder-desc { margin-top: 0.15rem; }

.dp-chart { position: relative; height: 260px; margin: 1rem 0 0.5rem; }
@media (min-width: 40rem) { .dp-chart { height: 300px; } }
.dp-table-details { margin-top: 1rem; }
.dp-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.dp-table th, .dp-table td {
  padding: 0.45rem 0.25rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.dp-table th { font-weight: 600; color: var(--text-muted); }
.dp-table td:last-child, .dp-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.dp-table tr:last-child td { border-bottom: 0; }

.dp-whatif .button-row .btn { flex: 1 1 7rem; }
.dp-whatif .btn[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.dp-whatif-result { margin: 1rem 0 0; font-weight: 600; }
.dp-whatif-result:empty { margin: 0; }

/* =====================================================================
   The printed plan (built by planner.js, laid out by assets/pdf.js)
   Inside .pdf-sheet the variables are always the light-mode ones.
   ===================================================================== */

/* Lets the footer block sit at the bottom of the page */
.pdf-body:has(> .dp-pdf-end) { display: flex; flex-direction: column; }

.dp-pdf-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  padding: 14px 20px 16px;
  border-radius: 16px;
  background: var(--mim-lime);
}
.dp-pdf-hero p { margin: 0; }
.pdf-body .dp-pdf-label {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mim-forest);
}
.pdf-body .dp-pdf-date {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 46px;
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--mim-forest);
}
.pdf-body .dp-pdf-date.is-long { font-size: 26px; }
.dp-pdf-stats {
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: right;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--mim-forest);
}
.dp-pdf-stats li:first-child { font-weight: 600; }

.pdf-body .dp-pdf-hint { margin-top: -4px; margin-bottom: 6px; }

.dp-pdf-debts { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.dp-pdf-debt {
  display: grid;
  grid-template-columns: 16px 22px minmax(0, 1fr) auto 146px;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.dp-pdf-debt .dp-pdf-tick { margin-top: 0; }
.dp-pdf-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 7px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 11px;
  font-weight: 900;
}
.dp-pdf-text { display: block; min-width: 0; line-height: 1.25; }
.dp-pdf-name { display: block; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.dp-pdf-meta { display: block; font-size: 11px; color: var(--text-muted); }
.dp-pdf-cells { display: flex; gap: 3px; }
.dp-pdf-cell {
  display: block;
  width: 19px; height: 19px;
  border: 1.5px solid var(--primary);
  border-radius: 3px;
}
.dp-pdf-clears { text-align: right; font-size: 12px; font-weight: 600; white-space: nowrap; }

/* Row sizes: planner.js picks the roomiest one that fits on the page */
.dp-pdf-debts.is-roomy .dp-pdf-debt { padding: 12px 0; }
.dp-pdf-debts.is-roomy .dp-pdf-name { font-size: 15px; }
.dp-pdf-debts.is-roomy .dp-pdf-meta { font-size: 12px; }
.dp-pdf-debts.is-roomy .dp-pdf-cell { width: 22px; height: 22px; }
.dp-pdf-debts.is-many .dp-pdf-debt { padding: 4px 0; }
.dp-pdf-debts.is-many .dp-pdf-cell { width: 16px; height: 16px; }
.dp-pdf-debts.is-many .dp-pdf-name { font-size: 12.5px; }
.dp-pdf-debts.is-dense .dp-pdf-debt { padding: 1px 0; gap: 8px; }
.dp-pdf-debts.is-dense .dp-pdf-text { line-height: 1.12; }
.dp-pdf-debts.is-dense .dp-pdf-name { font-size: 12px; }
.dp-pdf-debts.is-dense .dp-pdf-meta { font-size: 10.5px; }
.dp-pdf-debts.is-dense .dp-pdf-cell { width: 15px; height: 15px; }
.dp-pdf-debts.is-dense .dp-pdf-clears { font-size: 11px; }
/* With the most rows, the pledge and footer give up a little space too */
.pdf-body:has(.is-dense) .dp-pdf-pledge { padding: 8px 16px 10px; gap: 6px 24px; }
.pdf-body:has(.is-dense) .dp-pdf-pledge-title { font-size: 17px; }
.pdf-body:has(.is-dense) .dp-pdf-rule { height: 20px; }
.pdf-body:has(.is-dense) .dp-pdf-end { padding-top: 8px; }
.pdf-body:has(.is-dense) .dp-pdf-end .pdf-quote { margin-bottom: 4px; }
.pdf-body:has(.is-squeezed) .dp-pdf-hint { display: none; }

.dp-pdf-months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; }
.dp-pdf-month {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 6px 2px 8px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.dp-pdf-month .dp-pdf-cell { width: 18px; height: 18px; border-width: 2px; }
.dp-pdf-month.is-free { border-color: var(--mim-forest); background: var(--mim-lime); color: var(--mim-forest); }
.dp-pdf-month.is-after { opacity: 0.45; }
.dp-pdf-free { font-size: 9.5px; font-weight: 600; line-height: 18px; color: var(--mim-forest); }

.dp-pdf-pledge {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 12px 28px;
  margin-top: 4px;
  padding: 12px 18px 16px;
  border: 2px solid var(--primary);
  border-radius: 16px;
}
.pdf-body .dp-pdf-pledge p { margin: 0; }
.pdf-body .dp-pdf-pledge-title {
  grid-column: 1 / -1;
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 900;
  color: var(--text);
}
.dp-pdf-line { display: flex; align-items: flex-end; gap: 8px; font-size: 12px; font-weight: 600; }
.dp-pdf-line-wide { grid-column: 1 / -1; }
.dp-pdf-rule { flex: 1; height: 24px; border-bottom: 1.5px solid var(--text-muted); }
.dp-pdf-partner-hint { font-weight: 400; color: var(--text-muted); }

.dp-pdf-end { margin-top: auto; padding-top: 14px; }
.pdf-body .dp-pdf-end .pdf-quote { margin: 0 0 8px; font-size: 13px; }
.dp-pdf-end .pdf-app p { margin: 0; }
.dp-pdf-end .pdf-app p + p { margin-top: 2px; }

/* Tighter spacing, when pdf.js decides the page is too full */
.pdf-compact .dp-pdf-hero { padding: 10px 18px 12px; margin-bottom: 10px; }
.pdf-compact .dp-pdf-date { font-size: 38px; }
.pdf-compact .dp-pdf-month { padding: 4px 2px 6px; }
.pdf-compact .dp-pdf-pledge { padding: 8px 16px 12px; gap: 8px 24px; }
.pdf-compact .dp-pdf-end { padding-top: 8px; }
