/* Front door (/start) and the group-page composer. Static page outside app.css, like /fund-finder/.
   Tokens: front door plan section 3 (dark teal join-page palette, on-dark tokens from design review 5A).
   Mobile-first; 44px targets; 16px text floor (design review 6B); focus ring on every control. */

:root {
    --fd-page: #071010;
    --fd-card: #0C1514;
    --fd-kicker: #7ADBD0;
    --fd-body: #B7C7C4;
    --fd-heading: #F2F7F6;
    --fd-composer: #FFFFFF;
    --fd-composer-text: #10201E;
    --fd-primary: #006666;
    --fd-primary-text: #FFFFFF;
    --fd-outline-text: #0B4F4B;
    --fd-chip-bg: #1B2A28;
    --fd-chip-border: #2C3E3B;
    --fd-chip-text: #D5E2DF;
    --fd-footnote: #8FA39F;
    --btn-primary-on-dark-bg: #7ADBD0;
    --btn-primary-on-dark-text: #0C1514;
    --btn-secondary-on-dark-text: #D5E2DF;
    --btn-secondary-on-dark-border: #2F6F69;
    --surface-match: #162321;
    --surface-match-border: #2C3E3B;
    --badge-strong-text: #7ADBD0;
    --badge-strong-border: #2F6F69;
    --badge-good-text: #B7C7C4;
    --badge-good-border: #2C3E3B;
    --note-error: #F3B5B5;
    --note-error-border: #B4535A;
    --note-warn: #F5D58E;
    --note-warn-border: #B98A2E;
    --focus-ring: #F2B84B;
    --radius: 14px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body.fd {
    margin: 0;
    min-height: 100vh;
    background: var(--fd-page);
    color: var(--fd-body);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.fd a { color: var(--fd-kicker); }

.fd :focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Honeypot: off-screen, never focusable. */
.trap {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* ---- Top bar (design review 1A) ---- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 760px;
    margin: 0 auto;
    padding: 8px 16px;
}

.wordmark, .signin {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--fd-heading);
    text-decoration: none;
    font-weight: 700;
}

.wordmark { letter-spacing: 0.12em; font-size: 16px; }
.signin { font-weight: 600; padding: 0 4px; }
.fd .signin { color: var(--fd-chip-text); }

/* ---- Card ---- */
.card {
    max-width: 760px;
    margin: 8px auto 32px;
    padding: 24px 16px;
    background: var(--fd-card);
    border-radius: 0;
}

.card h1 {
    margin: 0 0 8px;
    color: var(--fd-heading);
    font-size: 28px;
    line-height: 1.2;
}

.card h2 {
    margin: 0 0 8px;
    color: var(--fd-heading);
    font-size: 22px;
    line-height: 1.3;
}

.lede { margin: 0 0 20px; }

/* ---- Composer ---- */
.composer {
    position: relative;
    padding: 12px;
    background: var(--fd-composer);
    border-radius: var(--radius);
}

.composer textarea {
    display: block;
    width: 100%;
    min-height: 96px;
    padding: 8px;
    border: 0;
    resize: vertical;
    background: transparent;
    color: var(--fd-composer-text);
    font: inherit;
    font-size: 16px;
}

.composer .row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.composer .note {
    min-height: 0;
    margin: 8px 0 0;
    color: var(--fd-composer-text);
    font-size: 16px;
}

.composer .note:empty { display: none; }

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    color: var(--fd-composer-text);
}

.toggle input { width: 20px; height: 20px; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border: 2px solid transparent;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    width: 100%;
}

.btn[disabled] { cursor: progress; opacity: 0.7; }

.btn.primary { background: var(--fd-primary); color: var(--fd-primary-text); }
.btn.primary:hover:not([disabled]) { background: #005252; }

.btn.ghost { background: transparent; color: var(--fd-outline-text); border-color: var(--fd-primary); }
.btn.ghost:hover:not([disabled]) { background: #E8F3F2; }

/* Actions that sit directly on the dark card (design review 5A). */
.btn.on-dark { background: var(--btn-primary-on-dark-bg); color: var(--btn-primary-on-dark-text); }
.btn.on-dark:hover { background: #9BE6DD; }
.btn.secondary-on-dark { background: transparent; color: var(--btn-secondary-on-dark-text); border-color: var(--btn-secondary-on-dark-border); }
.btn.secondary-on-dark:hover { border-color: var(--fd-kicker); }

.link {
    min-height: 44px;
    padding: 0 4px;
    border: 0;
    background: transparent;
    color: var(--fd-kicker);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.icon { width: 20px; height: 20px; flex: none; }

/* ---- Starter chips ---- */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 0;
}

.chip {
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid var(--fd-chip-border);
    border-radius: 999px;
    background: var(--fd-chip-bg);
    color: var(--fd-chip-text);
    font: inherit;
    font-size: 16px;
    cursor: pointer;
}

.chip:hover { border-color: var(--fd-kicker); }

/* ---- Conversation ---- */
.conversation {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.msg {
    max-width: 92%;
    margin: 0;
    padding: 10px 14px;
    border-radius: 12px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.msg.user { align-self: flex-end; background: var(--fd-chip-bg); color: var(--fd-chip-text); }
.msg.assistant { align-self: flex-start; background: var(--surface-match); color: var(--fd-heading); border: 1px solid var(--surface-match-border); }

/* Working line for the whole turn: the reply, the hidden classification and the preview search can take 15 s or more. */
.msg.status { align-self: flex-start; padding: 4px 0; color: var(--fd-body); font-size: 16px; }
.msg.status::after { content: ''; display: inline-block; width: 1.2em; text-align: left; animation: fd-dots 1.2s steps(4, end) infinite; }

@keyframes fd-dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

@media (prefers-reduced-motion: reduce) {
    .msg.status::after { animation: none; content: '...'; }
}

/* ---- Notes and edge states ---- */
.panel-note {
    margin: 16px 0 0;
    padding: 12px 14px;
    border: 1px solid var(--surface-match-border);
    border-radius: 10px;
    color: var(--fd-chip-text);
}

.panel-note.error { color: var(--note-error); border-color: var(--note-error-border); }
.panel-note.warn { color: var(--note-warn); border-color: var(--note-warn-border); }
.panel-note .btn { margin-top: 12px; }

/* ---- Results ---- */
.results { margin-top: 24px; }

.audience-line { margin: 0 0 8px; }

.audience-picker {
    margin: 8px 0 16px;
    padding: 12px;
    border: 1px solid var(--surface-match-border);
    border-radius: 10px;
}

.audience-picker legend { color: var(--fd-heading); font-weight: 600; padding: 0 4px; }

.audience-picker label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    cursor: pointer;
}

.audience-picker input { width: 20px; height: 20px; }

.matches {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0;
    padding: 0;
    list-style: none;
}

.match {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    background: var(--surface-match);
    border: 1px solid var(--surface-match-border);
    border-radius: 10px;
}

.match strong { color: var(--fd-heading); }

.badge {
    justify-self: start;
    padding: 2px 10px;
    border: 1px solid var(--badge-good-border);
    border-radius: 999px;
    color: var(--badge-good-text);
    font-style: normal;
    font-size: 16px;
}

.badge.strong { color: var(--badge-strong-text); border-color: var(--badge-strong-border); }

.actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ---- Listening waveform ---- */
.wave {
    display: inline-flex;
    align-items: flex-end;
    gap: 3px;
    height: 20px;
}

.wave span {
    width: 4px;
    height: 6px;
    background: var(--fd-primary);
    border-radius: 2px;
    animation: fd-wave 0.9s ease-in-out infinite;
}

.wave span:nth-child(2) { animation-delay: 0.15s; }
.wave span:nth-child(3) { animation-delay: 0.3s; }
.wave span:nth-child(4) { animation-delay: 0.45s; }

@keyframes fd-wave {
    0%, 100% { height: 6px; }
    50% { height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .wave span { animation: none; height: 12px; }
}

/* ---- Footnotes ---- */
.trust { margin: 20px 0 0; color: var(--fd-footnote); font-size: 16px; }
.trust.small { margin-top: 8px; }

/* ---- Group page: the composer inside the join hero ---- */
.fd-embed { max-width: 640px; margin: 20px auto 0; text-align: left; }
.fd-embed .card { margin: 0; padding: 16px; border-radius: var(--radius); }
.fd-embed .direct { margin: 12px 0 0; text-align: center; }

/* ---- Wider screens (standard breakpoints only) ---- */
@media (min-width: 768px) {
    .card { padding: 40px; border-radius: var(--radius); margin-top: 16px; }
    .card h1 { font-size: 36px; }
    .composer .row { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .btn { width: auto; }
    .actions { flex-direction: row; flex-wrap: wrap; }
}

/* Consent banner from /js/consent.js. Its app.css rules are not loaded here (the page stays under 100 KB), so it is
   styled with this page's on-dark tokens. Found unstyled and without a side gutter by /verify-ui, 2026-11-12. */
.cookie-consent {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    padding: 16px;
    background: var(--fd-card);
    color: var(--fd-body);
    border-top: 1px solid var(--fd-chip-border);
}

.cookie-consent-body {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cookie-consent-title { margin: 0; font-size: 18px; color: var(--fd-heading); }
.cookie-consent-text { margin: 0; }
.cookie-consent-actions { display: flex; flex-direction: column; gap: 8px; }
.cookie-consent .btn-primary { background: var(--btn-primary-on-dark-bg); color: var(--btn-primary-on-dark-text); }
.cookie-consent .btn-outline-secondary { background: transparent; color: var(--btn-secondary-on-dark-text); border-color: var(--btn-secondary-on-dark-border); }

@media (min-width: 768px) {
    .cookie-consent-actions { flex-direction: row; justify-content: flex-end; }
    .cookie-consent-actions .btn { width: auto; }
}
