/* A link / public form (KBM-0008). Self-contained: the page may live in an iframe on the customer's site.
   Theme: the form's (light / dark) or the visitor's system (auto). Accent: the organization's colour under the
   white label (set inline as --pf-accent), otherwise Kibo's green. */

/* The palette lives on .pf, not on :root: the app loads this file too (its own forms, a <div class="pf pf-app">)
   and must keep its own theme. Dark rules sit under :where() so the app's .pf-app mapping outranks them. */
.pf {
    --pf-accent: #2d6147;
    --pf-card: #ffffff;
    --pf-ink: #0d1f16;
    --pf-soft: #5b6b62;
    --pf-line: rgba(45, 97, 71, .16);
    --pf-field: #ffffff;
    --pf-error: #b42318;
    --pf-error-soft: #fdecea;
    /* Native controls (the select's list, date pickers, scrollbars) follow the form's theme, framed or not. */
    color-scheme: light;
}
:where(:root[data-theme="dark"]) .pf {
    --pf-card: #17201b;
    --pf-ink: #e8efe9;
    --pf-soft: #9db0a4;
    --pf-line: rgba(143, 191, 160, .18);
    --pf-field: #101814;
    --pf-error: #f97066;
    --pf-error-soft: #3a1714;
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :where(:root[data-theme="auto"]) .pf {
        --pf-card: #17201b;
        --pf-ink: #e8efe9;
        --pf-soft: #9db0a4;
        --pf-line: rgba(143, 191, 160, .18);
        --pf-field: #101814;
        --pf-error: #f97066;
        --pf-error-soft: #3a1714;
        color-scheme: dark;
    }
}
/* The site's page, whose body is the form: the browser canvas and native controls follow the form's theme. */
:root:has(> body.pf) { color-scheme: light; }
:root[data-theme="dark"]:has(> body.pf) { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
    :root[data-theme="auto"]:has(> body.pf) { color-scheme: dark; }
}

.pf, .pf * { box-sizing: border-box; }
body.pf {
    margin: 0; min-height: 100vh; padding: 24px 16px 40px;
    /* No page colour: embedded, the host site shows through; alone, the browser canvas follows color-scheme. */
    background: transparent; color: var(--pf-ink);
    font: 400 15px/1.5 "DM Sans", system-ui, sans-serif;
}
.pf-card {
    max-width: 680px; margin: 0 auto; padding: 28px 28px 24px;
    background: var(--pf-card); border: 1px solid var(--pf-line); border-radius: 16px;
    border-top: 4px solid var(--pf-accent);
}
.pf-head { margin-bottom: 20px; }
/* Framed by the site's contact page (FModel.Bare): the host draws the card and the heading. */
body.pf.pf-bare { min-height: 0; padding: 2px; }
.pf-bare .pf-card { max-width: none; padding: 0; background: transparent; border: 0; border-radius: 0; }
.pf-logo { display: block; max-height: 56px; max-width: 220px; margin-bottom: 14px; object-fit: contain; }
.pf-title { margin: 0 0 6px; font-size: 1.6rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.pf-intro { margin: 0; color: var(--pf-soft); white-space: pre-line; overflow-wrap: anywhere; }
.pf-muted { color: var(--pf-soft); font-size: .875rem; }

.pf-questions { display: flex; flex-direction: column; gap: 18px; }
.pf-q { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pf-q[hidden] { display: none; }
/* The email card sits after the questions block, outside its gap: the same step as between two questions. */
.pf-questions + .pf-q { margin-top: 18px; }
.pf-label { font-weight: 600; overflow-wrap: anywhere; }
.pf-req { color: var(--pf-error); }
.pf-help { margin: -2px 0 2px; color: var(--pf-soft); font-size: .875rem; }
.pf-err { display: none; margin: 0; color: var(--pf-error); font-size: .85rem; }
.pf-q.missing .pf-err { display: block; }
.pf-q.missing .pf-in, .pf-q.refused .pf-in { border-color: var(--pf-error); }
.pf-why { margin: 0; color: var(--pf-error); font-size: .85rem; }
.pf-why:empty { display: none; }

.pf-in {
    width: 100%; min-width: 0; padding: 10px 12px; font: inherit; color: var(--pf-ink);
    background: var(--pf-field); border: 1px solid var(--pf-line); border-radius: 10px;
}
.pf-in:focus { outline: 2px solid var(--pf-accent); outline-offset: 1px; border-color: transparent; }
textarea.pf-in { resize: vertical; }
/* The open list of a select: painted by the browser, white unless told otherwise. */
.pf-in option { background: var(--pf-field); color: var(--pf-ink); }
.pf-short { max-width: 16rem; }
.pf-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pf-row .pf-in { flex: 1 1 10rem; }
.pf-name { display: flex; flex-direction: column; gap: 8px; }
.pf-num .pf-in { flex: 0 1 12rem; }
.pf-affix { color: var(--pf-soft); white-space: nowrap; }
.pf-num-err:empty { display: none; }
.pf-num-err { display: block; }
.pf-choices { display: flex; flex-direction: column; gap: 6px; }
.pf-choice { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.pf-choice input { margin-top: 4px; accent-color: var(--pf-accent); }

.pf-filebox { display: flex; flex-direction: column; gap: 8px; }
.pf-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pf-file {
    display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 6px 6px 10px;
    border: 1px solid var(--pf-line); border-radius: 10px; background: var(--pf-field);
}
.pf-file.busy { color: var(--pf-soft); }
.pf-file-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-x { border: 0; background: none; color: var(--pf-soft); font-size: 1.2rem; line-height: 1; padding: 4px 8px; cursor: pointer; border-radius: 8px; }
.pf-x:hover { color: var(--pf-error); }
.pf-errors p { margin: 0; color: var(--pf-error); font-size: .85rem; }
.pf-pick { position: relative; overflow: hidden; }
.pf-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pf-pick[hidden] { display: none; }

.pf-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px;
    font: 600 .95rem/1.2 inherit; color: var(--pf-ink); background: var(--pf-field);
    border: 1px solid var(--pf-line); border-radius: 10px; cursor: pointer;
}
.pf-btn:focus-visible { outline: 2px solid var(--pf-accent); outline-offset: 2px; }
.pf-send { background: var(--pf-accent); border-color: var(--pf-accent); color: #fff; min-width: 9rem; }
.pf-send:disabled { opacity: .55; cursor: default; }
.pf-foot-row { display: flex; justify-content: flex-end; margin-top: 8px; }

.pf-captcha { margin-top: 20px; min-height: 0; }
.pf-status p { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--pf-error-soft); color: var(--pf-error); }

.pf-thanks { text-align: center; padding: 24px 8px; }
.pf-thanks p { white-space: pre-line; margin: 0 0 16px; font-size: 1.05rem; }
.pf-thanks .pf-ref { font-size: .95rem; }
.pf-thanks .pf-ref strong { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .05em; user-select: all; }

.pf-spin {
    width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto;
    border: 2px solid var(--pf-line); border-top-color: var(--pf-accent); animation: pf-spin .8s linear infinite;
}
@keyframes pf-spin { to { transform: rotate(360deg); } }

.pf-foot { text-align: center; margin-top: 18px; font-size: .8rem; color: var(--pf-soft); }
.pf-foot a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.pf-foot img { height: 16px; }

@media (max-width: 480px) {
    body.pf { padding: 12px 0 24px; }
    .pf-card { border-radius: 0; border-left: 0; border-right: 0; padding: 20px 16px; }
    .pf-send { width: 100%; }
}

/* ── Languages and text blocks (KBM-0022 / KBM-0023) ───────────────────── */
.pf-lang { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.pf-lang-sel { width: auto; padding: 4px 28px 4px 8px; font-size: .85rem; }
.pf-q-text { padding: 2px 0; }
.pf-text { color: var(--pf-ink, inherit); line-height: 1.5; overflow-wrap: anywhere; }
.pf-text p { margin: 0 0 8px; }
.pf-text p:last-child { margin-bottom: 0; }
.pf-text ul, .pf-text ol { margin: 0 0 8px 20px; padding: 0; }
.pf-text a { color: var(--pf-accent); text-decoration: underline; }

/* The questions as text, for readers without script (crawlers, LLM fetchers); form.js replaces them. */
.pf-outline { margin: 0; padding-left: 1.2em; color: var(--pf-muted, inherit); }
.pf-outline > li { margin-bottom: 12px; }
.pf-outline p { margin: 4px 0 0; }
