/* ==========================================================================
   Calculator pages. Loaded after site.css, so all tokens come from there.
   ========================================================================== */

body.tool { background: var(--surface-2); }

/* Read by screen readers, not shown on screen. */
.tk-blank-hide { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

.tool-bar { background: var(--brand); color: var(--on-brand); position: sticky; top: 0; z-index: 40; }
.tool-bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.tool-bar .logo { color: var(--on-brand); font-size: 1rem; }
.tool-bar .logo-mark { background: var(--pop); color: var(--pop-ink); }
.tool-bar nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tool-bar a.back { color: var(--on-brand); font-size: 0.88rem; font-weight: 600; margin-right: 8px; display: inline-flex; align-items: center; min-height: 44px; }
.tk-btn {
  font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--on-brand); border: 1px solid rgba(242, 244, 248, 0.35);
  padding: 7px 12px; border-radius: 2px;
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
}
.tk-btn:hover { background: rgba(242, 244, 248, 0.12); }
.tk-btn.primary { background: var(--pop); color: var(--pop-ink); border-color: var(--pop); }

.tool-head { padding: clamp(28px, 5vw, 48px) 0 8px; }
.tool-head h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); margin-bottom: 10px; }
.tool-head p { max-width: 44em; color: var(--muted); }

.tool-grid { display: grid; gap: 24px; grid-template-columns: 1fr; align-items: start; padding-bottom: 40px; }
@media (min-width: 1000px) { .tool-grid { grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr); } .tool-grid.wide { grid-template-columns: 1fr; } }

/* ---------- input panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 3vw, 28px); margin-bottom: 20px; }
.panel > h2 { font-size: 1.35rem; margin-bottom: 4px; display: flex; gap: 10px; align-items: baseline; }
.panel > h2 .step { font-family: var(--font-mono); font-size: 0.74rem; font-weight: 500; letter-spacing: 0.1em; color: var(--brand-2); }
.panel > .intro { color: var(--muted); font-size: 0.95rem; margin-bottom: 18px; max-width: 46em; }
.fields { display: grid; gap: 16px 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.fields.one { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; }
/* Line labels, inputs and hints up across a row even when a label wraps or only one field has a hint. */
@supports (grid-template-rows: subgrid) {
  .fields:not(.one) { grid-auto-rows: auto; }
  .fields:not(.one) > .field { display: grid; grid-template-rows: subgrid; grid-row: span 3; row-gap: 6px; align-content: start; }
  .fields:not(.one) > .field > .field-label { align-self: end; }
  .fields:not(.one) > .field > .input { margin-top: 0; }
}
.field-label { font-weight: 600; font-size: 0.9rem; line-height: 1.25; }
.field-label small { display: block; font-weight: 400; color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.hint { font-size: 0.8rem; color: var(--muted); line-height: 1.35; }
.input { position: relative; display: block; margin-top: auto; }
.input input, .input select, .row input, .row select {
  font: inherit; font-family: var(--font-mono); font-size: 0.95rem; width: 100%;
  padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--field); color: var(--ink);
  min-height: 44px; line-height: 1.2;
}
.input input:focus, .input select:focus, .row input:focus, .row select:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--focus-glow); background: #fff; }
.input.money input, .row .money input { padding-left: 24px; }
.input.money::before, .row .money::before { content: "$"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-family: var(--font-mono); color: var(--muted); font-size: 0.95rem; pointer-events: none; }
.input.pct input, .row .pct input { padding-right: 26px; }
.input.pct::after, .row .pct::after { content: "%"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-family: var(--font-mono); color: var(--muted); font-size: 0.9rem; pointer-events: none; }
.input[data-unit] input { padding-right: 40px; }
.input[data-unit="of $100"] input { padding-right: 70px; }
.input[data-unit="clients"] input { padding-right: 66px; }
.input[data-unit]::after { content: attr(data-unit); position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-family: var(--font-mono); color: var(--muted); font-size: 0.78rem; pointer-events: none; }
input[type="number"]::-webkit-inner-spin-button { opacity: 0.4; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; font-size: 0.92rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.check small { display: block; font-weight: 400; color: var(--muted); font-size: 0.8rem; }

details.more { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 4px; }
/* A thumb-sized tap target (44px), with the same space around it as before. */
details.more > summary { cursor: pointer; font-weight: 700; font-size: 0.9rem; color: var(--brand-2); min-height: 44px; padding: 10px 0; box-sizing: border-box; line-height: 1.5; }
details.more[open] > summary { margin-bottom: 4px; }

/* ---------- repeating rows ---------- */
.rows-table { display: grid; gap: 10px; }
.rows-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px 6px; }
.row-head, .row { display: grid; gap: 8px; align-items: center; min-width: var(--row-min, 0); }
.row-head { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 0 2px; align-items: end; }
.row { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; }
.row > span { position: relative; display: block; min-width: 0; }
.row input[type="text"] { font-family: var(--font-body); }
.row .out { font-family: var(--font-mono); font-weight: 600; font-size: 0.92rem; text-align: right; white-space: nowrap; padding: 0 4px; }
.row-remove { font: inherit; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1.2rem; line-height: 1; padding: 6px 8px; border-radius: 6px; }
.row-remove:hover { color: var(--act); background: var(--act-bg); }
.add-row { font: inherit; font-weight: 700; font-size: 0.9rem; background: none; border: 1.5px dashed var(--brand-2); color: var(--brand-2); border-radius: var(--radius-sm); padding: 10px 14px; cursor: pointer; margin-top: 10px; }
.add-row:hover { background: var(--hover-tint); }

/* card style rows, for lists with many fields */
.row-card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; }
.row-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.row-card-head .n { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); letter-spacing: 0.1em; }
.row-card .fields { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; }
.row-card .result-strip { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 0.86rem; }
.row-card .result-strip b { font-family: var(--font-mono); }

/* ---------- results ---------- */
.results { position: sticky; top: 76px; display: grid; gap: 16px; }
@media (max-width: 999px) { .results { position: static; } }
.headline { background: var(--brand); color: var(--on-brand); border-radius: var(--radius); padding: 22px; }
.headline .label { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pop); }
.headline .value { font-family: var(--font-display); font-weight: 500; font-size: clamp(2.8rem, 7vw, 3.9rem); letter-spacing: -0.01em; line-height: 1; margin: 8px 0 10px; font-variant-numeric: tabular-nums; }
.headline .sub { font-size: 0.92rem; color: var(--on-brand-soft); margin: 0; }
.result-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.result-card h3 { font-size: 1.05rem; margin-bottom: 10px; }
.lines { display: grid; }
.lines > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 0.93rem; align-items: baseline; }
.lines > div:first-child { border-top: 0; }
.lines > div > b, .lines > div > span:last-child { font-family: var(--font-mono); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lines > div.total { border-top: 2px solid var(--ink); font-weight: 700; }
.lines > div.minus > span:first-child::before { content: "less "; color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
[data-level="good"].pill { background: var(--good-bg); color: var(--good); }
[data-level="watch"].pill { background: var(--watch-bg); color: var(--watch); }
[data-level="act"].pill { background: var(--act-bg); color: var(--act); }
[data-level=""].pill { visibility: hidden; }
.headline .pill { background: rgba(255, 255, 255, 0.14); color: #fff; }
.headline [data-level="good"].pill { background: #cfe8d9; color: #123d27; }
.headline [data-level="watch"].pill { background: #f3cf7a; color: #4a3203; }
.headline [data-level="act"].pill { background: #f2a590; color: #5a1608; }

.bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand-2); border-radius: 999px; width: 0; transition: width 0.25s ease; }
.bar > i[data-level="watch"] { background: var(--watch); }
.bar > i[data-level="act"] { background: var(--act); }
.bar > i[data-level="good"] { background: var(--good); }

/* ---------- actions ---------- */
.actions { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; counter-reset: a; }
.actions li { counter-increment: a; border-left: 4px solid var(--line); background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 12px 16px; display: grid; gap: 3px; }
.actions li[data-level="act"] { border-left-color: var(--act); }
.actions li[data-level="watch"] { border-left-color: var(--watch); }
.actions li[data-level="good"] { border-left-color: var(--good); }
.actions li strong::before { content: counter(a) ". "; font-family: var(--font-mono); color: var(--muted); }
.actions li span { font-size: 0.93rem; color: var(--ink-soft); }

/* ---------- data tables in results ---------- */
.data-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th { text-align: left; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 2px solid var(--ink); white-space: nowrap; }
table.data td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data td.num, table.data th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }

.error-box { background: var(--act-bg); color: #8a2a18; border-radius: var(--radius-sm); padding: 12px 14px; font-weight: 600; margin-bottom: 16px; }
.rates-note { font-size: 0.82rem; color: var(--muted); }
.rates-note b { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }
.tool-foot { padding: 24px 0 48px; font-size: 0.82rem; color: var(--muted); }
.tool-foot p { max-width: 60em; }

/* ---------- toolbar "More" menu: inline on wide screens, a drop-down on phones ---------- */
.tk-more { position: relative; }
.tk-more > summary { list-style: none; cursor: pointer; }
.tk-more > summary::-webkit-details-marker { display: none; }
.tk-more-menu { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
@media (min-width: 760px) {
  .tk-more > summary { display: none; }
}
@media (max-width: 759px) {
  .tool-bar .wrap { flex-wrap: nowrap; }
  .tool-bar .logo { font-size: 0.92rem; min-width: 0; }
  .tool-bar nav { flex-wrap: nowrap; }
  .tool-bar a.back { margin-right: 2px; white-space: nowrap; }
  .tk-more-menu { position: absolute; right: 0; top: calc(100% + 8px); flex-direction: column; align-items: stretch; background: var(--brand); padding: 10px; border-radius: 12px; box-shadow: 0 10px 28px rgba(15, 26, 43, 0.3); min-width: 190px; z-index: 50; }
  .tk-more-menu .tk-btn { text-align: left; justify-content: flex-start; padding: 10px 14px; }
  .tool-bar .tk-btn { white-space: nowrap; }
}
/* Very narrow: the "$" mark stands in for the name, so the bar stays one row. */
@media (max-width: 479px) {
  .tool-bar .logo { font-size: 0; gap: 0; }
  .tool-bar .logo-mark { font-size: 1rem; }
}

/* ---------- phones: no zoom on focus, thumb-sized remove buttons ---------- */
@media (max-width: 759px) {
  body.tool input, body.tool select, body.tool textarea { font-size: 16px; }
}
.row-remove { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- empty state: nothing typed yet ---------- */
.tk-empty-note { background: var(--surface); border: 2px dashed var(--brand-2); border-radius: var(--radius); padding: 16px 18px; font-weight: 600; margin: 0; }
body.tk-empty .pill[data-light], body.tk-empty .pill[data-row-light], body.tk-empty table.data .pill { display: none !important; }

/* ---------- undo ---------- */
.tk-undo { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 61; display: flex; gap: 14px; align-items: center; background: var(--ink); color: var(--bg); padding: 10px 12px 10px 16px; border-radius: 12px; font-size: 0.9rem; box-shadow: 0 8px 24px rgba(15, 26, 43, 0.25); max-width: min(92vw, 520px); }
.tk-undo button { font: inherit; font-weight: 700; background: var(--pop); color: var(--pop-ink); border: 0; border-radius: 999px; padding: 7px 16px; min-height: 44px; cursor: pointer; }

/* ---------- phones: the answer stays in sight ---------- */
.tk-dock { display: none; }
@media (max-width: 999px) {
  .tk-dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--brand); color: var(--on-brand); border: 0; width: 100%; font: inherit; text-align: left; cursor: pointer; box-shadow: 0 -6px 20px rgba(15, 26, 43, 0.2); transform: translateY(110%); transition: transform 0.2s ease; }
  .tk-dock.show { transform: translateY(0); }
  .tk-dock .tk-dock-label { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--pop); display: block; }
  .tk-dock .tk-dock-value { font-family: var(--font-display); font-weight: 500; font-size: 1.5rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
  .tk-dock > span:first-child { min-width: 0; }
  /* A long verdict wraps to two lines rather than being cut off. */
  .tk-dock .pill { flex: 0 1 auto; max-width: 52%; white-space: normal; overflow: visible; text-overflow: clip; text-align: left; line-height: 1.25; overflow-wrap: break-word; border-radius: 12px; }
  .tk-dock .tk-dock-go { font-size: 0.78rem; opacity: 0.85; white-space: nowrap; }
  body.tool { padding-bottom: 72px; }
}
@media (prefers-reduced-motion: reduce) { .tk-dock, .bar > i { transition: none; } }
.tk-dock:focus-visible { outline-offset: -5px; }

/* ---------- first-visit guide: one small tip at a time, with an arrow at what it means ---------- */
.tk-tour { position: fixed; top: 0; left: 0; z-index: 48; box-sizing: border-box; width: min(320px, calc(100vw - 24px)); background: var(--surface); color: var(--ink); font-family: var(--font-body); border: 1px solid var(--line); border-top: 4px solid var(--pop); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(15, 26, 43, 0.18), 0 2px 6px rgba(15, 26, 43, 0.08); padding: 12px 16px 4px; }
.tk-tour[data-side="above"] { border-bottom: 4px solid var(--pop); }
.tk-tour[hidden] { display: none; }
.tk-tour-arrow { position: absolute; left: var(--tk-tour-x, 50%); width: 0; height: 0; margin-left: -10px; border: 10px solid transparent; pointer-events: none; }
.tk-tour[data-side="below"] .tk-tour-arrow { top: -24px; border-bottom-color: var(--pop); }
.tk-tour[data-side="above"] .tk-tour-arrow { bottom: -24px; border-top-color: var(--pop); }
.tk-tour.tk-tour-noarrow .tk-tour-arrow { display: none; }
.tk-tour-count { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brand-2); margin: 0 0 4px; }
.tk-tour-title { font-family: var(--font-body); font-size: 1.05rem; font-weight: 600; line-height: 1.25; letter-spacing: 0; color: var(--ink); margin: 0 36px 6px 0; }
.tk-tour-text { font-size: 0.92rem; line-height: 1.45; color: var(--ink-soft); margin: 0 0 12px; }
.tk-tour-x { position: absolute; top: 0; right: 0; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; font: inherit; font-size: 1.4rem; line-height: 1; background: none; border: 0; color: var(--muted); cursor: pointer; border-radius: var(--radius-sm); }
.tk-tour-x:hover { color: var(--ink); }
.tk-tour-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.tk-tour-btn { font: inherit; font-size: 0.88rem; font-weight: 600; min-height: 44px; padding: 8px 16px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); cursor: pointer; }
.tk-tour-btn:hover { border-color: var(--brand-2); }
.tk-tour-btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.tk-tour-btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.tk-tour-btn.quiet { border-color: transparent; background: none; color: var(--muted); padding-left: 6px; padding-right: 6px; margin-right: auto; }
.tk-tour-btn.quiet:hover { color: var(--ink); border-color: transparent; }
.tk-tour-off { display: inline-flex; align-items: center; min-height: 44px; font: inherit; font-size: 0.8rem; color: var(--muted); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.tk-tour-off:hover { color: var(--ink); }
.tk-tour-target { outline: 3px solid var(--pop) !important; outline-offset: 4px; }
.tk-dock.tk-tour-target { outline-offset: -6px; }
@media (max-width: 600px) { .tk-tour { width: calc(100vw - 32px); } }
/* "Show me how": a quiet text link top right of the tool's heading, sitting in the space under the toolbar. */
.tk-head-line { position: relative; z-index: 20; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0 20px; margin: calc(4px - clamp(28px, 5vw, 48px)) 0 0; }
.tk-tour-link { font: inherit; font-size: 0.85rem; font-weight: 500; color: var(--brand-2); background: none; border: 0; padding: 0 2px; min-height: 44px; display: inline-flex; align-items: center; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.tk-tour-link:hover { color: var(--ink); }
.tk-tour-link.in-bar { color: var(--on-brand-soft); padding: 0 8px; }
.tk-tour-link.in-bar:hover { color: var(--on-brand); }

/* ---------- saved versions ---------- */
/* "Save this version" opens a strip under the toolbar: a name box and Save. */
.tk-save { border-top: 1px solid rgba(242, 244, 248, 0.18); }
.tk-save[hidden] { display: none; }
.tool-bar .wrap.tk-save-in { justify-content: flex-start; flex-wrap: wrap; min-height: 0; gap: 8px 14px; padding-top: 10px; padding-bottom: 10px; }
.tk-save-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; flex: 1 1 420px; min-width: 0; }
.tk-save-form[hidden] { display: none; }
.tk-save-label { font-size: 0.86rem; font-weight: 600; color: var(--on-brand); }
.tk-save-input { flex: 1 1 220px; min-width: 0; min-height: 44px; font: inherit; font-size: 0.95rem; padding: 8px 10px; border: 1.5px solid transparent; border-radius: var(--radius-sm); background: var(--field); color: var(--ink); }
.tk-save-input:focus { outline: 3px solid var(--pop); outline-offset: 1px; }
.tk-save-msg { flex: 1 1 260px; margin: 0; font-size: 0.9rem; color: var(--on-brand); }
.tk-save-msg:empty { display: none; }
.tk-save-msg a { color: var(--pop); font-weight: 600; }
.tk-save-close { margin-left: auto; }
/* The phone "More" menu says what the two copy buttons are for; wide screens use their title. */
.tk-more-hint { display: none; }
@media (max-width: 759px) {
  .tk-more-hint { display: block; margin: 4px 4px 2px; max-width: 200px; font-size: 0.78rem; line-height: 1.35; color: var(--on-brand-muted); }
}
/* "Your saved versions": a fold-out in the line under the toolbar, next to "Show me how". */
.tk-vers { position: relative; }
.tk-vers[hidden] { display: none; }
.tk-vers > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; font-size: 0.85rem; font-weight: 500; color: var(--brand-2); text-decoration: underline; text-underline-offset: 3px; }
.tk-vers > summary::-webkit-details-marker { display: none; }
.tk-vers > summary::after { content: ""; margin-left: 6px; border: 4px solid transparent; border-top-color: currentColor; transform: translateY(2px); }
.tk-vers[open] > summary::after { border-top-color: transparent; border-bottom-color: currentColor; transform: translateY(-2px); }
.tk-vers-panel { position: absolute; right: 0; top: 100%; width: min(460px, calc(100vw - 32px)); max-height: min(70vh, 520px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--pop); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(15, 26, 43, 0.18); padding: 10px 14px 4px; text-align: left; }
.tk-vers-note { margin: 0 0 4px; font-size: 0.8rem; color: var(--muted); }
.tk-vers-list { list-style: none; margin: 0; padding: 0; }
.tk-vers-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.tk-vers-list li:first-child { border-top: 0; }
.tk-vers-name { font-weight: 600; font-size: 0.92rem; overflow-wrap: anywhere; }
.tk-vers-when { grid-column: 1; font-size: 0.8rem; color: var(--muted); }
.tk-vers-acts { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; }
.tk-vers-ask { font-size: 0.86rem; font-weight: 600; }
.tk-vbtn { font: inherit; font-size: 0.84rem; font-weight: 600; min-height: 44px; padding: 6px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); cursor: pointer; }
.tk-vbtn:hover { border-color: var(--brand-2); }
.tk-vbtn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.tk-vbtn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.tk-vbtn.danger { border-color: var(--act); color: var(--act); }
@media (max-width: 479px) { .tk-vers-list li { grid-template-columns: 1fr; } .tk-vers-acts { grid-column: 1; grid-row: auto; justify-content: flex-start; } }
/* The toolbar holds one more button now, so on screen the "N" mark stands in for the name, as on a phone.
   The link still reads "The Numbers Room" to a screen reader, and the printed report keeps the name. */
.tool-bar .tk-btn { padding-left: 11px; padding-right: 11px; }
@media screen and (min-width: 760px) {
  .tool-bar .logo { font-size: 0; gap: 0; }
  .tool-bar .logo-mark { font-size: 1rem; }
}

/* ---------- the business's logo on client quotes (setUpLogo in toolkit.js) ---------- */
.tk-logo { display: grid; gap: 6px; margin-top: 16px; }
.tk-logo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tk-logo-preview { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.tk-logo-preview img { display: block; width: auto; height: auto; max-width: 120px; max-height: 48px; }
.tk-logo-hint, .tk-logo-msg { margin: 0; }
.tk-logo-msg { color: var(--ink); font-size: 0.86rem; }
.tk-logo-msg .btn { margin-left: 8px; }
/* On the quote: up to 180 x 72, the same shape, never stretched, with the business name under it. */
.q-logo-slot { margin: 0 0 10px; }
.q-logo-slot img.q-logo { display: block; width: auto; height: auto; max-width: min(180px, 100%); max-height: 72px; }

/* ---------- print: a clean report ---------- */
.tk-toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; max-width: min(92vw, 520px); background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-size: 0.9rem; box-shadow: 0 8px 24px rgba(15, 26, 43, 0.25); }

@media print {
  .tk-toast, .tk-dock, .tk-undo, .tk-tour, .tk-head-line, .tk-tour-link, .tk-save, .tk-more-hint, .tk-logo { display: none !important; }
  .q-logo-slot img.q-logo { max-width: 180px; max-height: 72px; }
  .tk-tour-target { outline: none !important; }
  body.tool { padding-bottom: 0; }
  body.tool { background: #fff; font-size: 11pt; }
  .tool-bar nav, .add-row, .row-remove, details.more > summary, .no-print { display: none !important; }
  .tool-bar { position: static; background: #fff; color: #000; border-bottom: 2px solid #000; }
  .tool-bar .logo { color: #000; }
  .tool-grid { grid-template-columns: 1fr; }
  .results { position: static; }
  .panel, .result-card, .headline, .row, .row-card { break-inside: avoid; box-shadow: none; }
  .headline { background: #fff; color: #000; border: 2px solid #000; }
  .headline .label, .headline .sub { color: #333; }
  details.more { display: block; }
  details.more > * { display: block; }
  .input input, .row input { border-color: #bbb; background: #fff; }
}

/* Figures line up in columns: Jost's numbers are proportional by default. */
.input input, .row input, .row .out, .lines, table.data, .headline .value { font-variant-numeric: tabular-nums lining-nums; }

/* ---------- guide products (the AI Starter Kit) ---------- */
.kit-grid { display: grid; gap: 24px; grid-template-columns: 1fr; align-items: start; padding-bottom: 40px; }
@media (min-width: 1000px) { .kit-grid { grid-template-columns: 240px minmax(0, 1fr); } .kit-nav { position: sticky; top: 76px; } }
.kit-nav { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 10px; font-size: 0.9rem; }
.kit-nav ol { margin: 10px 0 0; padding-left: 1.2em; display: grid; gap: 6px; }
.kit-nav ul { margin: 4px 0 2px; padding-left: 1em; list-style: none; display: grid; gap: 3px; font-size: 0.84rem; }
.kit-nav a { text-decoration: none; color: var(--ink); }
.kit-nav a:hover { color: var(--brand-2); text-decoration: underline; }
.kit-body { min-width: 0; }
.kit-section { scroll-margin-top: 80px; }
.kit-section h3 { font-size: 1.2rem; margin-top: 22px; }
.kit-section h3 small { font-size: 0.78rem; color: var(--muted); font-weight: 400; margin-left: 6px; }
.kit-section h4 { font-size: 1rem; margin: 16px 0 6px; }
.kit-section p, .kit-section li { max-width: 68ch; }
.kit-section pre.template { white-space: pre-wrap; font: inherit; font-size: 0.92rem; background: var(--surface-2); border-left: 3px solid var(--brand-2); padding: 14px 16px; border-radius: 0; margin: 12px 0; }
.kit-group, .kit-recipe { scroll-margin-top: 80px; }
.kit-prompt { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; background: var(--field); break-inside: avoid; page-break-inside: avoid; }
.kit-prompt header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.kit-prompt h4 { margin: 0; font-size: 1rem; }
.kit-when { color: var(--muted); font-size: 0.86rem; margin: 4px 0 0; }
.kit-text { white-space: pre-wrap; font: inherit; font-size: 0.92rem; line-height: 1.55; margin: 10px 0 0; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.kit-text mark { background: color-mix(in srgb, var(--pop) 45%, transparent); color: var(--ink); padding: 0 2px; border-radius: 2px; }
.kit-copy { font: inherit; font-size: 0.82rem; font-weight: 600; padding: 7px 14px; min-height: 44px; border: 1.5px solid var(--brand); background: var(--brand); color: var(--on-brand); border-radius: 2px; cursor: pointer; flex: none; }
.kit-copy:hover { background: var(--brand-2); border-color: var(--brand-2); }
.kit-search { display: block; margin: 16px 0 6px; max-width: 460px; }
.kit-search input { width: 100%; font: inherit; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--field); color: var(--ink); }
.kit-search input:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--focus-glow); }
.kit-goal { background: var(--surface-2); padding: 10px 14px; border-radius: var(--radius-sm); }
.kit-steps { padding-left: 1.3em; }
.kit-steps > li { margin: 14px 0; }
.kit-check { border-left: 3px solid var(--good); padding: 4px 0 4px 14px; margin-top: 14px; }
@media print {
  .kit-nav, .kit-copy, .kit-search, [data-kit-none] { display: none !important; }
  .kit-grid { display: block; }
  .kit-text { background: #fff; border: 1px solid #bbb; }
  .kit-text mark { background: none; font-weight: 600; }
  .kit-section { break-before: page; }
  .kit-section:first-child { break-before: auto; }
}

/* ---------- the owner's Studio ---------- */
.st-client-row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); align-items: end; }
.st-field { display: grid; gap: 4px; margin: 12px 0; }
.st-label { font-weight: 600; font-size: 0.95rem; }
.st-field textarea, .st-field select, .st-field input, .st-score textarea, .st-cell {
  font: inherit; font-size: 0.95rem; width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--field); color: var(--ink); resize: vertical;
}
.st-field textarea:focus, .st-field select:focus, .st-field input:focus, .st-score textarea:focus, .st-cell:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--focus-glow); }
.st-add { display: flex; gap: 8px; }
.st-add input { flex: 1; min-width: 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-2); text-decoration: underline; cursor: pointer; }
.st-tools { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.st-tools a { display: inline-block; padding: 7px 12px; border: 1px solid var(--line); border-radius: 2px; text-decoration: none; font-size: 0.88rem; background: var(--surface); }
.st-tools a:hover { border-color: var(--brand-2); }
.st-docs { list-style: none; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.st-docs a { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; background: var(--surface); height: 100%; }
.st-docs a:hover { border-color: var(--brand-2); }
.st-docs strong { font-weight: 600; }
.st-docs span:last-child { color: var(--muted); font-size: 0.86rem; }
.st-kind { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brand-2); }
.st-doc h2 { margin-top: 1.4em; font-size: 1.5rem; }
.st-doc h2:first-child { margin-top: 0; }
.st-doc h3 { margin-top: 1.2em; font-size: 1.15rem; }
.st-doc p, .st-doc li { max-width: 72ch; }
.st-note { background: var(--surface-2); border-left: 3px solid var(--brand-2); padding: 12px 16px; margin: 14px 0; }
.st-checklist { list-style: none; padding: 0; }
.st-checklist li { margin: 6px 0; }
.st-checklist label { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; cursor: pointer; }
.st-checklist input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--brand); }
.st-table-wrap { overflow-x: auto; margin: 12px 0; }
.st-table td { vertical-align: top; }
.st-cell { padding: 6px 8px; min-width: 110px; }
.st-copyable { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 14px 0; break-inside: avoid; }
.st-copyable header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.st-copyable h4 { margin: 0; }
.st-subject { margin: 8px 0 0; font-size: 0.92rem; }
.st-subject span { color: var(--muted); }
.st-score-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; break-inside: avoid; }
.st-score-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.st-score-head h4 { margin: 0; }
.st-score-head select { width: auto; font: inherit; padding: 6px 10px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--field); }
.st-levels { padding-left: 1.6em; font-size: 0.9rem; color: var(--muted); }
.st-levels li { margin: 3px 0; padding: 2px 6px; border-radius: 2px; }
.st-levels li.on { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.st-total { font-size: 1.1rem; }
.st-agenda, .st-outline { list-style: none; padding: 0; }
.st-agenda li { display: grid; grid-template-columns: 90px 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.st-agenda h4, .st-outline h4 { margin: 0 0 4px; }
.st-time { font-weight: 600; color: var(--brand-2); font-variant-numeric: tabular-nums; }
.st-outline > li { padding: 12px 0; border-top: 1px solid var(--line); }
.st-outline small { color: var(--muted); font-weight: 400; }
.st-client-line { font-size: 0.92rem; }
@media print {
  .st-clients, .kit-copy, .st-score-head select { display: none !important; }
  .st-field textarea, .st-score textarea, .st-cell { border: 0; border-bottom: 1px solid #bbb; border-radius: 0; resize: none; padding: 4px 0; }
}
.tk-client { display: inline-block; background: var(--pop); color: var(--pop-ink); padding: 6px 12px; font-size: 0.88rem; margin: 0 0 12px; }
.tk-client a { color: var(--pop-ink); margin-left: 6px; }
@media print { .tk-client a { display: none; } }

/* ---------- report builder ---------- */
.rb-figures input, .rb-actions-table input, .rb-actions-table textarea { font: inherit; font-size: 0.92rem; width: 100%; min-width: 90px; padding: 7px 9px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--field); color: var(--ink); }
.rb-figures td:first-child input { min-width: 220px; }
.rb-actions-table td:nth-child(2) textarea { min-width: 260px; }
.rb-figures input:focus, .rb-actions-table input:focus, .rb-actions-table textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--focus-glow); }
.rb-map { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.rb-suggest { list-style: none; padding: 0; display: grid; gap: 6px; }
.rb-suggest button { width: 100%; text-align: left; font: inherit; font-size: 0.88rem; padding: 10px 12px; border: 1px solid var(--line); border-left: 4px solid var(--muted); background: var(--surface); color: var(--ink); cursor: pointer; border-radius: 0; }
.rb-suggest button[data-level="act"] { border-left-color: var(--act); }
.rb-suggest button[data-level="watch"] { border-left-color: var(--watch); }
.rb-suggest button[data-level="good"] { border-left-color: var(--good); }
.rb-suggest button:hover { background: var(--hover-tint); }
.rb-person { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.rb-person small { color: var(--muted); font-weight: 400; }
.rb-bar { display: flex; flex-wrap: wrap; gap: 10px; }
.rb-preview { padding: clamp(24px, 4vw, 44px); }
.rb-cover { border-bottom: 2px solid var(--brand); padding-bottom: 16px; margin-bottom: 22px; }
.rb-brand { font-size: 0.75rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--brand-2); font-weight: 500; }
.rb-cover h2 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin: 6px 0 4px; }
.rb-cover p { color: var(--muted); margin: 0; }
.rb-preview section { margin: 0 0 22px; padding: 0; break-inside: avoid; }
.rb-preview h3 { font-size: 1.15rem; margin-bottom: 8px; }
.rb-acts { padding-left: 1.3em; }
.rb-acts li { margin: 0 0 12px; }
.rb-acts b { display: block; font-weight: 600; }
.rb-acts span { color: var(--muted); font-size: 0.9rem; }
.rb-preview .rb-page { break-before: page; border-top: 1px solid var(--line); padding-top: 18px; }
.rb-target { background: var(--surface-2); padding: 10px 14px; }
.rb-foot { margin-top: 26px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--muted); }
@media print {
  body.rb-printing .tool-bar, body.rb-printing .tool-head, body.rb-printing [data-rb] > :not([data-rb-preview]), body.rb-printing .tool-foot, body.rb-printing .tk-toast { display: none !important; }
  body.rb-printing .rb-preview { border: 0; padding: 0; }
}

/* Long labels and wide content never push a phone screen sideways. */
.tool-grid > *, .results > * { min-width: 0; }
.pill { max-width: 100%; }
.headline .pill, .result-card .pill { white-space: normal; text-align: left; line-height: 1.35; }

/* ---------- "Need a hand putting this into action?" ---------- */
.next-step h2 { margin-bottom: 14px; }
.next-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.next-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; gap: 8px; align-content: start; background: var(--surface); }
.next-card h3 { margin: 0; font-size: 1.15rem; }
.next-card p { margin: 0; color: var(--muted); font-size: 0.93rem; }
.next-card .btn { justify-self: start; margin-top: 6px; }
.next-kicker { font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--brand-2); font-weight: 600; }
.next-help { background: var(--surface-2); }
.next-who { display: flex; align-items: center; gap: 12px; }
.next-who img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
@media print { .next-step { display: none !important; } }
