/* knowhash candidate form. Colours follow the knowhash site: navy ink, teal accent. */
.khf {
  --khf-ink: #22355C;
  --khf-ink-soft: #3D4F6E;
  --khf-muted: #4A5A75;
  --khf-accent: #0D5C63;
  --khf-accent-tint: #EAF3F3;
  --khf-line: #D3DAE4;
  --khf-surface: #FFFFFF;
  --khf-page: #F5F7FA;
  font-family: var(--khf-font, inherit);
  color: var(--khf-ink);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
@media (prefers-color-scheme: dark) {
  .khf.khf-dark-ok {
    --khf-ink: #E6ECF5;
    --khf-ink-soft: #C2CCDB;
    --khf-muted: #A3B0C4;
    --khf-accent: #4FB3BB;
    --khf-accent-tint: #173B40;
    --khf-line: #3A4A63;
    --khf-surface: #18233A;
    --khf-page: #101827;
  }
}

.khf *, .khf *::before, .khf *::after { box-sizing: border-box; }

/* Header */
.khf-head { background: var(--khf-accent); color: #FFFFFF; padding: 18px; border-radius: 14px 14px 0 0; }
@media (prefers-color-scheme: dark) { .khf-dark-ok .khf-head { color: #0E1A2B; } }
.khf-company { font-size: 13px; font-weight: 700; opacity: 0.85; }
.khf-title { margin: 2px 0 0; font-family: Comfortaa, "Nunito Sans", sans-serif; font-weight: 700; font-size: 20px; line-height: 1.3; }

/* Questions */
.khf-body { background: var(--khf-surface); border: 1px solid var(--khf-line); border-top: none; border-radius: 0 0 14px 14px; padding: 20px 18px; display: flex; flex-direction: column; gap: 26px; }
.khf-q { border: none; margin: 0; padding: 0; min-width: 0; }
.khf-q-text { padding: 0; margin-bottom: 12px; font-weight: 700; font-size: 17px; line-height: 1.4; }
.khf-q-num { color: var(--khf-accent); }
.khf-hint { margin: -6px 0 12px; font-size: 14px; color: var(--khf-muted); }
.khf-section { margin: 0 0 -10px; font-family: Comfortaa, sans-serif; font-size: 15px; font-weight: 700; color: var(--khf-accent); }
.khf-section ~ .khf-section { margin-top: 6px; padding-top: 18px; border-top: 1px solid var(--khf-line); }
.khf-section-label { margin-bottom: 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--khf-accent); }

.khf-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.khf-choice { position: relative; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 12px 14px; border: 1.5px solid var(--khf-line); border-radius: 12px; background: var(--khf-surface); cursor: pointer; font-size: 16px; transition: border-color 120ms, background-color 120ms, transform 120ms; }
.khf-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.khf-mark { flex: 0 0 auto; width: 20px; height: 20px; border: 2px solid var(--khf-accent); border-radius: 50%; display: grid; place-items: center; }
.khf-choice input[type="checkbox"] + .khf-mark { border-radius: 5px; }
.khf-choice input:checked + .khf-mark { background: var(--khf-accent); box-shadow: inset 0 0 0 3px var(--khf-surface); }
.khf-choice input[type="checkbox"]:checked + .khf-mark { box-shadow: none; background: var(--khf-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 14px no-repeat; }
.khf-choice:has(input:checked) { border-color: var(--khf-accent); background: var(--khf-accent-tint); }
.khf-choice:active { transform: scale(0.98); }
.khf-choice:has(input:focus-visible) { outline: 3px solid var(--khf-accent); outline-offset: 2px; }

.khf-text { width: 100%; font: inherit; font-size: 16px; color: var(--khf-ink); background: var(--khf-surface); border: 1.5px solid var(--khf-line); border-radius: 12px; padding: 12px 14px; }
.khf-text:focus { outline: none; border-color: var(--khf-accent); box-shadow: 0 0 0 3px var(--khf-accent-tint); }
textarea.khf-text { resize: vertical; min-height: 120px; }

/* Buttons */
.khf-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.khf-btn { min-height: 50px; padding: 0 24px; border: none; border-radius: 12px; background: var(--khf-ink); color: var(--khf-surface); font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; }
.khf-btn:focus-visible { outline: 3px solid var(--khf-accent); outline-offset: 2px; }
.khf-btn:disabled { opacity: 0.6; cursor: default; }
.khf-test .khf-finish { background: var(--khf-accent); }
.khf-error { margin: 0; color: #B3261E; font-size: 14px; }
.khf-error:empty { display: none; }
.khf-powered { margin: 0; font-size: 12px; color: var(--khf-muted); }

/* Result card (test drive) */
.khf-result { margin-top: 18px; border: 2px solid var(--khf-accent); border-radius: 14px; background: var(--khf-surface); overflow: hidden; }
.khf-result-head { padding: 12px 16px; background: var(--khf-accent-tint); font-weight: 700; color: var(--khf-accent); }
.khf-result-list { margin: 0; padding: 14px 16px; display: grid; gap: 4px; }
.khf-result-list dt { font-weight: 700; font-size: 14px; color: var(--khf-ink-soft); margin-top: 8px; }
.khf-result-list dd { margin: 0; font-size: 16px; }
.khf-result-list dd.khf-blank { color: var(--khf-muted); font-style: italic; }
.khf-result-slot:empty { display: none; }
.khf-result-slot { padding: 0 16px 16px; }

/* Phone: one question per screen */
.khf-phone { min-height: 100dvh; display: flex; flex-direction: column; background: var(--khf-page); padding-bottom: env(safe-area-inset-bottom, 0px); }
.khf-phone .khf-head { border-radius: 0; }
.khf-progress { height: 4px; background: var(--khf-line); }
.khf-progress span { display: block; height: 100%; background: var(--khf-accent); transition: width 240ms ease; }
.khf-count { padding: 14px 18px 0; font-size: 14px; font-weight: 700; color: var(--khf-muted); }
.khf-card { flex: 1 1 auto; padding: 18px; animation: khf-in 220ms ease both; }
.khf-phone .khf-q-text { font-size: 20px; margin-bottom: 16px; }
.khf-phone .khf-choices { grid-template-columns: 1fr; }
.khf-phone .khf-choice { min-height: 58px; font-size: 17px; }
.khf-bar { position: sticky; bottom: 0; padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--khf-page); border-top: 1px solid var(--khf-line); }
.khf-bar .khf-btn { width: 100%; }
.khf-phone .khf-powered { padding: 0 18px 12px; }
.khf-phone .khf-result { margin: 18px; }

@keyframes khf-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

.khf-done { padding: 28px 18px; }
.khf-done p { color: var(--khf-ink-soft); }

@media (prefers-reduced-motion: reduce) {
  .khf-card { animation: none; }
  .khf-progress span, .khf-choice { transition: none; }
}
