.term-worksheet {
  color: var(--ink);
  margin: 1.5rem 0 3rem;
  scroll-margin-top: 1rem;
}
.term-worksheet [hidden] { display: none !important; }
.tm-layout { display: grid; grid-template-columns: minmax(0,.97fr) minmax(0,1.03fr); gap: clamp(1rem,2.6vw,1.8rem); align-items: start; }
.tm-form, .tm-result { min-width: 0; border: 1px solid var(--rule); border-radius: var(--panel-radius); padding: clamp(1rem,2.5vw,1.65rem); background: var(--surface); }
.term-worksheet h2 { margin: 0; font-size: var(--section-title); line-height: 1.18; letter-spacing: -.025em; }
.tm-form header p, .tm-note, .tm-result > p, .tm-result #term-readout > p { color: var(--secondary); font-size: .93rem; line-height: 1.5; margin: .42rem 0 .75rem; }
.tm-step { min-width: 0; border: 0; padding: 0; margin: 1.1rem 0; }
.tm-step legend { float: left; width: 100%; border-top: 1px solid var(--rule); padding: .75rem 0 .32rem; font-size: 1.02rem; font-weight: 700; }
.tm-step legend + * { clear: both; }
.tm-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem .85rem; }
.tm-field { min-width: 0; margin: .48rem 0; }
.tm-field label { display: block; margin: 0 0 .3rem; color: var(--ink); font-size: .87rem; line-height: 1.4; font-weight: 650; }
.tm-control { position: relative; }
.tm-control input, .tm-field select { display: block; width: 100%; min-width: 0; min-height: var(--control-height); padding: .47rem .62rem; border: 1px solid var(--control-border); border-radius: var(--control-radius); background: var(--surface); color: var(--ink); font: inherit; font-size: 1rem; font-variant-numeric: tabular-nums; }
.tm-control[data-currency]::before { content: "$"; position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); color: var(--secondary); pointer-events: none; }
.tm-control[data-currency] input { padding-left: 1.6rem; }
.tm-field [aria-invalid=true] { border-color: var(--error); }
.tm-help, .tm-error, .tm-method { display: block; font-size: .875rem; line-height: 1.45; margin: .25rem 0; }
.tm-help, .tm-method { color: var(--secondary); }
.tm-error { color: var(--error); }
.tm-error:empty, .tm-help:empty { display: none; }
.tm-actions { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.tm-primary, .tm-secondary { min-height: var(--control-height); border-radius: var(--control-radius); padding: .5rem .9rem; font: inherit; font-size: .89rem; font-weight: 650; }
.tm-primary { background: var(--blue); border: 1px solid var(--blue); color: var(--night-on-action, white); }
.tm-primary:hover { background: var(--blue-hover); }
.tm-secondary { background: var(--surface); border: 1px solid var(--control-border); color: var(--blue); }
.tm-quotes { margin-top: 1.2rem; padding: .7rem .85rem; border: 1px solid var(--rule); border-radius: var(--control-radius); background: var(--canvas); scroll-margin-top: 1rem; }
.tm-quotes summary { color: var(--blue); font-weight: 650; cursor: pointer; }
.tm-quotes > p, .tm-quote-result p { color: var(--secondary); font-size: .87rem; line-height: 1.5; }
.tm-quote { min-width: 0; border: 1px solid var(--rule); margin: 0; padding: .48rem .58rem; background: var(--surface); }
.tm-quote legend { font-weight: 650; font-size: .87rem; }
.tm-match { display: flex; align-items: flex-start; gap: .43rem; margin: .75rem 0; font-size: .86rem; line-height: 1.49; }
.tm-match input { flex: none; width: 1rem; height: 1rem; margin: .17rem 0 0; accent-color: var(--blue); }
.tm-quote-result { margin-top: .85rem; padding: .6rem .75rem; border-left: 3px solid var(--blue-mid); background: var(--surface); }
.tm-quote-result h3, .tm-result h3 { margin: .15rem 0 .4rem; font-size: 1rem; }
.tm-quote-result dl, .tm-year-check dl { margin: .4rem 0; }
.tm-quote-result dl > div, .tm-year-check dl > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .14rem .7rem; border-bottom: 1px solid var(--rule); padding: .31rem 0; }
.tm-quote-result dt, .tm-year-check dt { color: var(--secondary); font-size: .84rem; }
.tm-quote-result dd, .tm-year-check dd { margin: 0; font-weight: 650; font-size: .87rem; font-variant-numeric: tabular-nums; }
.term-worksheet :is(input,select,a,button,summary):focus-visible, .tm-result:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.tm-result { scroll-margin-top: 1rem; border-top: .28rem solid var(--blue); }
.tm-context { color: var(--secondary); font-size: .77rem; font-weight: 700; margin: 0 0 .22rem; }
.tm-edit { display: inline-block; color: var(--blue); padding: .3rem 0; font-size: .87rem; font-weight: 600; }
.tm-notice { color: var(--attention); background: var(--attention-soft); border-left: 3px solid var(--attention-rule); font-size: .89rem; padding: .55rem .75rem; }
.tm-tail-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; margin: .8rem 0 1.1rem; }
.tm-tail-pair > div { padding: .75rem .85rem; background: var(--blue-soft); border: 1px solid var(--blue-mid); border-radius: var(--control-radius); }
.tm-tail-pair h3 { color: var(--blue-hover); font-size: .9rem; }
.tm-tail-pair strong { display: block; font-size: clamp(1.42rem,3.9vw,2.5rem); line-height: 1.12; color: var(--blue); letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tm-tail-pair span, .tm-tail-pair p { display: block; color: var(--secondary); font-size: .83rem; line-height: 1.43; margin: .25rem 0 0; }
.tm-tail-pair p { margin-top: .52rem; }
.tm-horizon-table { border-collapse: collapse; width: 100%; table-layout: fixed; font-size: .84rem; font-variant-numeric: tabular-nums; }
.tm-horizon-table caption { text-align: left; padding: .22rem 0 .4rem; color: var(--secondary); }
.tm-horizon-table th, .tm-horizon-table td { padding: .4rem .32rem; border-bottom: 1px solid var(--rule); text-align: right; vertical-align: top; overflow-wrap: anywhere; }
.tm-horizon-table th:first-child { width: 38%; text-align: left; }
.tm-horizon-table thead { background: var(--blue-soft); }
.tm-horizon-table thead th { font-size: .76rem; }
.tm-result #term-horizons, .tm-year-check { margin: 1rem 0; }
.tm-timeline { margin: .7rem 0; padding: .7rem .75rem; background: var(--canvas); border-radius: var(--control-radius); }
.tm-timeline figcaption { margin-bottom: .4rem; font-size: .89rem; font-weight: 650; }
.tm-timeline > div { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .1rem .7rem; margin: .35rem 0; }
.tm-timeline span, .tm-timeline b { font-size: .79rem; }
.tm-timeline b { font-variant-numeric: tabular-nums; }
.tm-timeline meter { display: block; width: 100%; height: .39rem; appearance: none; border: 0; border-radius: .16rem; overflow: hidden; background: var(--rule); }
.tm-timeline meter::-webkit-meter-bar { height: .39rem; border: 0; background: var(--rule); }
.tm-term-bar meter::-webkit-meter-optimum-value { background: var(--blue); }
.tm-term-bar meter::-moz-meter-bar { background: var(--blue); }
.tm-need-bar meter::-webkit-meter-optimum-value { background: var(--chart-secondary); }
.tm-need-bar meter::-moz-meter-bar { background: var(--chart-secondary); }
.tm-year-check > p:not(.tm-help) { font-size: .91rem; }
.tm-method { margin: .6rem 0; }
@media (max-width: 850px) {
  .tm-layout { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 530px) {
  .tm-pair { grid-template-columns: minmax(0,1fr); gap: 0; }
  .tm-tail-pair { gap: .4rem; }
  .tm-tail-pair > div { padding: .6rem; }
  .tm-horizon-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .tm-horizon-table, .tm-horizon-table tbody, .tm-horizon-table tr, .tm-horizon-table tbody th { display: block; }
  .tm-horizon-table caption { display: block; }
  .tm-horizon-table tbody th:first-child { width: auto; background: var(--blue-soft); padding: .33rem; border: 0; }
  .tm-horizon-table td { display: flex; justify-content: space-between; gap: .4rem; border: 0; padding: .22rem; }
  .tm-horizon-table td::before { content: attr(data-label); color: var(--secondary); }
  .tm-horizon-table tr { margin-bottom: .5rem; }
}
@media print {
  body:has(#term-worksheet) #main > :not(#term-worksheet), body:has(#term-worksheet) :is(.site-head,.site-foot,.skip),
  .tm-form > :not(#term-quotes), .tm-quotes > :not(#term-quote-result), .tm-form:not(:has(#term-quote-result:not([hidden]))), .tm-edit, #term-print { display: none !important; }
  .term-worksheet,.tm-layout { display: block; margin: 0; }
  .tm-form,.tm-result,.tm-quotes,.tm-quote-result { margin: 0 0 .5rem; padding: 0; border: 0; background: #fff; }
  .tm-result::before { content: "Term life insurance comparison"; display: block; font-size: 1.3rem; font-weight: 700; }
  .tm-tail-pair > div,.tm-timeline { break-inside: avoid; }
}
