/* New components: page heads, notices, findings, the contribution timeline, health score and forms.
   Colours come from tokens.css. Nothing here loads from outside the site. */

.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin: 4px 0 22px; }
.page-head h1 { margin-bottom: 6px; }
.stack { display: grid; gap: 12px; margin-bottom: 22px; }
.section-title { font-size: 1.05rem; margin: 28px 0 8px; }
.side-group { margin: 16px 6px 6px; font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: rgba(243, 233, 247, .55); }

.notice { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; padding: 16px 18px; margin: 0 0 20px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); }
.notice h2 { font-size: 1.02rem; margin: 0 0 4px; }
.notice p { margin: 0; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice-attention { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.finding { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: center; padding: 16px 18px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); }
.finding h3 { font-size: 1rem; margin: 0 0 4px; }
.finding p { margin: 0; }
.finding-required { border-left-color: var(--warn); }
.finding-pending { border-left-color: var(--ok); }
.finding-recommended { border-left-color: var(--line); }
.finding-body { flex: 1 1 320px; }
.finding-action { flex: 0 0 auto; }

.timeline { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; padding: 14px; margin-bottom: 14px; }
.tl-cell { display: grid; place-items: center; min-height: 48px; border-radius: 10px; font-size: .78rem; font-weight: 700; text-decoration: none; border: 1px solid var(--line); background: var(--surface-tint); color: var(--ink); }
.tl-cell span { pointer-events: none; }
:root {
  --st-ok: #1F7A4D;       /* on time: green */
  --st-late: #E08A00;     /* late: amber */
  --st-short: #2F6FB0;    /* short: blue */
  --st-missing: #C0392B;  /* missing: red */
  --st-reversed: #7B4FA0; /* reversed: violet */
  --st-pending: #8A8A8A;  /* not due yet: grey */
}
.tl-cell.s-ok { background: color-mix(in srgb, var(--st-ok) 22%, var(--surface)); }
.tl-cell.s-late { background: color-mix(in srgb, var(--st-late) 28%, var(--surface)); }
.tl-cell.s-short { background: color-mix(in srgb, var(--st-short) 24%, var(--surface)); }
.tl-cell.s-duplicate, .tl-cell.s-flagged { background: color-mix(in srgb, var(--warn) 22%, var(--surface)); }
.tl-cell.s-missing { background: color-mix(in srgb, var(--st-missing) 24%, var(--surface)); }
.tl-cell.s-reversed { background: color-mix(in srgb, var(--st-reversed) 24%, var(--surface)); }
.tl-cell.s-pending { background: var(--surface); border-style: dashed; border-color: var(--st-pending); color: var(--ink-muted); }
.tl-cell.s-inactive { opacity: .4; }
.tl-cell.is-chosen { outline: 3px solid var(--brand); outline-offset: 2px; }
.legend-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 0 0 16px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; border: 1px solid var(--line); }
.swatch.s-ok { background: var(--st-ok); border-color: transparent; }
.swatch.s-late { background: var(--st-late); border-color: transparent; }
.swatch.s-short { background: var(--st-short); border-color: transparent; }
.swatch.s-missing { background: var(--st-missing); border-color: transparent; }
.swatch.s-reversed { background: var(--st-reversed); border-color: transparent; }
.swatch.s-pending { background: var(--surface); border: 2px dashed var(--st-pending); }

.detail-card { margin-bottom: 20px; }
.detail-card h2 { margin-bottom: 6px; }
.issue-list { margin: 8px 0 12px; padding-left: 18px; }

.pill-ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pill-late, .pill-short, .pill-duplicate, .pill-flagged { background: color-mix(in srgb, var(--warn) 20%, transparent); }
.pill-missing, .pill-reversed { background: color-mix(in srgb, var(--danger) 16%, transparent); }

.health-card { margin-bottom: 20px; }
.health-score { font-size: 2.6rem; font-weight: 800; margin: 4px 0 0; color: var(--brand-deep); font-variant-numeric: tabular-nums; }
.health-score span { font-size: 1.1rem; color: var(--ink-muted); margin-left: 4px; }
.health-band { margin: 0 0 10px; font-weight: 700; }

.factor-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.factor { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-tint); }
.factor-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.factor-name { font-weight: 700; }
.factor p { margin: 6px 0 0; }
.factor-done { border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.factor-part { border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.factor-todo { border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.factor-na { opacity: .6; }

.form-card {
  margin-bottom: 20px; padding: 26px 28px;
  border-top: 4px solid var(--brand);
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 5%, var(--surface)) 0%, var(--surface) 180px);
}
.form-stack { display: grid; gap: 14px; }
.form-stack > .section-title {
  margin: 26px 0 2px; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; font-size: 1.1rem;
}
.form-stack > .section-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.form-stack > .section-title::before {
  content: ""; width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto;
  background: linear-gradient(135deg, #8A3BAE, #F5D032);
}
.form-stack > .muted { margin: 0 0 6px; }
.form-stack .btn { justify-self: start; margin-top: 8px; }
.form-card .field > span { font-weight: 700; color: var(--ink); font-size: 0.88rem; }
.form-card input:not([type="checkbox"]), .form-card select, .form-card textarea {
  background: color-mix(in srgb, var(--brand) 4%, var(--surface));
  box-shadow: inset 0 1px 3px color-mix(in srgb, var(--brand-deep) 10%, transparent);
  border-color: color-mix(in srgb, var(--brand) 22%, var(--line));
}
.form-card input:not([type="checkbox"]):hover, .form-card select:hover, .form-card textarea:hover {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
}
.requirements {
  padding: 16px 18px; margin-bottom: 22px; border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
  border-left: 4px solid #F5D032;
  background: color-mix(in srgb, var(--brand) 6%, var(--surface));
}
.requirements .section-title { margin-top: 0; }
.requirements .issue-list { margin-bottom: 0; }
.requirements .issue-list li + li { margin-top: 4px; }
.beneficiary-row { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 12px; margin: 0; background: var(--surface-tint); }
.beneficiary-row legend { padding: 0 6px; font-weight: 700; }
.check {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent); background: var(--surface-tint);
}
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--brand); }
.camera {
  padding: 18px; border-radius: 14px; border: 1.5px dashed color-mix(in srgb, var(--brand) 35%, var(--line));
  background: color-mix(in srgb, var(--brand) 4%, var(--surface)); display: grid; gap: 10px;
}
.camera .card-actions { margin-top: 4px; }

.event-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 14px; }
.event-card h2 { font-size: 1.05rem; }
.steps { padding-left: 20px; margin: 8px 0 14px; display: grid; gap: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; }
.chip.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip-static { min-height: 0; padding: 3px 10px; font-size: .8rem; margin: 2px 4px 2px 0; }
.answer-card { margin-bottom: 20px; }
.answer-text { font-size: 1.05rem; }

/* Tables inside cards: their titles need the same inner margin as the rest of the card. */
.table-card > h2 { padding: 18px 20px 6px; margin: 0; font-size: 1.05rem; }

/* Details that open on demand, such as the planner's assumptions. */
.assumptions { padding: 16px 20px; margin-bottom: 20px; }
.assumptions > summary { cursor: pointer; font-weight: 700; list-style: none; }
.assumptions > summary::-webkit-details-marker { display: none; }
.assumptions[open] > summary { margin-bottom: 10px; }

.quick-card { margin-bottom: 20px; }
.quick-card h2 { margin: 0 0 4px; font-size: 1.05rem; }

/* Sidebar: the logo and the signed-in card stay in place; only the list of links scrolls. */
.sidebar { display: flex; flex-direction: column; overflow: hidden; height: 100vh; height: 100dvh; }
.sidebar-logo, .sidebar-kicker, .sidebar-foot { flex: 0 0 auto; }
.side-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.25) transparent; padding-right: 4px; }
@media (min-width: 961px) {
  .sidebar { position: sticky; top: 0; }
}

.period-bar { margin-bottom: 18px; }
.period-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.period-form .field { min-width: 150px; }

@media (max-width: 720px) {
  .timeline { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .page-head { flex-direction: column; align-items: flex-start; }
}

/* Investment and growth ------------------------------------------------------------- */
.inv-status { margin: -8px 0 16px; }
.inv-summary { display: grid; gap: 18px; margin-bottom: 20px; }
@media (min-width: 760px) { .inv-summary { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; } }
.inv-figure { font-size: clamp(2.1rem, 5vw, 3rem); font-weight: 800; line-height: 1.05; margin: 6px 0 4px; color: var(--brand-deep); }
.inv-figure span { font-size: 1rem; font-weight: 600; color: var(--ink-muted); margin-left: 6px; }
.inv-facts { display: grid; gap: 10px; margin: 0; }
.inv-facts > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-tint); border: 1px solid var(--line); }
.inv-facts dt { color: var(--ink-muted); font-weight: 600; }
.inv-facts dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.inv-explain { grid-column: 1 / -1; margin: 0; color: var(--ink-muted); line-height: 1.55; }
.inv-explorer { margin-bottom: 20px; }
.inv-explorer-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.inv-explorer-head h2 { margin: 0 0 4px; }
.inv-controls { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-bottom: 20px; }
.inv-slider { display: grid; gap: 8px; }
.inv-slider-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 700; }
.inv-slider-label output { color: var(--brand-deep); font-variant-numeric: tabular-nums; }
.inv-slider input[type="range"] { width: 100%; accent-color: var(--brand); }
.inv-sentence { font-size: 1.05rem; line-height: 1.6; margin: 0 0 14px; min-height: 3.3em; }
.inv-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--surface-tint); border: 1px solid var(--line); }
.inv-bar-paid { display: block; height: 100%; background: var(--brand); transition: width .3s ease; }
.inv-bar-growth { display: block; height: 100%; background: var(--seg-3); transition: width .3s ease; }
.inv-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 18px; }
.inv-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.inv-dot-paid { background: var(--brand); }
.inv-dot-growth { background: var(--seg-3); }
.inv-chart { margin: 0 0 18px; }
.inv-chart svg { display: block; width: 100%; height: auto; }
.inv-axis text { fill: var(--ink-muted); font-size: 12px; }
.inv-grid-line { stroke: var(--line); stroke-width: 1; }
.inv-area-value { fill: var(--seg-3); opacity: .40; }
.inv-area-paid { fill: var(--brand); opacity: .30; }
.inv-line-value { fill: none; stroke: var(--seg-3); stroke-width: 2.5; stroke-linejoin: round; }
.inv-line-paid { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; }
.inv-scenarios { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.inv-scenario { padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); }
.inv-scenario.is-current { border-color: var(--brand); background: var(--brand-soft); }
.inv-scenario-rate { font-weight: 700; margin: 4px 0; }
.inv-scenario-value { margin: 0; font-size: 1.2rem; font-weight: 800; color: var(--brand-deep); }
.inv-error { margin: 14px 0 0; }
.inv-error[hidden] { display: none; }
.inv-note { margin: 16px 0 0; }

/* Small screens: the chart scales down, so its labels need a larger size in chart units. */
@media (max-width: 600px) { .inv-axis text { font-size: 22px; } }

/* Light and dark toggle: in the sidebar when signed in, and at the top of the sign-in pages. */
.side-theme { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin: 0 0 8px; padding: 10px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.22); background: transparent; color: #fff; font: inherit; font-weight: 700; cursor: pointer; transition: background 0.2s ease; }
.side-theme:hover { background: rgba(255, 255, 255, 0.12); }
.side-theme-icon { font-size: 1.05rem; line-height: 1; color: #F5D032; }
.auth-tools { display: flex; justify-content: flex-end; padding: 14px 16px 0; }
.theme-toggle.is-inline { position: static; }
.theme-toggle.is-inline [data-theme-label] { display: inline; }

/* Life events ------------------------------------------------------------------------ */
.life-tiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-bottom: 20px; }
.life-tile { display: block; text-decoration: none; color: var(--ink); transition: transform 0.2s ease, box-shadow 0.2s ease; }
.life-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.life-tile h2 { margin: 12px 0 4px; font-size: 1.1rem; }
.life-icon { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--brand-soft); color: var(--brand-deep); flex: 0 0 auto; }
.life-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.life-badge { display: inline-block; margin-top: 10px; padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; background: color-mix(in srgb, var(--warn) 22%, var(--surface)); color: var(--ink); }
.life-detail { margin-bottom: 20px; }
.life-detail-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.life-detail-head h2 { margin: 0 0 6px; }
.life-detail-head p { margin: 0; color: var(--ink-muted); line-height: 1.55; }
.life-progress { display: grid; gap: 6px; margin-bottom: 18px; }
.life-progress progress { width: 100%; height: 10px; accent-color: var(--brand); }
.life-steps { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 12px; }
.life-step { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); }
.life-step-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 800; background: var(--surface-tint); color: var(--ink-muted); border: 1px solid var(--line); }
.life-step.is-done .life-step-mark { background: color-mix(in srgb, var(--ok) 20%, var(--surface)); color: var(--ok); }
.life-step.is-attention .life-step-mark { background: color-mix(in srgb, var(--warn) 28%, var(--surface)); color: var(--ink); }
.life-step.is-waiting .life-step-mark, .life-step.is-unknown .life-step-mark, .life-step.is-later .life-step-mark { color: var(--brand); }
.life-step-title { font-weight: 700; margin: 0 0 4px; }
.life-step-state { margin: 6px 0 0; color: var(--ink-muted); }
.life-step.is-done .life-step-state { color: var(--ok); }
.life-columns { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.life-columns > div { padding: 16px; border-radius: var(--radius-sm); background: var(--surface-tint); border: 1px solid var(--line); }
.life-columns h3 { margin: 0 0 8px; font-size: 1rem; }
.life-columns ul { margin: 0; padding-left: 18px; }
.life-columns p { margin: 0; }
@media (max-width: 600px) { .life-step { grid-template-columns: auto minmax(0, 1fr); } .life-step .btn { grid-column: 2; justify-self: start; } }

.member-id { margin: 2px 0 0; }

/* Status pills: the background shows the stage a request has reached. */
.pill.tone-new { background: var(--brand-soft); color: var(--brand-deep); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.pill.tone-active { background: color-mix(in srgb, var(--accent) 35%, var(--surface)); color: var(--ink); border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.pill.tone-waiting { background: color-mix(in srgb, var(--warn) 22%, var(--surface)); color: var(--ink); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.pill.tone-done { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.pill.tone-declined { background: color-mix(in srgb, var(--danger) 16%, var(--surface)); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.pill.tone-closed { background: var(--surface-tint); color: var(--ink-muted); border-color: var(--line); }

/* Progress tracker: each step is a stage; the line fills up to the step the request has reached. */
.tracker-card { margin-bottom: 20px; }
.tracker-4 { --steps: 4; }
.tracker-5 { --steps: 5; }
.tracker-6 { --steps: 6; }
.tracker { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(var(--steps, 4), minmax(0, 1fr)); position: relative; }
.tracker::before {
  content: ""; position: absolute; top: 13px; left: calc(100% / (2 * var(--steps, 4))); right: calc(100% / (2 * var(--steps, 4)));
  height: 3px; border-radius: 3px; background: var(--line);
}
.tracker-step { position: relative; display: grid; justify-items: center; gap: 10px; text-align: center; }
.tracker-dot {
  width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); background: var(--surface);
  position: relative; z-index: 1; box-sizing: border-box;
}
.tracker-label { font-size: 0.86rem; font-weight: 700; color: var(--ink-muted); }
.tracker-step.is-done .tracker-dot { background: var(--brand); border-color: var(--brand); }
.tracker-step.is-done .tracker-label { color: var(--ink); }
.tracker-step.is-current .tracker-dot {
  background: var(--surface); border-color: var(--brand); box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 18%, transparent);
}
.tracker-step.is-current .tracker-label { color: var(--brand-deep); }
.tracker-step.is-end-declined .tracker-dot { background: var(--danger); border-color: var(--danger); }
.tracker-step.is-end-declined .tracker-label { color: var(--danger); }
.tracker-step.is-end-closed .tracker-dot { background: var(--ink-muted); border-color: var(--ink-muted); }
.tracker-step.is-end-closed .tracker-label { color: var(--ink-muted); }
.tracker-note { margin: 16px 0 0; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 14%, var(--surface)); font-size: 0.9rem; }
@media (max-width: 620px) {
  .tracker { grid-template-columns: 1fr; gap: 14px; }
  .tracker::before { top: 14px; bottom: 14px; left: 13px; right: auto; width: 3px; height: auto; }
  .tracker-step { grid-template-columns: 28px 1fr; justify-items: start; text-align: left; align-items: center; }
}

/* User manual link, top right of every page. */
.manual-row { display: flex; justify-content: flex-end; padding: 10px 40px 0; }
.manual-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 700;
  color: var(--brand); text-decoration: none; border: 1.5px solid color-mix(in srgb, var(--brand) 35%, transparent);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}
.manual-link::before { content: "?"; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 0.72rem; }
.manual-link:hover { background: var(--brand-soft); }
.auth-tools { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 720px) { .manual-row { padding: 8px 16px 0; } }

/* The User manual link sits at the right of the price bar, in the same row. */
.price-strip { display: flex; align-items: stretch; min-width: 0; background: var(--surface); border-bottom: 1px solid var(--line); }
.price-strip .price-bar { flex: 1 1 auto; min-width: 0; border-bottom: 0; background: transparent; }
.price-strip .manual-link { flex: 0 0 auto; align-self: center; margin: 0 16px; }
@media (max-width: 720px) { .price-strip .manual-link { margin: 0 10px; font-size: .8rem; padding: 6px 11px; } }

/* Phones: the progress tracker runs top to bottom, so every step label can be read. */
@media (max-width: 639px) {
  .tracker { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .tracker::before { top: 12px; bottom: 12px; left: 12px; right: auto; width: 3px; height: auto; }
  .tracker-step { grid-template-columns: 28px minmax(0, 1fr); justify-items: start; align-items: center; gap: 12px; text-align: left; }
}
