/* Kepton Capital components. Every value comes from tokens.css; class prefix kp-. */
.kp-root { font-family: var(--font-text); font-size: 16px; line-height: 1.6; color: var(--text-primary); background: var(--surface-page); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.kp-root *, .kp-root *::before, .kp-root *::after { box-sizing: border-box; }
.kp-root :focus-visible { outline: var(--border-thick) solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-xs); }
[data-theme="dark"].kp-root, [data-theme="dark"] .kp-root, .kp-root [data-theme="dark"] { color: var(--text-primary); background: var(--surface-page); }

/* Layout */
.kp-container { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gutter); }
.kp-section { padding: var(--section-pad-y) 0; background: var(--surface-page); color: var(--text-primary); }
.kp-section--muted { background: var(--surface-muted); }
.kp-section--raised { background: var(--surface-raised); }
.kp-section--brand { background: var(--surface-brand); color: var(--text-on-brand); }
.kp-section--rule { border-top: var(--border-hairline) solid var(--border-subtle); }
.kp-grid { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.kp-grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.kp-split { display: grid; gap: var(--space-8); grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
@media (max-width: 819px) {
  .kp-container { padding: 0 var(--gutter-sm); }
  .kp-section { padding: var(--section-pad-y-sm) 0; }
  .kp-split { grid-template-columns: 1fr; gap: var(--space-6); }
}

/* Logo */
.kp-logo { display: inline-block; color: var(--logo-ink); line-height: 0; text-decoration: none; }
.kp-logo svg { display: block; height: 100%; width: auto; }
.kp-logo path, .kp-logo circle { fill: currentColor; }
.kp-logo--lockup { min-width: var(--logo-min); }

/* Buttons */
.kp-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--control-md); padding: 0 22px; border: var(--border-hairline) solid transparent; border-radius: var(--radius-pill); font-family: var(--font-text); font-size: 15px; font-weight: 500; line-height: 1; letter-spacing: 0.005em; white-space: nowrap; text-decoration: none; cursor: pointer; transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease; }
.kp-btn:focus-visible { outline: var(--border-thick) solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-pill); }
.kp-btn--primary { background: var(--action-primary); border-color: var(--action-primary); color: var(--action-primary-fg); }
.kp-btn--primary:hover { background: var(--action-primary-hover); border-color: var(--action-primary-hover); }
.kp-btn--secondary { background: transparent; border-color: var(--border-field); color: var(--text-primary); }
.kp-btn--secondary:hover { background: var(--action-secondary-hover); border-color: var(--border-strong); }
.kp-btn--ghost { background: transparent; color: var(--text-primary); padding: 0 var(--space-3); }
.kp-btn--ghost:hover { background: var(--action-secondary-hover); }
.kp-btn--sm { min-height: var(--control-sm); padding: 0 16px; font-size: 14px; }
.kp-btn--lg { min-height: var(--control-lg); padding: 0 28px; font-size: 16px; }
.kp-btn--block { width: 100%; }
.kp-btn[aria-disabled="true"] { opacity: 1; background: var(--surface-muted); border-color: var(--surface-muted); color: var(--text-tertiary); cursor: not-allowed; }
.kp-btn__arrow { display: inline-block; transition: transform 160ms ease; }
.kp-btn:hover .kp-btn__arrow { transform: translateX(3px); }
.kp-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.kp-section--brand .kp-btn--primary { background: var(--brand-bone); border-color: var(--brand-bone); color: var(--brand-ink); }
.kp-section--brand .kp-btn--primary:hover { background: var(--brand-paper-negative); }
.kp-section--brand .kp-btn--secondary, .kp-section--brand .kp-btn--ghost { color: var(--text-on-brand); border-color: var(--brand-bone); }
.kp-section--brand .kp-btn--secondary:hover, .kp-section--brand .kp-btn--ghost:hover { background: rgba(243, 240, 232, 0.12); }
.kp-section--brand :focus-visible { outline-color: var(--brand-bone); }
.kp-section--brand :is(.kp-card, .kp-surface) { color: var(--text-primary); }
.kp-section--brand :is(.kp-card, .kp-surface) .kp-btn--primary { background: var(--action-primary); border-color: var(--action-primary); color: var(--action-primary-fg); }
.kp-section--brand :is(.kp-card, .kp-surface) .kp-btn--primary:hover { background: var(--action-primary-hover); border-color: var(--action-primary-hover); }
.kp-section--brand :is(.kp-card, .kp-surface) .kp-btn--secondary { color: var(--text-primary); border-color: var(--border-field); }
.kp-section--brand :is(.kp-card, .kp-surface) :focus-visible { outline-color: var(--focus-ring); }
.kp-surface { background: var(--surface-raised); color: var(--text-primary); border-radius: var(--radius-lg); padding: var(--space-6); }
@media (max-width: 819px) { .kp-surface { padding: var(--space-5); } }

/* Eyebrow */
.kp-eyebrow { display: inline-flex; align-items: center; gap: var(--space-2); margin: 0; font-family: var(--font-display); font-size: 12px; font-weight: 500; line-height: 1.3; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-brand); }
.kp-eyebrow__dot { width: 8px; height: 8px; border-radius: var(--radius-pill); background: var(--accent); flex: none; }
.kp-section--brand .kp-eyebrow { color: var(--text-on-brand); }

/* Section header */
.kp-section-header { display: flex; flex-direction: column; gap: var(--space-4); max-width: 760px; margin-bottom: var(--space-7); }
.kp-section-header--center { margin-left: auto; margin-right: auto; text-align: center; align-items: center; }
.kp-section-header__title { margin: 0; font-family: var(--font-display); font-size: 40px; font-weight: 500; line-height: 1.08; color: inherit; text-wrap: balance; }
.kp-section-header--display .kp-section-header__title { font-size: 56px; font-weight: 450; line-height: 1.05; letter-spacing: -0.01em; }
.kp-section-header--hero .kp-section-header__title { font-size: 72px; font-weight: 450; line-height: 1.02; letter-spacing: -0.01em; }
.kp-section-header__lead { margin: 0; max-width: var(--text-max); font-size: 19px; line-height: 1.55; color: var(--text-secondary); text-wrap: pretty; }
.kp-section--brand .kp-section-header__lead { color: var(--text-on-brand); }
@media (max-width: 819px) {
  .kp-section-header__title { font-size: 32px; }
  .kp-section-header--display .kp-section-header__title { font-size: 40px; }
  .kp-section-header--hero .kp-section-header__title { font-size: 48px; }
  .kp-section-header__lead { font-size: 17px; }
}
@media (max-width: 479px) {
  .kp-section-header--hero .kp-section-header__title { font-size: 40px; }
}

/* Feature card */
.kp-card { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-6); background: var(--surface-raised); border: var(--border-hairline) solid var(--border-subtle); border-radius: var(--radius-md); color: var(--text-primary); }
.kp-card__index { font-family: var(--font-display); font-size: 12px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-tertiary); }
.kp-card__title { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 500; line-height: 1.25; }
.kp-card__body { margin: 0; font-size: 16px; line-height: 1.6; color: var(--text-secondary); }
.kp-card__link { margin-top: auto; padding-top: var(--space-3); font-size: 15px; font-weight: 500; color: var(--text-primary); text-decoration: none; display: inline-flex; gap: var(--space-2); align-items: center; }
.kp-card__link:hover { text-decoration: underline; text-underline-offset: 4px; }
a.kp-card { text-decoration: none; transition: border-color 160ms ease; }
a.kp-card:hover { border-color: var(--border-strong); }

/* Stat */
.kp-stat { display: flex; flex-direction: column; gap: var(--space-3); padding-top: var(--space-5); border-top: var(--border-hairline) solid var(--border-subtle); }
.kp-stat__figure { margin: 0; font-family: var(--font-display); font-size: 64px; font-weight: 300; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.kp-stat--result .kp-stat__figure { color: var(--text-accent); }
.kp-stat--result { border-top: var(--border-thick) solid var(--accent); }
.kp-stat__label { margin: 0; font-size: 16px; line-height: 1.5; color: var(--text-secondary); max-width: 32ch; }
.kp-stat__source { margin: 0; font-size: 12px; line-height: 1.45; color: var(--text-tertiary); }
@media (max-width: 819px) { .kp-stat__figure { font-size: 48px; } }

/* Evidence log */
.kp-log { list-style: none; margin: 0; padding: 0; border: var(--border-hairline) solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-raised); overflow: hidden; }
.kp-log__head, .kp-log__row { display: grid; grid-template-columns: 96px minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-5); padding: var(--space-4) var(--space-5); }
.kp-log__head { font-family: var(--font-display); font-size: 12px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-tertiary); border-bottom: var(--border-hairline) solid var(--border-subtle); }
.kp-log__row + .kp-log__row { border-top: var(--border-hairline) solid var(--border-subtle); }
.kp-log__when { font-family: var(--font-display); font-size: 14px; font-weight: 500; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.kp-log__cell { font-size: 15px; line-height: 1.5; color: var(--text-secondary); }
.kp-log__cell--what { color: var(--text-primary); }
.kp-log__cell--result { color: var(--text-primary); font-weight: 500; display: flex; gap: var(--space-2); align-items: baseline; }
.kp-log__cell--result::before { content: ""; width: 6px; height: 6px; border-radius: var(--radius-pill); background: var(--accent); flex: none; transform: translateY(-2px); }
.kp-log__k { display: none; }
@media (max-width: 819px) {
  .kp-log__head { display: none; }
  .kp-log__row { grid-template-columns: 1fr; gap: var(--space-2); }
  .kp-log__k { display: block; font-family: var(--font-display); font-size: 11px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-tertiary); }
}

/* Steps */
.kp-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); counter-reset: kp-step; }
.kp-steps__item { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5) 0 0; border-top: var(--border-hairline) solid var(--border-strong); counter-increment: kp-step; }
.kp-steps__item::before { content: counter(kp-step, decimal-leading-zero); font-family: var(--font-display); font-size: 14px; font-weight: 500; letter-spacing: 0.08em; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.kp-steps__title { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 500; line-height: 1.25; }
.kp-steps__body { margin: 0; font-size: 16px; line-height: 1.6; color: var(--text-secondary); }
.kp-steps__needs { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-tertiary); }

/* Fields */
.kp-field { display: flex; flex-direction: column; gap: var(--space-2); }
.kp-field__label { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.kp-field__control { width: 100%; min-height: var(--control-md); padding: 10px 14px; font: inherit; font-size: 16px; line-height: 1.5; color: var(--text-primary); background: var(--surface-raised); border: var(--border-hairline) solid var(--border-field); border-radius: var(--radius-sm); transition: border-color 120ms ease; }
.kp-field__control::placeholder { color: var(--text-tertiary); }
.kp-field__control:hover { border-color: var(--border-strong); }
.kp-field__control:focus-visible { outline: var(--border-thick) solid var(--focus-ring); outline-offset: 2px; border-color: var(--border-strong); }
textarea.kp-field__control { min-height: 120px; resize: vertical; }
.kp-field__hint { font-size: 14px; line-height: 1.5; color: var(--text-tertiary); }
.kp-field__error { font-size: 14px; line-height: 1.5; color: var(--danger); }
.kp-field--invalid .kp-field__control { border-color: var(--danger); }
.kp-form { display: flex; flex-direction: column; gap: var(--space-4); }

/* Nav */
.kp-nav { position: relative; background: var(--surface-page); border-bottom: var(--border-hairline) solid var(--border-subtle); }
.kp-nav__bar { display: flex; align-items: center; gap: var(--space-6); min-height: 72px; }
.kp-nav__brand { display: inline-flex; color: var(--logo-ink); }
.kp-nav__links { display: flex; gap: var(--space-5); margin: 0 0 0 auto; padding: 0; list-style: none; }
.kp-nav__link { font-size: 14px; color: var(--text-secondary); text-decoration: none; padding: var(--space-2) 0; }
.kp-nav__link:hover { color: var(--text-primary); }
.kp-nav__cta { flex: none; }
.kp-nav__menu { display: none; margin-left: auto; }
/* Phone menu: the burger alone (its label is the aria-label) opens a drawer from the right with a scrim; links rise
   in turn and a segment runs down the drawer edge. Plain details/summary, so it works without script. */
.kp-nav__menu > summary { position: relative; z-index: 61; list-style: none; cursor: pointer; display: grid; place-items: center; width: var(--control-md); height: var(--control-md); margin-right: -10px; border-radius: var(--radius-pill); color: var(--text-primary); -webkit-tap-highlight-color: transparent; }
.kp-nav__menu > summary::-webkit-details-marker { display: none; }
.kp-burger { position: relative; width: 24px; height: 12px; }
.kp-burger::before, .kp-burger::after { content: ""; position: absolute; right: 0; height: 1.5px; background: currentColor; border-radius: 2px; transition: transform 450ms var(--easing-out, ease), top 450ms var(--easing-out, ease), width 450ms var(--easing-out, ease); }
.kp-burger::before { top: 0; width: 24px; }
.kp-burger::after { top: 10.5px; width: 15px; }
.kp-nav__menu > summary:hover .kp-burger::after { width: 24px; }
.kp-nav__menu[open] .kp-burger::before { top: 5.25px; width: 24px; transform: rotate(45deg); }
.kp-nav__menu[open] .kp-burger::after { top: 5.25px; width: 24px; transform: rotate(-45deg); }
.kp-nav__drawer { position: fixed; inset: 0; z-index: 60; }
.kp-nav__scrim { position: absolute; inset: 0; background: rgba(8, 9, 11, 0.62); animation: kp-fade 400ms ease both; }
.kp-nav__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(86vw, 380px); display: flex; flex-direction: column; padding: calc(64px + var(--space-4)) var(--space-6) var(--space-7); background: var(--surface-page); box-shadow: var(--shadow-float); overflow: hidden auto; animation: kp-slide-in 600ms var(--easing-out, ease) both; }
.kp-nav__panel::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--border-hairline); background: linear-gradient(transparent, var(--text-primary)) no-repeat 0 -120px / 1px 120px, var(--border-subtle); animation: kp-edge-run 4200ms 600ms var(--easing-in-out, ease-in-out) infinite; }
.kp-nav__panel .kp-nav__link { display: flex; align-items: baseline; gap: var(--space-4); padding: var(--space-4) 0; border-bottom: var(--border-hairline) solid var(--border-subtle); font-family: var(--font-display); font-size: 26px; font-weight: 450; letter-spacing: -0.01em; color: var(--text-primary); animation: kp-rise 600ms calc(200ms + var(--i, 0) * 70ms) var(--easing-out, ease) both; transition: padding-left 350ms var(--easing-out, ease); }
.kp-nav__panel .kp-nav__link:hover { padding-left: var(--space-2); }
.kp-nav__n { font-size: 12px; font-weight: 500; letter-spacing: 0.14em; color: var(--text-brand); }
.kp-nav__panel .kp-btn { margin-top: auto; align-self: flex-start; animation: kp-rise 600ms 500ms var(--easing-out, ease) both; }
@keyframes kp-slide-in { from { transform: translateX(100%); } }
@keyframes kp-fade { from { opacity: 0; } }
@keyframes kp-rise { from { opacity: 0; transform: translateX(28px); } }
@keyframes kp-edge-run { 0% { background-position: 0 -120px, 0 0; } 65%, 100% { background-position: 0 calc(100% + 120px), 0 0; } }
@media (max-width: 819px) {
  .kp-nav__links, .kp-nav__cta { display: none; }
  .kp-nav__menu { display: block; }
  .kp-nav__bar { min-height: 64px; }
  .kp-nav__brand svg { height: 40px !important; }
  .kp-nav__brand { height: 40px !important; }
}
@media (prefers-reduced-motion: reduce) {
  .kp-nav__scrim, .kp-nav__panel, .kp-nav__panel::before, .kp-nav__panel .kp-nav__link, .kp-nav__panel .kp-btn { animation: none !important; }
}

/* FAQ */
.kp-faq { border-top: var(--border-hairline) solid var(--border-subtle); }
.kp-faq__item { border-bottom: var(--border-hairline) solid var(--border-subtle); }
.kp-faq__q { display: flex; justify-content: space-between; align-items: center; gap: var(--space-5); padding: var(--space-5) 0; cursor: pointer; list-style: none; font-family: var(--font-display); font-size: 20px; font-weight: 500; line-height: 1.3; color: var(--text-primary); }
.kp-faq__q::-webkit-details-marker { display: none; }
.kp-faq__q::after { content: "+"; font-family: var(--font-display); font-weight: 300; font-size: 28px; line-height: 1; color: var(--text-tertiary); transition: transform 160ms ease; flex: none; }
.kp-faq__item[open] .kp-faq__q::after { transform: rotate(45deg); }
.kp-faq__a { margin: 0; padding: 0 0 var(--space-5); max-width: var(--text-max); font-size: 16px; line-height: 1.6; color: var(--text-secondary); }

/* Tag */
.kp-tag { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 26px; padding: 0 10px; border: var(--border-hairline) solid var(--border-default); border-radius: var(--radius-pill); font-family: var(--font-text); font-size: 13px; font-weight: 500; color: var(--text-secondary); background: transparent; }
.kp-tag--strong { background: var(--surface-inverse); border-color: var(--surface-inverse); color: var(--text-inverse); }

/* Callout */
.kp-callout { display: flex; gap: var(--space-4); padding: var(--space-5); border: var(--border-hairline) solid var(--border-default); border-radius: var(--radius-md); background: var(--surface-muted); color: var(--text-primary); }
.kp-callout__mark { flex: none; width: 24px; height: 24px; border-radius: var(--radius-pill); border: var(--border-hairline) solid var(--border-field); display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 14px; font-weight: 500; color: var(--text-primary); }
.kp-callout__title { margin: 0 0 var(--space-1); font-size: 16px; font-weight: 500; }
.kp-callout__body { margin: 0; font-size: 15px; line-height: 1.55; color: var(--text-secondary); }

/* Footer */
.kp-footer { padding: var(--space-8) 0 var(--space-6); background: var(--surface-page); border-top: var(--border-hairline) solid var(--border-subtle); color: var(--text-secondary); }
.kp-footer__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-6); }
.kp-footer__brand { display: inline-flex; color: var(--logo-ink); }
.kp-footer__cols { display: flex; flex-wrap: wrap; gap: var(--space-8); }
.kp-footer__col { display: flex; flex-direction: column; gap: var(--space-2); min-width: 140px; }
.kp-footer__head { font-family: var(--font-display); font-size: 12px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-tertiary); margin: 0 0 var(--space-1); }
.kp-footer__link { font-size: 14px; color: var(--text-secondary); text-decoration: none; }
.kp-footer__link:hover { color: var(--text-primary); text-decoration: underline; text-underline-offset: 4px; }
.kp-footer__legal { margin: var(--space-7) 0 0; padding-top: var(--space-5); border-top: var(--border-hairline) solid var(--border-subtle); font-size: 12px; line-height: 1.5; color: var(--text-tertiary); }

/* Running text links */
.kp-link { color: var(--text-accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.kp-link:hover { text-decoration-thickness: 2px; }

@media (prefers-reduced-motion: reduce) {
  .kp-root *, .kp-root *::before, .kp-root *::after { transition: none !important; }
}

/* ======================================================================
   App views: dashboards and working documents (Mercury as the reference).
   A collapsible icon side menu instead of tabs, KPI tiles, data tables,
   charts, checklists and segmented controls. Behaviour: components/app.js
   (vanilla) or the React components in bundle.js. Everything renders and
   reads without JavaScript: the menu becomes anchor links and every view
   stacks.
   ====================================================================== */

/* Icons: 24px grid, 1.5px stroke, currentColor, no fill. */
.kp-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.kp-icon--sm { width: 16px; height: 16px; }

/* ---------- Shell ---------- */
.kp-shell { --kp-nav: var(--nav-w); display: grid; grid-template-columns: var(--kp-nav) minmax(0, 1fr); min-height: 100vh; background: var(--surface-page); color: var(--text-primary); transition: grid-template-columns 180ms ease; }
.kp-shell[data-collapsed="true"] { --kp-nav: var(--nav-w-collapsed); }
.kp-shell--contained { min-height: 0; height: 100%; }

.kp-sidenav { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 2px; padding: var(--space-4) var(--space-3); background: var(--surface-raised); border-right: var(--border-hairline) solid var(--border-subtle); overflow-y: auto; overflow-x: hidden; z-index: 30; }
.kp-shell--contained .kp-sidenav { position: relative; height: 100%; }
.kp-sidenav__brand { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; padding: 0 var(--space-2); margin-bottom: var(--space-3); color: var(--text-primary); text-decoration: none; }
.kp-sidenav__brand-text { font-family: var(--font-display); font-size: 15px; font-weight: 500; line-height: 1.2; white-space: nowrap; }
.kp-sidenav__brand-text small { display: block; font-family: var(--font-text); font-size: 12px; font-weight: 400; color: var(--text-tertiary); }
.kp-sidenav__group { margin: var(--space-4) 0 var(--space-1); padding: 0 var(--space-3); font-family: var(--font-display); font-size: 11px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-tertiary); white-space: nowrap; }
.kp-sidenav__item { position: relative; display: flex; align-items: center; gap: var(--space-3); min-height: 44px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-secondary); font: inherit; font-size: 14px; font-weight: 400; text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer; width: 100%; }
.kp-sidenav__item:hover { background: var(--surface-hover); color: var(--text-primary); }
.kp-sidenav__item[aria-current="page"], .kp-sidenav__item[aria-current="true"] { background: var(--surface-muted); color: var(--text-primary); font-weight: 500; }
.kp-sidenav__item[aria-current="page"] .kp-icon, .kp-sidenav__item[aria-current="true"] .kp-icon { color: var(--text-brand); }
.kp-sidenav__label { overflow: hidden; text-overflow: ellipsis; }
.kp-sidenav__badge { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-tertiary); }
.kp-sidenav__foot { margin-top: auto; padding-top: var(--space-3); border-top: var(--border-hairline) solid var(--border-subtle); display: flex; flex-direction: column; gap: 2px; }
.kp-sidenav__collapse .kp-icon { transition: transform 180ms ease; }
.kp-shell[data-collapsed="true"] .kp-sidenav__collapse .kp-icon { transform: scaleX(-1); }

/* Collapsed to the icon rail (desktop only). */
@media (min-width: 900px) {
  .kp-shell[data-collapsed="true"] .kp-sidenav { padding-left: var(--space-3); padding-right: var(--space-3); }
  .kp-shell[data-collapsed="true"] :is(.kp-sidenav__label, .kp-sidenav__brand-text, .kp-sidenav__badge) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .kp-shell[data-collapsed="true"] .kp-sidenav__item { justify-content: center; padding: 0; }
  .kp-shell[data-collapsed="true"] .kp-sidenav__brand { justify-content: center; padding: 0; }
  .kp-shell[data-collapsed="true"] .kp-sidenav__group { height: 1px; margin: var(--space-3) var(--space-2); padding: 0; overflow: hidden; color: transparent; background: var(--border-subtle); }
}

/* Main column and its sticky top bar. */
.kp-main { min-width: 0; display: flex; flex-direction: column; }
.kp-topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-3); min-height: 60px; padding: 0 var(--space-6); background: color-mix(in srgb, var(--surface-page) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: var(--border-hairline) solid var(--border-subtle); }
.kp-topbar__title { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kp-topbar__crumb { color: var(--text-tertiary); font-weight: 400; }
.kp-topbar__actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }
.kp-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-secondary); cursor: pointer; }
.kp-iconbtn:hover { background: var(--surface-hover); color: var(--text-primary); }
.kp-topbar__menu { display: none; margin-left: calc(-1 * var(--space-2)); }
.kp-content { width: 100%; max-width: 1120px; margin: 0 auto; padding: var(--space-6) var(--space-6) var(--space-9); display: flex; flex-direction: column; gap: var(--space-5); }
.kp-view { display: flex; flex-direction: column; gap: var(--space-5); scroll-margin-top: 72px; }
.kp-view + .kp-view { padding-top: var(--space-7); border-top: var(--border-hairline) solid var(--border-subtle); }
.kp-js .kp-view + .kp-view { padding-top: 0; border-top: 0; }
.kp-view[hidden] { display: none; }
.kp-scrim { display: none; }

/* Phone and tablet: the menu is a drawer opened from the top bar.
   Without JavaScript (no .kp-js on <html>) it stays a plain block of links above the content. */
@media (max-width: 899px) {
  .kp-shell, .kp-shell[data-collapsed="true"] { grid-template-columns: minmax(0, 1fr); }
  .kp-sidenav { position: static; height: auto; border-right: 0; border-bottom: var(--border-hairline) solid var(--border-subtle); }
  .kp-js .kp-sidenav { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100%; border-right: var(--border-hairline) solid var(--border-subtle); border-bottom: 0; transform: translateX(-102%); transition: transform 200ms ease; box-shadow: none; z-index: 60; }
  .kp-js .kp-shell[data-nav-open="true"] .kp-sidenav { transform: none; box-shadow: var(--shadow-float); }
  .kp-js .kp-shell[data-nav-open="true"] .kp-scrim { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(11, 11, 10, 0.4); }
  .kp-sidenav__collapse { display: none; }
  .kp-js .kp-topbar__menu { display: inline-flex; }
  .kp-topbar { padding: 0 var(--space-4); }
  .kp-content { padding: var(--space-5) var(--gutter-sm) var(--space-8); gap: var(--space-4); }
  .kp-view { gap: var(--space-4); }
}
.kp-shell--contained .kp-sidenav { position: relative; }
@media (prefers-reduced-motion: reduce) { .kp-shell, .kp-sidenav, .kp-sidenav__collapse .kp-icon { transition: none; } }

/* ---------- Page head ---------- */
.kp-pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3) var(--space-5); }
.kp-pagehead__text { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.kp-pagehead__title { margin: 0; font-family: var(--font-display); font-size: 32px; font-weight: 500; line-height: 1.12; letter-spacing: -0.01em; text-wrap: balance; }
.kp-pagehead__lead { margin: 0; max-width: 62ch; font-size: 15px; line-height: 1.55; color: var(--text-secondary); text-wrap: pretty; }
.kp-pagehead__meta { display: flex; flex-wrap: wrap; gap: var(--space-2); }
@media (max-width: 479px) { .kp-pagehead__title { font-size: 26px; } }

/* ---------- KPI tiles: one joined strip, hairlines between ---------- */
.kp-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 1px; background: var(--border-subtle); border: var(--border-hairline) solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; }
.kp-kpi { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: var(--space-5); background: var(--surface-raised); }
.kp-kpi__label { display: flex; align-items: center; gap: var(--space-2); margin: 0; font-size: 13px; line-height: 1.35; color: var(--text-secondary); }
.kp-kpi__value { margin: 0; font-family: var(--font-display); font-size: 36px; font-weight: 300; line-height: 1.05; letter-spacing: -0.02em; color: var(--text-primary); white-space: nowrap; }
.kp-kpi__unit { margin-left: 4px; font-family: var(--font-text); font-size: 14px; font-weight: 400; letter-spacing: 0; color: var(--text-tertiary); }
.kp-kpi__cur { margin-right: 4px; font-family: var(--font-text); font-size: 14px; font-weight: 400; letter-spacing: 0; color: var(--text-tertiary); vertical-align: 0.9em; }
.kp-kpi__meta { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-tertiary); }
.kp-kpi--hero .kp-kpi__value { font-size: 52px; }
.kp-kpi--result .kp-kpi__label::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--accent); vertical-align: 2px; }
/* KPI tiles inside a panel lose their own card: one surface, not a box in a box. */
.kp-panel .kp-kpis { border: 0; background: transparent; border-radius: 0; }
.kp-panel .kp-kpi { padding: 0; }
@media (max-width: 479px) { .kp-kpi { padding: var(--space-4); } .kp-kpi__value { font-size: 28px; } .kp-kpi--hero .kp-kpi__value { font-size: 40px; } }

/* ---------- Panels ---------- */
.kp-panel { display: flex; flex-direction: column; min-width: 0; background: var(--surface-raised); border: var(--border-hairline) solid var(--border-subtle); border-radius: var(--radius-md); }
.kp-panel__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: var(--space-5) var(--space-5) 0; }
.kp-panel__titles { flex: 1 1 220px; min-width: 0; }
.kp-panel__title { margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 500; line-height: 1.3; }
.kp-panel__sub { margin: 2px 0 0; font-size: 13px; line-height: 1.45; color: var(--text-tertiary); }
.kp-panel__body { padding: var(--space-4) var(--space-5) var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.kp-panel__body--flush { padding: var(--space-3) 0 0; }
.kp-panel__foot { padding: var(--space-3) var(--space-5); border-top: var(--border-hairline) solid var(--border-subtle); font-size: 13px; color: var(--text-tertiary); }
.kp-row { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); align-items: start; }
.kp-row--wide { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
@media (max-width: 899px) { .kp-row, .kp-row--wide { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); } .kp-panel__head { padding: var(--space-4) var(--space-4) 0; } .kp-panel__body { padding: var(--space-3) var(--space-4) var(--space-4); } .kp-panel__foot { padding: var(--space-3) var(--space-4); } }

.kp-stack { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
@media (max-width: 899px) { .kp-stack { gap: var(--space-4); } }

/* ---------- Status pills ---------- */
.kp-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 10px 0 8px; border: var(--border-hairline) solid var(--border-default); border-radius: var(--radius-pill); font-size: 12.5px; font-weight: 500; line-height: 1; color: var(--text-secondary); white-space: nowrap; background: transparent; }
.kp-pill::before { content: ""; width: 6px; height: 6px; border-radius: var(--radius-pill); background: var(--kp-pill, var(--status-todo)); }
.kp-pill--ok { --kp-pill: var(--status-ok); }
.kp-pill--warn { --kp-pill: var(--status-warn); color: var(--status-warn); border-color: currentColor; }
.kp-pill--todo { --kp-pill: var(--status-todo); }
.kp-pill--plain::before { display: none; }
.kp-pill--plain { padding: 0 10px; }

/* ---------- Data table ---------- */
.kp-table-wrap { width: 100%; overflow-x: auto; background: var(--surface-raised); border: var(--border-hairline) solid var(--border-subtle); border-radius: var(--radius-md); }
.kp-panel .kp-table-wrap { border: 0; border-radius: 0 0 var(--radius-md) var(--radius-md); background: transparent; }
.kp-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.45; }
.kp-table th { padding: 10px var(--space-4); border-bottom: var(--border-hairline) solid var(--border-subtle); font-family: var(--font-display); font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; text-align: left; color: var(--text-tertiary); white-space: nowrap; }
.kp-table td { padding: 13px var(--space-4); border-bottom: var(--border-hairline) solid var(--border-subtle); vertical-align: middle; color: var(--text-primary); }
.kp-table :is(th, td):first-child { padding-left: var(--space-5); }
.kp-table :is(th, td):last-child { padding-right: var(--space-5); }
.kp-table tbody tr:last-child td { border-bottom: 0; }
.kp-table tbody tr:hover td { background: var(--surface-hover); }
.kp-table .kp-num, .kp-table th.kp-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kp-table tfoot td { border-top: var(--border-hairline) solid var(--border-default); border-bottom: 0; font-weight: 500; }
.kp-cell { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.kp-cell__text { min-width: 0; }
.kp-cell__sub { display: block; margin-top: 1px; font-size: 12.5px; color: var(--text-tertiary); }
.kp-muted { color: var(--text-tertiary); }
/* Under 640px a stacked table turns each row into a block: lead cell first, the rest as label and value. */
@media (max-width: 639px) {
  .kp-table--stack thead { display: none; }
  .kp-table--stack, .kp-table--stack tbody, .kp-table--stack tfoot { display: block; }
  .kp-table--stack tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: var(--border-hairline) solid var(--border-subtle); }
  .kp-table--stack tbody tr:last-child { border-bottom: 0; }
  .kp-table--stack tfoot tr { border-top: var(--border-hairline) solid var(--border-default); border-bottom: 0; }
  .kp-table--stack td, .kp-table--stack :is(th, td):first-child, .kp-table--stack :is(th, td):last-child { padding: 0; border: 0; }
  .kp-table--stack tbody tr:hover td { background: transparent; }
  .kp-table--stack td:first-child { flex: 1 1 60%; min-width: 0; }
  .kp-table--stack td.kp-num:not([data-label]) { margin-left: auto; }
  .kp-table--stack td[data-label]:not(:first-child) { order: 3; display: inline-flex; align-items: center; gap: 4px; flex: 0 1 auto; margin: 0; font-size: 13px; color: var(--text-secondary); }
  .kp-table--stack td[data-label]:not(:first-child)::before { content: attr(data-label) " ·"; color: var(--text-tertiary); }
  .kp-table--stack td.kp-num[data-label]:not(:first-child) { font-variant-numeric: tabular-nums; }
  .kp-table--stack td[data-label]:not(:first-child):has(> .kp-pill)::before { content: none; }
  .kp-table--stack tr:has(td[data-label]:not(:first-child))::after { content: ""; order: 2; flex-basis: 100%; height: 0; }
}

/* ---------- Series swatches and legends ---------- */
.kp-s1 { --kp-series: var(--chart-1); } .kp-s2 { --kp-series: var(--chart-2); } .kp-s3 { --kp-series: var(--chart-3); } .kp-s4 { --kp-series: var(--chart-4); } .kp-s0 { --kp-series: var(--chart-muted); } .kp-sn { --kp-series: var(--text-tertiary); }
.kp-range { box-shadow: inset 0 0 0 1px var(--text-tertiary); }
.kp-swatch { display: inline-block; width: 10px; height: 10px; flex: none; border-radius: 3px; background: var(--kp-series, var(--chart-1)); }
.kp-legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--text-secondary); }
.kp-legend li { display: inline-flex; align-items: center; gap: var(--space-2); }
.kp-legend b { font-weight: 500; color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* ---------- Bar list: one series, ranked horizontal bars ---------- */
.kp-bars { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.kp-bars__row { display: grid; grid-template-columns: minmax(96px, 38%) minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); min-height: 36px; padding: 0 var(--space-2); margin: 0 calc(-1 * var(--space-2)); border-radius: var(--radius-sm); font-size: 14px; }
.kp-bars__row:hover, .kp-bars__row:focus-visible { background: var(--surface-hover); }
.kp-bars__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.kp-bars__track { position: relative; height: 12px; }
.kp-bars__fill { display: block; height: 100%; width: calc(var(--v, 0) * 100%); min-width: 2px; border-radius: 0 4px 4px 0; background: var(--kp-series, var(--chart-1)); }
.kp-bars__value { min-width: 4.5em; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-primary); }
@media (max-width: 479px) { .kp-bars__row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; padding-top: 6px; padding-bottom: 6px; } .kp-bars__track { grid-column: 1 / -1; grid-row: 2; } }

/* ---------- Split bar: one whole, split into parts (tall segmented bar) ---------- */
.kp-splitbar { display: flex; flex-direction: column; gap: var(--space-3); }
.kp-splitbar__bar { display: flex; gap: 2px; height: 28px; }
.kp-splitbar__seg { flex: var(--v) 1 0; min-width: 4px; display: flex; align-items: center; padding: 0 8px; border-radius: 4px; background: var(--kp-series, var(--chart-1)); color: var(--chart-on); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; cursor: default; }
.kp-splitbar__seg span { overflow: hidden; }
.kp-splitbar__seg:hover, .kp-splitbar__seg:focus-visible { filter: brightness(1.08); }
.kp-splitbar--thin .kp-splitbar__bar { height: 8px; }
.kp-splitbar--thin .kp-splitbar__seg { padding: 0; border-radius: var(--radius-pill); }

/* ---------- Stacked bars: several wholes compared, each split the same way ---------- */
.kp-stacks { display: flex; flex-direction: column; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.kp-stacks__row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); font-size: 14px; }
.kp-stacks__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kp-stacks__label { color: var(--text-secondary); }
.kp-stacks__row[aria-current="true"] .kp-stacks__label { color: var(--text-primary); font-weight: 500; }
.kp-stacks__bar { display: flex; gap: 2px; height: 20px; width: calc(var(--v, 1) * 100%); }
.kp-stacks__seg { flex: var(--v) 1 0; min-width: 2px; background: var(--kp-series, var(--chart-1)); }
.kp-stacks__seg:first-child { border-radius: 0; }
.kp-stacks__seg:last-child { border-radius: 0 4px 4px 0; }
.kp-stacks:not(.kp-stacks--plain) .kp-stacks__row:not([aria-current="true"]) .kp-stacks__bar { opacity: 0.45; }
[data-theme="dark"] .kp-stacks:not(.kp-stacks--plain) .kp-stacks__row:not([aria-current="true"]) .kp-stacks__bar { opacity: 0.6; }
.kp-stacks__total { min-width: 4.5em; text-align: right; font-variant-numeric: tabular-nums; }
.kp-stacks__row[aria-current="true"] .kp-stacks__total { font-weight: 500; }


/* ---------- Meter (progress) ---------- */
.kp-meter { display: block; height: 6px; border-radius: var(--radius-pill); background: var(--chart-track); overflow: hidden; }
.kp-meter__fill { display: block; height: 100%; width: calc(var(--v, 0) * 100%); border-radius: var(--radius-pill); background: var(--kp-series, var(--chart-1)); transition: width 240ms ease; }

/* ---------- Segmented control ---------- */
.kp-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-pill); background: var(--surface-muted); }
.kp-seg__opt { min-height: 32px; padding: 0 14px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--text-secondary); font: inherit; font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.kp-seg__opt:hover { color: var(--text-primary); }
.kp-seg__opt[aria-checked="true"] { background: var(--surface-raised); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--border-default); }
.kp-seg__opt:focus-visible { outline: var(--border-thick) solid var(--focus-ring); outline-offset: 1px; }
.kp-seg-host { display: flex; align-items: center; gap: var(--space-3); }
.kp-seg-host__label { font-size: 13px; color: var(--text-tertiary); }
/* Scenario variants: the host carries data-scn (a-d or 0-3); only matching [data-when] children show. */
[data-scn="a"] [data-when]:not([data-when~="a"]), [data-scn="b"] [data-when]:not([data-when~="b"]), [data-scn="c"] [data-when]:not([data-when~="c"]), [data-scn="d"] [data-when]:not([data-when~="d"]), [data-scn="0"] [data-when]:not([data-when~="0"]), [data-scn="1"] [data-when]:not([data-when~="1"]), [data-scn="2"] [data-when]:not([data-when~="2"]), [data-scn="3"] [data-when]:not([data-when~="3"]) { display: none !important; }

/* ---------- Checklist with progress ---------- */
.kp-checklist { display: flex; flex-direction: column; }
.kp-checklist__progress { display: flex; align-items: center; gap: var(--space-3); padding-bottom: var(--space-4); font-size: 13px; color: var(--text-secondary); }
.kp-checklist__progress .kp-meter { flex: 1; }
.kp-checklist__progress b { font-weight: 500; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.kp-checklist__list { margin: 0; padding: 0; list-style: none; border-top: var(--border-hairline) solid var(--border-subtle); }
.kp-checklist__item { border-bottom: var(--border-hairline) solid var(--border-subtle); }
.kp-checklist__item:last-child { border-bottom: 0; }
.kp-check { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: start; gap: var(--space-3); padding: var(--space-3) 0; cursor: pointer; }
.kp-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kp-check__box { width: 20px; height: 20px; margin-top: 1px; border: 1.5px solid var(--border-field); border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: transparent; background: var(--surface-raised); transition: background-color 120ms ease, border-color 120ms ease; }
.kp-check__box .kp-icon { width: 14px; height: 14px; stroke-width: 2.25; }
.kp-check input:checked + .kp-check__box { background: var(--status-ok); border-color: var(--status-ok); color: var(--surface-raised); }
.kp-check input:focus-visible + .kp-check__box { outline: var(--border-thick) solid var(--focus-ring); outline-offset: 2px; }
.kp-check__title { display: block; font-size: 15px; font-weight: 500; line-height: 1.4; color: var(--text-primary); }
.kp-check__desc { display: block; margin-top: 2px; font-size: 13.5px; line-height: 1.5; color: var(--text-secondary); }
.kp-check__meta { font-size: 13px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 2px; }
.kp-check input:checked ~ .kp-check__text .kp-check__title { color: var(--text-tertiary); text-decoration: line-through; text-decoration-color: var(--border-default); }
.kp-checklist__item > .kp-more { margin: 0 0 var(--space-3) 36px; }

/* ---------- Timeline (steps over time) ---------- */
.kp-timeline { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.kp-timeline__item { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: var(--space-3); padding-bottom: var(--space-4); }
.kp-timeline__item::before { content: ""; position: absolute; left: 9.25px; top: 22px; bottom: 2px; width: 1.5px; background: var(--border-subtle); }
.kp-timeline__item:last-child { padding-bottom: 0; }
.kp-timeline__item:last-child::before { display: none; }
.kp-timeline__dot { width: 20px; height: 20px; margin-top: 1px; border-radius: var(--radius-pill); border: 1.5px solid var(--border-field); background: var(--surface-raised); display: inline-flex; align-items: center; justify-content: center; color: transparent; }
.kp-timeline__dot .kp-icon { width: 12px; height: 12px; stroke-width: 2.5; }
.kp-timeline__item--done .kp-timeline__dot { background: var(--status-ok); border-color: var(--status-ok); color: var(--surface-raised); }
.kp-timeline__item--now .kp-timeline__dot { border-color: var(--accent); box-shadow: inset 0 0 0 4px var(--surface-raised); background: var(--accent); }
.kp-timeline__when { display: block; font-family: var(--font-display); font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-tertiary); }
.kp-timeline__title { display: block; margin-top: 2px; font-size: 15px; font-weight: 500; line-height: 1.4; }
.kp-timeline__desc { display: block; margin-top: 2px; font-size: 13.5px; line-height: 1.5; color: var(--text-secondary); }

/* ---------- Disclosure: "more detail" without walls of text ---------- */
.kp-more { font-size: 14px; }
.kp-more > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; list-style: none; cursor: pointer; color: var(--text-secondary); font-weight: 500; font-size: 13px; }
.kp-more > summary::-webkit-details-marker { display: none; }
@media (pointer: coarse) { .kp-seg__opt, .kp-more > summary { min-height: 44px; } }
.kp-more > summary:hover { color: var(--text-primary); }
.kp-more > summary .kp-icon { width: 16px; height: 16px; transition: transform 160ms ease; }
.kp-more[open] > summary .kp-icon { transform: rotate(180deg); }
.kp-more__body { padding: var(--space-2) 0 var(--space-1); color: var(--text-secondary); line-height: 1.6; }
.kp-more__body > :first-child { margin-top: 0; } .kp-more__body > :last-child { margin-bottom: 0; }
.kp-more__body ul { margin: var(--space-2) 0; padding-left: 1.1em; }
.kp-more__body li + li { margin-top: 4px; }
.kp-more__body b, .kp-more__body strong { color: var(--text-primary); font-weight: 500; }

/* ---------- Notes: short facts in a list, not paragraphs ---------- */
.kp-facts { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.kp-facts li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: var(--space-3); padding: var(--space-3) 0; border-top: var(--border-hairline) solid var(--border-subtle); font-size: 14px; line-height: 1.55; color: var(--text-secondary); }
.kp-facts li:first-child { border-top: 0; padding-top: 0; }
.kp-facts li > .kp-icon { margin-top: 1px; color: var(--text-tertiary); }
.kp-facts b { color: var(--text-primary); font-weight: 500; }

/* ---------- Tooltip (one per page, positioned by app.js) ---------- */
.kp-tip { position: fixed; z-index: 80; max-width: 260px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-inverse); color: var(--text-inverse); font-size: 12.5px; line-height: 1.45; pointer-events: none; box-shadow: var(--shadow-float); opacity: 0; transform: translateY(4px); transition: opacity 120ms ease, transform 120ms ease; }
.kp-tip[data-show="true"] { opacity: 1; transform: none; }
.kp-tip b { font-weight: 600; }
[data-tip] { cursor: default; }

/* ---------- Visually hidden ---------- */
.kp-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media print { .kp-sidenav, .kp-topbar { display: none; } .kp-shell { display: block; } .kp-view[hidden] { display: flex !important; } }

/* ---------- TL;DR strip: visible on every view and without JavaScript ---------- */
.kp-tldr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-2) var(--space-4); align-items: start; padding: var(--space-4) var(--space-5); background: var(--surface-raised); border: var(--border-hairline) solid var(--border-subtle); border-radius: var(--radius-md); }
.kp-tldr__label { padding-top: 3px; font-family: var(--font-display); font-size: 11px; font-weight: 500; letter-spacing: 0.14em; color: var(--text-accent); }
.kp-tldr ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 14.5px; line-height: 1.5; color: var(--text-secondary); }
.kp-tldr b { color: var(--text-primary); font-weight: 500; }
@media (max-width: 479px) { .kp-tldr { grid-template-columns: minmax(0, 1fr); padding: var(--space-4); } }

/* ---------- Group rows inside a table ---------- */
.kp-table tr.kp-group td { padding-top: var(--space-4); padding-bottom: 6px; background: transparent; border-bottom: var(--border-hairline) solid var(--border-subtle); font-family: var(--font-display); font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-tertiary); }
.kp-table tr.kp-group td .kp-group__sum { float: right; font-family: var(--font-text); font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.kp-table tbody tr.kp-group:hover td { background: transparent; }
@media (max-width: 639px) { .kp-table--stack tr.kp-group { padding-top: var(--space-4); padding-bottom: 6px; } .kp-table--stack tr.kp-group td { padding: 0; border: 0; flex: 1 1 100%; } }

/* ---------- Terms with a definition on hover or focus ---------- */
.kp-term { text-decoration: underline dotted var(--text-tertiary); text-underline-offset: 3px; text-decoration-thickness: 1px; cursor: help; }
.kp-term:focus-visible { outline: var(--border-thick) solid var(--focus-ring); outline-offset: 2px; border-radius: 2px; }

/* ---------- Motion ----------
   One language: thin lines that carry a short travelling segment, a helm that only makes full turns, decoration that
   drifts with the scroll. Content never moves on its own. Scroll-linked motion runs only where the browser supports
   scroll-driven animations; elsewhere every element below shows its final, static state. prefers-reduced-motion
   stops all of it (end of this section). Timing comes from the duration-* and easing-* tokens. */

/* Eyebrow with a line: a 48px hairline in the eyebrow colour with a bright segment travelling along it. */
.kp-eyebrow--line { gap: 14px; }
.kp-eyebrow--line .kp-eyebrow__dot { display: none; }
.kp-eyebrow--line::before { content: ""; flex: none; width: 48px; height: var(--border-hairline);
  background: linear-gradient(currentColor, currentColor) no-repeat -18px 0 / 18px 1px, color-mix(in srgb, currentColor 35%, transparent);
  animation: kp-run-x var(--duration-line, 3600ms) var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)) infinite; }
@keyframes kp-run-x { 0% { background-position: -18px 0, 0 0; } 70%, 100% { background-position: 48px 0, 0 0; } }

/* Running hairline: a full-width divider with two segments crossing in opposite directions (footer, section ends). */
.kp-runline { position: relative; height: var(--border-hairline); overflow: hidden; background: color-mix(in srgb, var(--text-primary) 16%, transparent); }
.kp-runline::before, .kp-runline::after { content: ""; position: absolute; top: 0; height: 100%; }
.kp-runline::before { left: -240px; width: 240px; background: linear-gradient(90deg, transparent, var(--text-primary), transparent); animation: kp-runline-a 7s var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)) infinite; }
.kp-runline::after { left: 100%; width: 96px; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: kp-runline-b 5s 2s var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)) infinite; }
@keyframes kp-runline-a { 0% { left: -240px; } 70%, 100% { left: 100%; } }
@keyframes kp-runline-b { 0% { left: 100%; } 70%, 100% { left: -96px; } }

/* Rail: a vertical hairline on the left of a block (steps, a column of facts) with a segment falling along it.
   Stagger siblings with --kp-delay. */
.kp-rail { position: relative; overflow: hidden; padding-left: var(--space-5); }
.kp-rail::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--border-hairline); background: color-mix(in srgb, var(--text-primary) 18%, transparent); }
.kp-rail::after { content: ""; position: absolute; left: 0; top: -56px; width: var(--border-hairline); height: 56px; background: linear-gradient(transparent, var(--text-primary)); animation: kp-run-y 4.2s var(--kp-delay, 0s) var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)) infinite; }
@keyframes kp-run-y { 0% { top: -56px; } 65%, 100% { top: 100%; } }

/* Running link: a quiet underline with a slow segment passing; hover fills it. For the contact address. */
.kp-runlink { position: relative; display: inline-block; padding-bottom: 6px; text-decoration: none; color: inherit; }
.kp-runlink::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--border-hairline);
  background: linear-gradient(90deg, transparent, currentColor, transparent) no-repeat -64px 0 / 64px 1px, color-mix(in srgb, currentColor 35%, transparent);
  animation: kp-runlink 5s 1s var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)) infinite; }
.kp-runlink::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--border-hairline); background: currentColor; transform-origin: left; transform: scaleX(0); transition: transform 600ms var(--easing-out, cubic-bezier(0.16, 1, 0.3, 1)); }
.kp-runlink:hover::after { transform: scaleX(1); }
@keyframes kp-runlink { 0% { background-position: -64px 0, 0 0; } 60%, 100% { background-position: calc(100% + 64px) 0, 0 0; } }

/* Scroll cue: a short vertical track at the foot of a hero with a segment sliding down it. */
.kp-cue { position: absolute; left: 50%; bottom: var(--space-6); width: var(--border-hairline); height: 64px; overflow: hidden; background: color-mix(in srgb, var(--text-primary) 16%, transparent); }
.kp-cue::after { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 24px; background: var(--text-primary); animation: kp-cue 2.4s var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)) infinite; }
@keyframes kp-cue { from { transform: translateY(-24px); } to { transform: translateY(64px); } }

/* Dot grid: a decorative backdrop for dark bands, faded by a radial mask. Place it first inside a band with
   position: relative and isolation: isolate. --kp-dots-at moves the mask centre. */
.kp-dots { position: absolute; inset: -80px 0; z-index: -2; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--text-primary) 10%, transparent) 1.2px, transparent 1.4px); background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 65% 72% at var(--kp-dots-at, 75% 50%), #000 28%, transparent 75%);
  mask-image: radial-gradient(ellipse 65% 72% at var(--kp-dots-at, 75% 50%), #000 28%, transparent 75%); }

/* Helm logo in motion (Logo with motion). The helm sits in a square box centred on its hub, so it turns on its own
   axis. At rest the lockup keeps its true proportions; the name steps aside, out of the helm's turning circle, only
   while the helm turns. Every turn is a full 360 degrees: a partial turn reads as a glitch. --kp-h is the box. */
.kp-brand { --kp-h: 64px; --kp-room: calc(var(--kp-h) * 231 / 660); display: inline-flex; align-items: center; color: var(--logo-ink); text-decoration: none; }
.kp-brand__helm-wrap { display: block; width: var(--kp-h); height: var(--kp-h); flex: none; }
.kp-brand__turn, .kp-brand__word-wrap, .kp-brand__word-move { display: block; }
.kp-brand__helm { display: block; width: 100%; height: 100%; fill: currentColor; }
.kp-brand__word-wrap { margin-left: calc(var(--kp-h) * -219 / 660); }
.kp-brand__word { display: block; height: calc(var(--kp-h) * 236 / 660); width: auto; fill: currentColor; transform: translateY(calc(var(--kp-h) * 36 / 660)); }
.kp-brand:hover .kp-brand__turn { animation: kp-helm-turn var(--duration-turn, 1300ms) 150ms var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)) both; }
.kp-brand:hover .kp-brand__word-move { animation: kp-make-room calc(var(--duration-turn, 1300ms) + 300ms) var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)) both; }
.kp-brand--intro .kp-brand__helm { animation: kp-helm-in 1400ms var(--easing-out, cubic-bezier(0.16, 1, 0.3, 1)) backwards; }
.kp-brand--intro .kp-brand__word { animation: kp-wipe 800ms 1300ms var(--easing-out, cubic-bezier(0.16, 1, 0.3, 1)) backwards; }
@keyframes kp-helm-turn { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes kp-make-room { 0% { transform: translateX(0); } 12%, 82% { transform: translateX(var(--kp-room)); } 100% { transform: translateX(0); } }
@keyframes kp-helm-in { from { transform: rotate(-360deg) scale(.5); opacity: 0; } }
@keyframes kp-wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* A lone helm that turns: full spin then rest (in a tile), or one full turn while it crosses the viewport (a large
   faint helm behind a band). */
.kp-helm-spin { animation: kp-helm-spin 6s 1.5s var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)) infinite; }
@keyframes kp-helm-spin { 0%, 55% { transform: rotate(0); } 100% { transform: rotate(360deg); } }

/* Floating header: fixed, transparent over a dark hero, glass once the page scrolls, shorter, with a hairline that
   fills with reading progress. Put it on the header and give the page top padding for --kp-float-h. */
.kp-float { --kp-float-h: 104px; --kp-float-h-min: 72px; position: fixed; inset: 0 0 auto 0; z-index: 50;
  background: color-mix(in srgb, var(--surface-page) 74%, transparent); -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%);
  border-bottom: var(--border-hairline) solid color-mix(in srgb, var(--text-primary) 10%, transparent); }
.kp-float::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: var(--border-hairline); background: var(--text-primary); opacity: .7; transform-origin: left; transform: scaleX(0); }
.kp-float__bar { display: flex; align-items: center; gap: var(--space-6); height: var(--kp-float-h); }
.kp-float__brand { display: inline-flex; transform-origin: left center; }

/* Kinetic tiles: brand shapes on a 3 by 3 grid that turn by quarters and morph, the helm in the centre. Hero only. */
.kp-tiles { --kp-c: clamp(84px, 8.4vw, 128px); display: grid; grid-template-columns: repeat(3, var(--kp-c)); grid-auto-rows: var(--kp-c); gap: 12px; }
.kp-tile { position: relative; animation: kp-pop 900ms calc(400ms + var(--i, 0) * 80ms) var(--easing-out, cubic-bezier(0.16, 1, 0.3, 1)) backwards; }
.kp-tile__shape { position: absolute; inset: 0; border-radius: var(--radius-md); }
.kp-tile--mark { color: var(--brand-bone); }
.kp-tile--mark svg { position: absolute; inset: -6%; width: 112%; height: 112%; fill: currentColor; }
.kp-shape-bone { background: var(--brand-bone); } .kp-shape-green { background: var(--brand-green); }
.kp-shape-slate { background: var(--brand-slate); } .kp-shape-terra { background: var(--brand-terracotta); }
.kp-shape-quarter { border-radius: 100% 0 0 0; }
.kp-shape-half { top: 50%; border-radius: 0 0 999px 999px; transform-origin: 50% 0; }
.kp-shape-circle { border-radius: 50%; }
.kp-shape-ring { border-radius: 50%; background: none; border: 14px solid var(--brand-bone); border-right-color: transparent; animation: kp-spin 8s linear infinite; }
.kp-turn { animation: kp-turn 9s var(--d, 0s) infinite; }
.kp-turn-r { animation: kp-turn-r 9s var(--d, 0s) infinite; }
.kp-morph { animation: kp-morph 7s var(--d, 0s) infinite; }
.kp-beat { animation: kp-beat 3.6s var(--d, 0s) var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)) infinite; }
@keyframes kp-pop { from { opacity: 0; transform: scale(.4) rotate(-12deg); } }
@keyframes kp-turn { 0%, 16% { transform: rotate(0); animation-timing-function: var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)); } 25%, 41% { transform: rotate(90deg); animation-timing-function: var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)); } 50%, 66% { transform: rotate(180deg); animation-timing-function: var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)); } 75%, 91% { transform: rotate(270deg); animation-timing-function: var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)); } 100% { transform: rotate(360deg); } }
@keyframes kp-turn-r { 0%, 16% { transform: rotate(0); animation-timing-function: var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)); } 25%, 41% { transform: rotate(-90deg); animation-timing-function: var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)); } 50%, 66% { transform: rotate(-180deg); animation-timing-function: var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)); } 75%, 91% { transform: rotate(-270deg); animation-timing-function: var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)); } 100% { transform: rotate(-360deg); } }
@keyframes kp-morph { 0%, 30% { border-radius: var(--radius-md); animation-timing-function: var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)); } 45%, 80% { border-radius: 50%; animation-timing-function: var(--easing-in-out, cubic-bezier(0.7, 0, 0.2, 1)); } 95%, 100% { border-radius: var(--radius-md); } }
@keyframes kp-beat { 0%, 100% { transform: scale(1); } 50% { transform: scale(.62); } }
@keyframes kp-spin { to { transform: rotate(360deg); } }

/* Scroll-linked motion. */
@supports (animation-timeline: scroll()) {
  .kp-float { animation: kp-float-glass linear both; animation-timeline: scroll(root); animation-range: 0 240px; }
  .kp-float__bar { animation: kp-float-shrink linear both; animation-timeline: scroll(root); animation-range: 0 240px; }
  .kp-float__brand { animation: kp-float-brand linear both; animation-timeline: scroll(root); animation-range: 0 240px; }
  .kp-float::after { animation: kp-grow-x linear both; animation-timeline: scroll(root); }
  /* Steer: the helm makes one full turn from the top of the page to the bottom; the name steps aside meanwhile. */
  .kp-brand--steer .kp-brand__helm-wrap { animation: kp-helm-turn linear both; animation-timeline: scroll(root); }
  .kp-brand--steer .kp-brand__word-wrap { animation: kp-room-scroll linear both; animation-timeline: scroll(root); }
  /* Drift: decoration moves slower or faster than the page as it crosses the viewport. Never on text. */
  .kp-drift { animation: kp-drift linear both; animation-timeline: view(); }
  .kp-drift--reverse { animation: kp-drift-reverse linear both; animation-timeline: view(); }
  .kp-helm-drift { animation: kp-helm-drift linear both; animation-timeline: view(); }
}
@keyframes kp-float-glass { from { background: transparent; border-bottom-color: transparent; -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); } }
@keyframes kp-float-shrink { to { height: var(--kp-float-h-min); } }
@keyframes kp-float-brand { to { transform: scale(.72); } }
@keyframes kp-grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes kp-room-scroll { 0%, 100% { transform: translateX(0); } 2.5%, 97.5% { transform: translateX(var(--kp-room)); } }
@keyframes kp-drift { from { transform: translateY(28px); } to { transform: translateY(-28px); } }
@keyframes kp-drift-reverse { from { transform: translateY(-18px); } to { transform: translateY(18px); } }
@keyframes kp-helm-drift { from { transform: translateY(120px) rotate(0); } to { transform: translateY(-120px) rotate(360deg); } }

/* Press feedback for anything clickable. */
.kp-btn:active { transform: scale(.97); }
.kp-btn { transition: background-color var(--duration-fast, 160ms) ease, border-color var(--duration-fast, 160ms) ease, color var(--duration-fast, 160ms) ease, transform 120ms ease; }

@media (prefers-reduced-motion: reduce) {
  .kp-eyebrow--line::before, .kp-runline::before, .kp-runline::after, .kp-rail::after, .kp-runlink::before, .kp-cue::after,
  .kp-brand *, .kp-helm-spin, .kp-float, .kp-float *, .kp-float::after, .kp-tiles *, .kp-drift, .kp-drift--reverse, .kp-helm-drift { animation: none !important; transition: none !important; }
  .kp-runline::before, .kp-runline::after, .kp-rail::after, .kp-cue::after { display: none; }
}
