/* Finance tools (loaded on every non-AI finance tool page).
   Pattern: inputs on the left, one headline answer on the right, the supporting numbers under it,
   a bar that shows what the money is made of, and the long table folded away.
   Markup comes from TTF.render plus F.dress() in assets/js/tools/_fin-core.js. */

/* The answer: one big number, label above it. */
.tool-res .out-rows { gap: 0; }
.tool-res .out-row.big { flex-direction: column; align-items: flex-start; gap: 2px; position: relative; padding: 18px 20px; margin-bottom: 12px; border: 0; border-radius: 14px;
  background: linear-gradient(135deg, #312e81, #4f46e5 60%, #7c3aed); color: #fff; box-shadow: 0 12px 28px rgba(79, 70, 229, .26); }
.tool-res .out-row.big .out-l { flex: none; color: #dbe1ff; font-size: .82rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.tool-res .out-row.big .out-v { color: #fff; font-size: clamp(1.7rem, 3.2vw, 2.35rem); line-height: 1.15; text-align: left; letter-spacing: -.02em; }
.tool-res .out-row.big .copy-btn { position: absolute; top: 14px; right: 14px; background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .28); color: #fff; }
.tool-res .out-row.big .copy-btn:hover { background: #fff; color: var(--brand-ink); }

/* Supporting numbers: a quiet list, not a stack of boxes. */
.tool-res .out-row:not(.big) { padding: 9px 2px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none !important; }
.tool-res .out-row:not(.big):last-child { border-bottom: 0; }
.tool-res .out-row:not(.big) .out-l { font-size: .9rem; }
.tool-res .out-row:not(.big) .out-v { font-size: .98rem; }
.tool-res .out-row:not(.big) .copy-btn { opacity: 0; padding: 3px 8px; font-size: .74rem; transition: opacity .15s; }
.tool-res .out-row:not(.big):hover .copy-btn, .tool-res .out-row:not(.big) .copy-btn:focus-visible, .tool-res .out-row:not(.big) .copy-btn.done { opacity: 1; }
@media (hover: none) { .tool-res .out-row:not(.big) .copy-btn { display: none; } }

/* What the money is made of. */
.fin-split { margin: 2px 0 0; }
.fin-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--line); }
.fin-bar i { display: block; height: 100%; min-width: 3px; }
.fin-split .s1 { background: #4f46e5; } .fin-split .s2 { background: #f59e0b; } .fin-split .s3 { background: #10b981; }
.fin-split ul { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 0; padding: 0; list-style: none; font-size: .86rem; }
.fin-split li { display: flex; align-items: center; gap: 7px; margin: 0; }
.fin-split li b { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.fin-split li span { color: var(--muted); }
.fin-split li em { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; }

/* The long table: one click away, scrolls inside its own box. */
.fin-more { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.fin-more summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; font-weight: 600; font-size: .92rem; color: var(--brand-ink); cursor: pointer; list-style: none; }
.fin-more summary::-webkit-details-marker { display: none; }
.fin-more summary span::before { content: "+"; display: inline-block; width: 1.1em; font-weight: 700; }
.fin-more[open] summary span::before { content: "\2212"; }
.fin-more summary small { font-weight: 500; color: var(--muted); }
.fin-more .out-table { max-height: 320px; overflow: auto; border: 0; border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; }
.fin-more table { font-size: .84rem; font-variant-numeric: tabular-nums; }
.fin-more th { position: sticky; top: 0; z-index: 1; }
.fin-more th, .fin-more td { padding: 7px 10px; white-space: nowrap; }
.tool-res .out-html { min-width: 0; }
.tool-res .out-note { font-size: .82rem; line-height: 1.5; }

/* Form: tighter, with small headings for long forms. */
.tool-in .fields { gap: 12px 14px; }
.fgroup { grid-column: 1 / -1; margin: 8px 0 -4px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: .76rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--brand-ink); }
.fgroup:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

/* Phones: headline answer stays reachable while the form is on screen. */
.fin-peek { display: none; }
@media (max-width: 900px) {
  .fin-peek:not([hidden]) { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 45; display: flex; align-items: center; gap: 10px; padding: 11px 16px; border: 0; border-radius: 14px;
    background: linear-gradient(135deg, #312e81, #4f46e5); color: #fff; font: 500 .86rem var(--font); text-align: left; box-shadow: 0 12px 30px rgba(15, 23, 42, .32); cursor: pointer; }
  .fin-peek span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #dbe1ff; }
  .fin-peek b { font-size: 1.08rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .fin-peek i { font-style: normal; opacity: .8; }
  .tool-res .out-row.big { padding: 16px; }
}
@media print { .fin-peek { display: none !important; } .fin-more .out-table { max-height: none; } }
.tool-out > * { min-width: 0; }

/* Phones: short number fields sit two to a row so the form is half as long. */
@media (max-width: 620px) {
  .tool-in .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 10px 10px; }
  .tool-in .field > label { font-size: .84rem; line-height: 1.3; }
  .tool-in .field-checkbox, .tool-in .field-textarea { grid-column: 1 / -1; }
}

.tool-res { scroll-margin-top: 78px; }

/* ---------- Form kit (markup built by F.kit in assets/js/tools/_fin-core.js) ---------- */
.kit-hide { display: none !important; }
/* related tools: a slim row above the form, like tabs that change page */
.kit-sib { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 2px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.tool-box.panes.lay-split > .kit-sib { margin-bottom: -10px; }
.kit-sib a, .kit-sib span { padding: 6px 13px; border-radius: 999px; font-size: .86rem; font-weight: 600; white-space: nowrap; }
.kit-sib a { color: var(--muted); border: 1px solid var(--line); background: #fff; }
.kit-sib a:hover { color: var(--brand); border-color: var(--brand); text-decoration: none; }
.kit-sib span { color: #fff; background: var(--ink); border: 1px solid var(--ink); }
/* a select shown as tabs */
.kit-tabs { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.kit-tabs button { flex: 1 1 auto; padding: 8px 12px; border: 0; border-radius: 9px; background: none; color: var(--muted); font: 600 .88rem var(--font); cursor: pointer; }
.kit-tabs button:hover { color: var(--ink); }
.kit-tabs button.on { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(15, 23, 42, .14); }
/* one-click starting points */
.kit-presets { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.kit-presets > span { font-size: .8rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.kit-presets .chip { padding: 5px 12px; font-size: .84rem; }
/* quick values under a field */
.kit-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.kit-chips button { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font: 600 .8rem var(--font); cursor: pointer; }
.kit-chips button:hover { border-color: var(--brand); color: var(--brand); }
.kit-chips button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
/* slider paired with a number box */
.kit-range { display: block; width: 100%; height: 22px; margin: -2px 0 0; cursor: pointer; }
/* collapsible groups in long forms */
.fstep { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.fstep > summary { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; font-weight: 600; font-size: .92rem; cursor: pointer; list-style: none; }
.fstep > summary::-webkit-details-marker { display: none; }
.fstep > summary::after { content: "+"; font-weight: 700; color: var(--brand); }
.fstep[open] > summary::after { content: "\2212"; }
.fstep[open] > summary { border-bottom: 1px solid var(--line); }
.fstep > .fields { padding: 14px; }
.kit-promise { margin: -4px 0 12px; padding: 9px 12px; border-radius: 10px; background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; font-size: .88rem; font-weight: 600; line-height: 1.4; }

/* The answer as a sentence, and growth year by year. */
.fin-say { margin: 0 0 12px; padding: 12px 14px; border-left: 4px solid #4f46e5; border-radius: 0 10px 10px 0; background: #eef2ff; color: #1e1b4b; font-weight: 500; line-height: 1.45; }
.fin-growth { margin: 14px 0 0; }
.fin-growth figcaption { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.fin-growth figcaption span { font-weight: 500; letter-spacing: 0; text-transform: none; }
.fin-growth svg { display: block; width: 100%; height: 96px; border-bottom: 1px solid var(--line); }
.fin-growth rect.s1 { fill: #4f46e5; } .fin-growth rect.s2 { fill: #f59e0b; }
.fin-growth g:hover rect { opacity: .75; }
