/* Calculators on the web iOS kit in page mode (/ioskit/page.css): the hub list, the fields, the result card, the charts
   and the schedules. Loaded after ios.css and page.css. */
:root { --money: #0a84ff; --int: #ff9f0a; --gain: #30b158; --res-w: 1100px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --int: #ffb340; --gain: #32d74b; } }
:root[data-theme="dark"] { --int: #ffb340; --gain: #32d74b; }
html { scrollbar-gutter: stable; }
main { display: flow-root; padding-top: calc(var(--sat) + 60px); }
.pg-bar { height: calc(var(--sat) + 60px); box-sizing: border-box; margin-top: calc(-1 * (var(--sat) + 60px)); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html.touch .pg-app .seg, html.touch .pg-app .chip, html.touch .pg-app .li-del, html.touch .pg-app .res-row, html.touch .pg-app .res-big, html.touch .pg-app .mini-btn { min-height: 0; }

/* ---------- the hub ---------- */
.hub-search { position: sticky; top: calc(var(--sat) + 60px); z-index: 5; padding: 4px 0 8px; background: var(--grouped); }
.hub-search label { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 22px; background: var(--fill2); color: var(--text2); }
.hub-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: 17px; color: var(--text); -webkit-appearance: none; appearance: none; }
.hub-search input::placeholder { color: var(--text2); }
.hub-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.hub-search .sf, .hub-search svg { width: 18px; height: 18px; flex: none; }
.hub .group { margin: 14px 0 0; }
.hub-row { gap: 14px; padding-top: 10px; padding-bottom: 10px; min-height: 62px; text-decoration: none; color: var(--text); }
.hub-row .icon-tile { width: 36px; height: 36px; border-radius: 9px; }
.hub-row .icon-tile svg { width: 22px; height: 22px; color: #fff; }
.hub-t { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.hub-n { font-weight: 500; line-height: 21px; }
.hub-s { font-size: 13px; line-height: 17px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-badge { flex: none; font-size: 12px; font-weight: 600; color: #6d5efc; background: color-mix(in srgb, #6d5efc 13%, transparent); padding: 3px 8px; border-radius: 999px; }
:root[data-theme="dark"] .hub-badge { color: #a59cff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hub-badge { color: #a59cff; } }
.group-rows > .hub-row + .hub-row::before { left: 70px; }
.hub-row .row-chevron { width: 12px; }
.hub-none { padding: 30px 20px; text-align: center; color: var(--text2); font-size: 15px; }
.hub-row[hidden], .hub .group[hidden] { display: none; }
@media (min-width: 720px) { .hub-cols { column-count: 2; column-gap: 22px; } }
@media (min-width: 1040px) { .hub-cols { column-count: 3; } }
@media (min-width: 720px) { .hub-cols .group { break-inside: avoid; display: inline-block; width: 100%; margin: 4px 0 14px; } }
/* recent: a single row of chips in a slot the page reserves before the list paints (no shift) */
.hub-recent { display: none; align-items: center; gap: 8px; min-height: 52px; padding: 4px 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.hub-recent::-webkit-scrollbar { display: none; }
html.has-recent:not(.recent-off) .hub-recent { display: flex; }
.hub-recent-l { flex: none; font-size: 13px; font-weight: 600; color: var(--text2); padding: 0 4px 0 6px; }
.hub-chip { flex: none; gap: 7px; min-height: 40px; padding: 0 14px 0 6px; background: var(--row); text-decoration: none; color: var(--text); font-weight: 500; }
.hub-chip-i { width: 28px; height: 28px; border-radius: 8px; background: var(--c); display: grid; place-items: center; color: #fff; }
.hub-chip-i svg { width: 18px; height: 18px; }

/* ---------- a calculator ---------- */
.calc { display: block; }
@media (min-width: 960px) {
  .calc { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 0 28px; align-items: start; }
  .calc > .res { position: sticky; top: calc(var(--sat) + 70px); }
}
.calc .group { margin: 12px 0 0; }
.calc .group-header { padding-top: 6px; }
.units-seg { margin: 6px 0 2px; }
.seg-wrap { padding: 10px 0 2px; }
.seg-wrap .seg-l { display: block; font-size: 13px; color: var(--text2); padding: 0 20px 6px; }
.fld { flex-wrap: wrap; row-gap: 2px; padding-top: 10px; padding-bottom: 10px; min-height: 52px; cursor: text; }
.fld .lc-label { flex: 0 1 auto; max-width: 62%; min-width: 0; padding-right: 6px; }
.fld .lc-label small { display: block; font-size: 12px; color: var(--text2); }
.inwrap { display: flex; align-items: baseline; gap: 4px; flex: 1 1 auto; margin-left: auto; min-width: 0; max-width: 100%; justify-content: flex-end; }
.fld .inwrap input { flex: 0 1 auto; max-width: 100%; }
.inwrap .pre, .inwrap .suf { color: var(--text2); flex: none; font-variant-numeric: tabular-nums; }
.inwrap .suf { font-size: 15px; }
.inwrap input { width: 100%; min-width: 0; text-align: right; font-variant-numeric: tabular-nums; border: 0; outline: 0; background: none; padding: 4px 0; font: inherit; color: var(--text); -webkit-appearance: none; appearance: none; }
.inwrap input::placeholder { color: var(--text3); }
.inwrap input[type="date"] { text-align: right; min-height: 34px; }
.inwrap input[type="date"]::-webkit-date-and-time-value { text-align: right; }
.fld:focus-within { background: color-mix(in srgb, var(--tint) 6%, var(--row)); }
.fld.bad .inwrap input { color: var(--red); }
.fld-hint { flex: 1 0 100%; font-size: 13px; line-height: 17px; color: var(--text2); padding: 2px 0 2px; }
.fld-opt { color: var(--text3); font-size: 13px; margin-left: 4px; }
.calc .picker-row .picker-value { color: var(--text2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
.chip { position: relative; display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border-radius: 17px; background: var(--fill2); font-size: 15px; color: var(--text); }
.chip::after { content: ""; position: absolute; inset: -5px -3px; }
.chip.on { background: var(--tint); color: #fff; }
html.touch .pg-app .chip { min-height: 40px; }

/* lists (debts, net worth) */
.li { flex-direction: column; align-items: stretch; gap: 8px; padding-top: 12px; padding-bottom: 12px; }
.li-top { display: flex; align-items: center; gap: 10px; }
.li-name { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-weight: 600; color: var(--text); padding: 11px 0; margin: -7px 0; }
.li-name::placeholder { color: var(--text3); font-weight: 400; }
.li-del { position: relative; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: var(--text3); flex: none; }
.li-del::after { content: ""; position: absolute; inset: -9px; }
.li-del:hover { color: var(--red); }
.li-del svg { width: 20px; height: 20px; }
.li-grid { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 8px; }
.li-cell { display: flex; flex-direction: column; gap: 2px; background: var(--fill2); border-radius: 12px; padding: 6px 10px 6px; cursor: text; }
.li-cell span { font-size: 12px; color: var(--text2); }
.li-cell .inwrap { justify-content: flex-start; min-width: 0; flex: none; }
.li-cell .inwrap input { text-align: left; padding: 0; font-size: 16px; }
.li-cell .inwrap .pre, .li-cell .inwrap .suf { font-size: 15px; }
.li-cell:focus-within { box-shadow: 0 0 0 2px var(--tint) inset; }
.add-row { color: var(--tint); }
.add-row svg, .add-row .sf { width: 22px; height: 22px; }
.group-rows > .li + .li::before, .group-rows > .li + .add-row::before { left: 20px; }

/* ---------- the result ---------- */
.res { margin-top: 14px; scroll-margin-top: calc(var(--sat) + 70px); }
@media (min-width: 960px) { .res { margin-top: 12px; } }
.res-card { background: var(--row); border-radius: 26px; padding: 18px 20px 8px; position: relative; overflow: hidden; }
.res-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--accent, var(--tint)); opacity: .9; }
.res-label { font-size: 13px; font-weight: 600; color: var(--accent-text, var(--tint)); text-transform: uppercase; letter-spacing: .05em; }
.res-big { display: block; position: relative; font: 700 clamp(36px, 10.5vw, 48px)/1.08 var(--sys); letter-spacing: -0.025em; font-variant-numeric: tabular-nums; margin: 6px 0 4px; text-align: left; overflow-wrap: anywhere; cursor: copy; border-radius: 10px; min-width: 64px; }
.res-big:focus-visible { outline: 2px solid var(--tint); outline-offset: 4px; }
.res-big.flash, .res-row.flash { animation: flash .5s ease; }
@keyframes flash { 0% { background: color-mix(in srgb, var(--tint) 22%, transparent); } 100% { background: transparent; } }
.res-sub { font-size: 15px; line-height: 20px; color: var(--text2); margin-bottom: 12px; }
.res-need { display: flex; gap: 10px; align-items: flex-start; font-size: 17px; line-height: 23px; color: var(--text2); padding: 6px 0 16px; }
.res-need svg, .res-need .sf { flex: none; width: 22px; height: 22px; color: var(--orange); margin-top: 1px; }
.res-rows { margin: 0 -20px; }
.res-row { position: relative; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; width: 100%; padding: 12px 20px; min-height: 46px; text-align: left; cursor: copy; }
.res-row::before { content: ""; position: absolute; left: 20px; right: 20px; top: 0; border-top: .5px solid var(--sep); }
.res-row:active { background: var(--fill2); }
.res-row:focus-visible { outline: 2px solid var(--tint); outline-offset: -2px; border-radius: 10px; }
.res-row .rl { min-width: 0; display: flex; flex-direction: column; }
.res-row .rl small { font-size: 13px; line-height: 17px; color: var(--text2); margin-top: 2px; }
.res-row .rv { flex: none; max-width: 62%; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); overflow-wrap: anywhere; }
.res-row.strong .rv { font-weight: 600; }
.res-tip { font-size: 12px; color: var(--text3); text-align: center; padding: 8px 0 4px; }
.res-warn { display: flex; gap: 10px; background: color-mix(in srgb, var(--orange) 14%, var(--row)); border-radius: 18px; padding: 14px 16px; margin: 4px 0 12px; font-size: 15px; line-height: 21px; }
.res-warn svg { flex: none; width: 20px; height: 20px; color: var(--orange); }
.res-notes { font-size: 13px; line-height: 18px; color: var(--text2); padding: 10px 20px 0; }
.res-notes p { margin: 0 0 6px; }
.res-acts { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0 2px; }
.res-acts .btn-bordered { min-height: 40px; }

/* the split bar (borrowed vs interest) */
.split { margin: 2px 0 14px; }
.split-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--fill2); gap: 2px; }
.split-bar i { display: block; height: 100%; min-width: 3px; transition: flex-grow .35s var(--ease); }
.tone-a { background: var(--money); } .tone-b { background: var(--int); } .tone-g { background: var(--gain); }
.split-leg { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; font-size: 13px; color: var(--text2); }
.split-leg span { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.split-leg span i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.split-leg b { color: var(--text); font-weight: 600; }

/* charts */
.chart { background: var(--row); border-radius: 26px; padding: 14px 16px 10px; margin-top: 12px; }
.chart h3, .box-h { font-size: 13px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 8px; }
.chart svg { display: block; width: 100%; height: 150px; overflow: visible; }
.chart .ax { font-size: 11px; fill: var(--text2); font-variant-numeric: tabular-nums; }
.chart .ln { fill: none; stroke: var(--accent, var(--tint)); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .ar { fill: color-mix(in srgb, var(--accent, var(--tint)) 16%, transparent); }
.chart .gl { stroke: var(--sep); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .goal { stroke: var(--gain); stroke-width: 1.5; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }

/* compare cards (debt payoff) */
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.cmp-card { background: var(--row); border-radius: 22px; padding: 14px 16px; border: 2px solid transparent; }
.cmp-card.on { border-color: var(--accent, var(--tint)); }
.cmp-card h3 { font-size: 15px; line-height: 19px; margin: 0 0 8px; }
.cmp-card dl { margin: 0; }
.cmp-card dt { font-size: 12px; color: var(--text2); margin-top: 6px; }
.cmp-card dd { margin: 1px 0 0; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cmp-card dd small { display: block; font-weight: 400; font-size: 12px; color: var(--text2); }
.verdict { font-size: 15px; line-height: 21px; padding: 10px 6px 0; color: var(--text); }
@media (max-width: 360px) { .cmp { grid-template-columns: 1fr; } }

/* heart-rate zones */
.zones { background: var(--row); border-radius: 26px; overflow: hidden; margin-top: 12px; }
.zone { position: relative; display: grid; grid-template-columns: 44px 1fr auto; gap: 4px 12px; align-items: center; padding: 12px 18px; }
.zone + .zone::before { content: ""; position: absolute; left: 74px; right: 18px; top: 0; border-top: .5px solid var(--sep); }
.zone .zn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--zc); font-size: 17px; }
.zone .zt b { display: block; font-weight: 600; }
.zone .zt small { display: block; font-size: 13px; line-height: 17px; color: var(--text2); }
.zone .zr { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.zone .zr small { display: block; font-weight: 400; font-size: 12px; color: var(--text2); }
.z1 { --zc: #8e8e93; } .z2 { --zc: #0a84ff; } .z3 { --zc: #30b158; } .z4 { --zc: #ff9f0a; } .z5 { --zc: #ff3b30; }

/* extra lists (race predictions, milestones) */
.xgroup { background: var(--row); border-radius: 26px; padding: 14px 0 6px; margin-top: 12px; }
.xgroup > h3 { padding: 0 20px; }
.xgroup .res-rows { margin: 0; }
.xgroup .foot { font-size: 13px; line-height: 18px; color: var(--text2); padding: 6px 20px 8px; }

/* the schedule */
.sched { background: var(--row); border-radius: 26px; margin-top: 12px; overflow: hidden; }
.sched > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 20px; cursor: pointer; font-weight: 600; min-height: 52px; }
.sched > summary::-webkit-details-marker { display: none; }
.sched > summary .sf, .sched > summary svg { width: 14px; height: 14px; color: var(--text3); transition: transform .25s var(--ease); }
.sched[open] > summary svg { transform: rotate(90deg); }
.sched > summary small { font-weight: 400; color: var(--text2); font-size: 15px; margin-left: auto; }
.sched-body { padding: 0 0 12px; }
.sched-seg { padding: 0 16px 10px; }
.sched-seg .segmented { max-width: 320px; }
.tscroll { overflow: auto; max-height: 420px; border-top: .5px solid var(--sep); overscroll-behavior: contain; }
.tscroll table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
.tscroll th, .tscroll td { padding: 8px 12px; text-align: right; white-space: nowrap; border-bottom: .5px solid var(--sep); }
.tscroll th:first-child, .tscroll td:first-child { text-align: left; position: sticky; left: 0; background: var(--row); }
.tscroll thead th { position: sticky; top: 0; background: var(--row); font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .04em; z-index: 1; }
.tscroll thead th:first-child { z-index: 2; }
.sched-acts { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 0; }

/* the bottom toolbar: the answer, always in reach on a phone */
.pg-tools .sumcap { flex: 1 1 auto; min-width: 0; height: 48px; border-radius: 24px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: 0 18px; text-align: left; }
.pg-tools .sumcap small { font-size: 11px; line-height: 13px; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pg-tools .sumcap b { font-size: 18px; line-height: 22px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (min-width: 960px) { .pg-tools .sumcap { display: none; } }

/* the text below: crumbs and related calculators */
.pg-read .crumbs { font-size: 13px; color: var(--text2); margin-bottom: 8px; }
.pg-read .crumbs a { color: var(--text2); }
.pg-read .plinks { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; }
.pg-read .plinks a { position: relative; display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 18px; background: var(--row); color: var(--text); font-size: 15px; text-decoration: none; }
.pg-read .plinks a::after { content: ""; position: absolute; inset: -4px -2px; }
.pg-read .plinks a small { color: var(--text2); margin-left: 6px; font-size: 12px; }
.pg-read .more { font-size: 15px; color: var(--text2); }
.pg-read .formula { background: var(--row); border-radius: 16px; padding: 12px 16px; font: 15px/1.5 ui-monospace, "SF Mono", Menlo, monospace; overflow-x: auto; margin: 6px 0 14px; }
.pg-read .src { font-size: 13px; color: var(--text2); }

/* related calculators under the results */
.rel { background: var(--row); border-radius: 26px; padding: 14px 0 4px; margin-top: 12px; }
.rel > h3 { padding: 0 20px; }
.rel-row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 20px; color: var(--text); text-decoration: none; }
.rel-row + .rel-row::before { content: ""; position: absolute; left: 64px; right: 20px; top: 0; border-top: .5px solid var(--sep); }
.rel-row:hover { background: var(--fill2); }
.rel-row .icon-tile { width: 32px; height: 32px; border-radius: 8px; flex: none; background: var(--c); display: grid; place-items: center; color: #fff; }
.rel-row .icon-tile svg { width: 20px; height: 20px; color: #fff; }
.rel-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rel-t b { font-weight: 500; font-size: 16px; line-height: 20px; }
.rel-t small { font-size: 13px; line-height: 17px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rel-row > svg:last-child, .rel-row > .sf:last-child { width: 12px; height: 12px; color: var(--text3); flex: none; }
.pg-read .apps { padding-left: 20px; }
.pg-read .apps li { margin: 4px 0; }
.pg-read .apps span { color: var(--text2); }
/* the calculator draws into this space: hold it open so the article below doesn't jump as it mounts */
html[data-calc] #calcMain { min-height: calc(100svh - 120px); }
@media (min-width: 960px) { html[data-calc] #calcMain { min-height: 640px; } }
/* phones: a tighter page header so the first field is in view sooner */
@media (max-width: 599px) {
  .pg-head { align-items: flex-start; }
  .pg-head .pg-icon { margin-top: 4px; }
}

/* settings sheet */
.set-note { font-size: 13px; color: var(--text2); }
@media (prefers-reduced-motion: reduce) { .res-big.flash, .res-row.flash { animation: none; } .split-bar i { transition: none; } }
@media print { .pg-bar, .pg-tools, .pg-foot, .pg-read-sep, #yz-about { display: none !important; } .calc { display: block; } .res { position: static; } }
