/* Shared styles for the tool pages under /w/. Palette and type match the index. */
  :root {
    --paper: #FFFFFF;
    --ink: #000000;
    --grey: #6B6B6B;
    --quiet: #767676;
    --rule: #E6E6E6;
    --rule-2: #CFCFCF;
    --wash: #F4F4F4;
    --tip: #000000;
    --tip-ink: #FFFFFF;
    --danger: #9A3B2E;
  }
  * { box-sizing: border-box; }
  [hidden] { display: none !important; }
  html { background: var(--paper); }
  body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }
  main { max-width: 760px; margin: 0 auto; padding: 56px 24px 120px; }
  .serif { font-family: "Libre Caslon Display", Georgia, "Times New Roman", serif; font-weight: 400; }
  .num { font-variant-numeric: tabular-nums; }

  .crumb { font-size: 14px; color: var(--grey); text-decoration: none; }
  .crumb:hover, .crumb:focus-visible { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }

  h1 {
    font-family: "Libre Caslon Display", Georgia, "Times New Roman", serif;
    font-weight: 400;
    font-size: clamp(36px, 5.6vw, 52px);
    line-height: 1.04;
    letter-spacing: -0.015em;
    margin: 28px 0 14px;
  }
  .intro { margin: 0 0 48px; max-width: 48ch; font-size: 17px; line-height: 1.55; color: var(--grey); }

  /* ---------- Inputs ---------- */
  .form { display: flex; flex-direction: column; gap: 28px; padding-bottom: 40px; border-bottom: 1px solid var(--rule); }
  .seg { display: inline-flex; gap: 22px; }
  .seg button {
    appearance: none; border: 0; background: transparent; padding: 0 0 6px;
    font: inherit; font-size: 15px; color: var(--quiet); cursor: pointer;
    border-bottom: 1px solid transparent;
  }
  .seg button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); }
  .seg button:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

  .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px; row-gap: 26px; }
  .field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
  .field label { font-size: 13px; color: var(--grey); }
  .control { display: flex; align-items: baseline; gap: 6px; border-bottom: 1px solid var(--rule-2); padding: 4px 0 8px; }
  .control:focus-within { border-bottom-color: var(--ink); }
  .control .affix { color: var(--quiet); font-size: 15px; }
  .control input, .control select {
    flex: 1; min-width: 0; width: 100%; appearance: none; border: 0; background: transparent;
    color: var(--ink); font: inherit; font-size: 20px; font-weight: 500; padding: 0; outline: none;
    font-variant-numeric: tabular-nums; border-radius: 0;
  }
  .control select {
    font-size: 17px; cursor: pointer; padding-right: 20px;
    background-image: linear-gradient(45deg, transparent 50%, var(--grey) 50%), linear-gradient(135deg, var(--grey) 50%, transparent 50%);
    background-position: calc(100% - 10px) 60%, calc(100% - 5px) 60%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  }
  .control input[type="date"] { font-size: 17px; }
  .control input::placeholder { color: var(--rule-2); }
  .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

  details.more { border-top: 1px solid var(--rule); padding-top: 18px; }
  details.more summary {
    list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: baseline;
    font-size: 15px; color: var(--grey); user-select: none;
  }
  details.more summary::-webkit-details-marker { display: none; }
  details.more summary::after { content: "+"; font-size: 18px; }
  details.more[open] summary::after { content: "−"; }
  details.more summary:hover, details.more summary:focus-visible { color: var(--ink); outline: none; }
  details.more .inner { padding-top: 24px; display: flex; flex-direction: column; gap: 26px; }

  .lumps { display: flex; flex-direction: column; gap: 10px; }
  .lump { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 16px; align-items: end; }
  .icon-btn {
    appearance: none; border: 1px solid var(--rule-2); background: transparent; color: var(--grey);
    width: 26px; height: 26px; border-radius: 999px; cursor: pointer; font: inherit; line-height: 1; margin-bottom: 6px;
  }
  .icon-btn:hover { color: var(--ink); border-color: var(--ink); }
  .link-btn {
    appearance: none; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 14px;
    padding: 0; cursor: pointer; align-self: flex-start; text-decoration: underline; text-underline-offset: 5px; text-decoration-color: var(--rule-2);
  }
  .link-btn:hover { text-decoration-color: var(--ink); }
  .icon-btn:focus-visible, .link-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

  /* ---------- Results ---------- */
  .results { display: flex; flex-direction: column; gap: 44px; padding-top: 44px; }
  .eyebrow { font-size: 13px; color: var(--grey); margin: 0; }
  .hero { display: flex; flex-direction: column; gap: 8px; }
  .hero .figure {
    font-family: "Libre Caslon Display", Georgia, serif; font-weight: 400;
    font-size: clamp(56px, 10vw, 92px); line-height: 1; letter-spacing: -0.02em; margin: 0;
  }
  .hero .figure .cents { font-size: 0.5em; vertical-align: 0.62em; margin-left: 2px; color: var(--grey); }
  .hero .figure .sym { font-size: 0.55em; vertical-align: 0.5em; margin-right: 3px; color: var(--grey); }
  .hero .note { margin: 4px 0 0; max-width: 56ch; font-size: 16px; color: var(--grey); }
  .hero .note strong { color: var(--ink); font-weight: 500; }
  .hero .note.error { color: var(--danger); }

  .facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
  .fact { padding: 18px 24px 18px 0; display: flex; flex-direction: column; gap: 4px; }
  .fact .k { font-size: 13px; color: var(--grey); }
  .fact .v { font-family: "Libre Caslon Display", Georgia, serif; font-size: 26px; line-height: 1.1; }
  .fact .s { font-size: 13px; color: var(--quiet); }

  .split { display: flex; flex-direction: column; gap: 10px; }
  .split .bar { display: flex; height: 6px; gap: 2px; }
  .split .bar .p { background: var(--ink); }
  .split .bar .i { background: var(--rule-2); }
  .split .legend { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; color: var(--grey); }
  .split .legend b { color: var(--ink); font-weight: 500; }
  .sw { display: inline-block; width: 8px; height: 8px; margin-right: 8px; }
  .sw.p { background: var(--ink); }
  .sw.i { background: var(--rule-2); }

  h2 { font-family: "Libre Caslon Display", Georgia, serif; font-weight: 400; font-size: 27px; line-height: 1.15; margin: 0; }
  .chart-wrap { display: flex; flex-direction: column; gap: 14px; }
  .chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
  .chart-legend { display: flex; gap: 18px; font-size: 13px; color: var(--grey); }
  .chart-legend i { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--ink); vertical-align: middle; margin-right: 6px; }
  .chart-legend i.base { border-top: 1.5px dashed var(--quiet); }
  .chart { position: relative; width: 100%; }
  .chart svg { width: 100%; height: auto; display: block; overflow: visible; }
  .chart .grid line { stroke: var(--rule); stroke-width: 1; }
  .chart .axis text { fill: var(--grey); font-size: 11px; font-family: "Instrument Sans", sans-serif; font-variant-numeric: tabular-nums; }
  .chart .line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
  .chart .area { fill: var(--ink); opacity: 0.04; }
  .chart .base { fill: none; stroke: var(--quiet); stroke-width: 1.5; stroke-dasharray: 4 5; stroke-linecap: round; }
  .chart .end { fill: var(--ink); stroke: var(--paper); stroke-width: 2; }
  .chart .xhair { stroke: var(--grey); stroke-width: 1; opacity: 0; }
  .chart .dot { fill: var(--ink); stroke: var(--paper); stroke-width: 2; opacity: 0; }
  .chart .dlabel { fill: var(--grey); font-size: 11px; font-family: "Instrument Sans", sans-serif; paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }
  .tip {
    position: absolute; pointer-events: none; background: var(--tip); color: var(--tip-ink);
    padding: 8px 10px; font-size: 12px; line-height: 1.4; white-space: nowrap; opacity: 0;
    transform: translate(-50%, -110%); transition: opacity 120ms ease;
  }
  .tip b { font-weight: 500; }
  .tip .m { opacity: 0.7; }

  /* ---------- Schedule ---------- */
  .schedule { border-top: 1px solid var(--rule); padding-top: 32px; display: flex; flex-direction: column; gap: 20px; }
  .schedule-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
  .schedule-head p { margin: 6px 0 0; color: var(--grey); font-size: 14px; }
  .actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
  .btn {
    appearance: none; border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
    font: inherit; font-size: 14px; font-weight: 500; padding: 9px 16px; cursor: pointer; border-radius: 0;
  }
  .btn:hover { background: var(--paper); color: var(--ink); }
  .btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule-2); }
  .btn.ghost:hover { border-color: var(--ink); }
  .btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
  .table-wrap { max-height: 560px; overflow: auto; border-top: 1px solid var(--rule-2); border-bottom: 1px solid var(--rule-2); }
  table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
  thead th {
    position: sticky; top: 0; background: var(--paper); text-align: right; font-weight: 500; font-size: 12px;
    color: var(--grey); padding: 12px 12px 10px; border-bottom: 1px solid var(--rule-2); white-space: nowrap;
  }
  thead th:first-child, tbody td:first-child { text-align: left; padding-left: 0; }
  tbody td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--rule); color: var(--grey); white-space: nowrap; }
  tbody td.strong { color: var(--ink); }
  tbody tr.year-end td { border-bottom-color: var(--rule-2); }
  tbody tr:hover td { background: var(--wash); }
  tbody td:last-child, thead th:last-child { padding-right: 0; }
  .schedule-foot { display: flex; justify-content: space-between; gap: 16px; color: var(--quiet); font-size: 13px; flex-wrap: wrap; margin-top: 12px; }

  footer { margin-top: 72px; max-width: 56ch; font-size: 14px; line-height: 1.6; color: var(--grey); }

  @media (max-width: 560px) {
    main { padding-top: 40px; }
    .grid { grid-template-columns: 1fr; }
    .fact { padding-right: 16px; }
  }
  @media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

  /* ---------- Additions shared by the newer tools ---------- */
  .bar .s1 { background: var(--ink); }
  .bar .s2 { background: var(--grey); }
  .bar .s3 { background: #B5B5B5; }
  .bar .s4 { background: var(--rule-2); }
  .sw.s1 { background: var(--ink); }
  .sw.s2 { background: var(--grey); }
  .sw.s3 { background: #B5B5B5; }
  .sw.s4 { background: var(--rule-2); }
  .split .legend.wrap { justify-content: flex-start; flex-wrap: wrap; gap: 10px 24px; }
  .chart .area2 { fill: var(--ink); opacity: 0.10; }
  .chart .zero line { stroke: var(--rule-2); }
  .chart .vref { stroke: var(--rule-2); stroke-width: 1; stroke-dasharray: 2 4; }
  .chart .href { stroke: var(--grey); stroke-width: 1; stroke-dasharray: 2 4; }
  .chart .rlabel { fill: var(--grey); font-size: 11px; font-family: "Instrument Sans", sans-serif; paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }
  .chart-legend i.area { border-top: 0; width: 14px; height: 8px; background: var(--ink); opacity: 0.12; }
  .status { display: inline-block; font-size: 13px; padding: 3px 10px; border: 1px solid var(--rule-2); border-radius: 999px; color: var(--grey); vertical-align: middle; margin-left: 10px; }
  .status.good { border-color: var(--ink); color: var(--ink); }
  .status.bad { border-color: var(--danger); color: var(--danger); }
  .grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 32px; row-gap: 26px; }
  .group-title { font-size: 13px; color: var(--quiet); margin: 0 0 -8px; }
  @media (max-width: 560px) { .grid-3 { grid-template-columns: 1fr; } }

  /* ---------- Share bar and print ---------- */
  .share { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--quiet); margin-top: -18px; }
  .share .link-btn { font-size: 13px; color: var(--grey); text-decoration-color: var(--rule-2); }
  .share .link-btn:hover { color: var(--ink); }
  @page { margin: 16mm; }
  @media print {
    main { padding: 0; max-width: none; }
    .crumb, .btn, .share, .actions, .tip, .status, details.more summary::after { display: none !important; }
    details.more { border: 0; }
    details.more:not([open]) { display: none; }
    .table-wrap { max-height: none; overflow: visible; border: 0; }
    thead th { position: static; }
    tbody tr { break-inside: avoid; }
    .schedule, .chart-wrap { break-inside: avoid; }
    .hero .figure { font-size: 56px; }
    a { color: inherit; text-decoration: none; }
  }

  /* ---------- What changes it ---------- */
  .whatif { display: flex; flex-direction: column; gap: 14px; }
  .whatif .table-wrap { max-height: none; }
  .whatif tbody td:first-child { color: var(--ink); }
  .whatif p.foot { margin: 0; font-size: 13px; color: var(--quiet); max-width: 60ch; }
  .whatif tbody td.now { font-weight: 500; }
  .whatif .grid-table td, .whatif .grid-table th { text-align: center; }
  .whatif .grid-table td:first-child, .whatif .grid-table th:first-child { text-align: left; }
  .whatif td.hi { background: var(--wash); }

  /* ---------- Error state: keep the message, quiet the stale results ---------- */
  .results.is-error > :not(.hero):not(.share) { opacity: 0.3; pointer-events: none; }

  /* ---------- Footer cross-links ---------- */
  footer .related { margin-top: 14px; font-size: 13.5px; color: var(--quiet); }
  footer .related a { color: var(--grey); text-decoration: underline; text-underline-offset: 5px; text-decoration-color: var(--rule-2); }
  footer .related a:hover { color: var(--ink); text-decoration-color: var(--ink); }
  .chart .band { fill: var(--ink); opacity: 0.07; }
  .chart-legend i.band { border-top: 0; width: 14px; height: 8px; background: var(--ink); opacity: 0.1; }

  footer a { color: var(--grey); text-decoration: underline; text-underline-offset: 5px; text-decoration-color: var(--rule-2); }
  footer a:hover { color: var(--ink); text-decoration-color: var(--ink); }
