/* Public chat page (app/resources/views/public/page.php; owner, 2026-10-31): Focused welcome (default), Branded
   introduction, Persistent context. Scoped to .pp so the website widget (public/chat.php) and the dashboard never change.
   Colors come from the chatbot (theme.css: --cyc-primary, --cyc-on-primary, --cyc-ink) with the fallbacks below. */
body.is-page { height: 100vh; height: 100dvh; overflow: hidden; background: #fff; }
.pp {
    --pp-accent: var(--cyc-primary, #28666a);
    --pp-on-accent: var(--cyc-on-primary, #ffffff);
    --pp-ink: var(--cyc-ink, #28666a);
    --pp-tint: color-mix(in srgb, var(--pp-accent) 10%, #ffffff);
    --pp-tint-strong: color-mix(in srgb, var(--pp-accent) 18%, #ffffff);
    --pp-surface: #ffffff;
    --pp-subtle: #f5f8f7;
    --pp-text: #20302d;
    --pp-muted: #657570;
    --pp-border: #dfe7e4;
    --pp-warm: #f6c697;
    --pp-col: 820px;
    --pp-pad: 24px;
    display: flex; flex-direction: column; height: 100vh; height: 100dvh;
    background: var(--pp-surface); color: var(--pp-text);
    font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
.pp *, .pp *::before, .pp *::after { box-sizing: border-box; }
.pp :focus-visible { outline: 2px solid var(--pp-ink); outline-offset: 2px; }
.pp button, .pp textarea { font-family: inherit; } /* sizes come from each control's own rule */

/* Header: compact, the chatbot's color, always visible */
.pp-header { flex: none; display: flex; min-height: 64px; padding: 10px max(var(--pp-pad), env(safe-area-inset-right)) 10px max(var(--pp-pad), env(safe-area-inset-left)); padding-top: max(10px, env(safe-area-inset-top)); background: var(--pp-accent); color: var(--pp-on-accent); }
/* The colored bar stays full width; the logo, name and New chat sit in the conversation column (--pp-col, as .pp-thread and .pp-dock-inner). */
.pp-header-inner { flex: 1 1 auto; min-width: 0; width: 100%; max-width: var(--pp-col); margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.pp-header-text { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.pp-header-name { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.01em; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-header-sub { margin: 2px 0 0; font-size: 13px; opacity: .88; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-new { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid color-mix(in srgb, var(--pp-on-accent) 55%, transparent); border-radius: 10px; background: transparent; color: var(--pp-on-accent); font-size: 14px; font-weight: 600; cursor: pointer; }
.pp-new:hover { background: color-mix(in srgb, var(--pp-on-accent) 14%, transparent); }
.pp-header :focus-visible { outline-color: var(--pp-on-accent); }

/* Avatars: the chatbot's image or icon; never a broken image */
.pp-avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--pp-tint); color: var(--pp-ink); overflow: hidden; }
.pp-header .pp-avatar { background: #fff; color: var(--pp-ink); }
.pp-avatar-xs { width: 28px; height: 28px; font-size: 13px; }
.pp-avatar-sm { width: 36px; height: 36px; font-size: 15px; }
.pp-avatar-md { width: 44px; height: 44px; font-size: 18px; }
.pp-avatar-lg { width: 64px; height: 64px; font-size: 26px; margin-bottom: 16px; }
.pp-avatar.has-image { background: #fff; }
.pp-avatar.has-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pp-avatar.has-image.is-square { border-radius: 22%; }
.pp-avatar.has-image.is-rect { width: auto; aspect-ratio: 3 / 1; border-radius: 6px; }
.pp-avatar.has-image.is-rect img { object-fit: contain; padding: 2px; }

.pp-notice { flex: none; padding: 8px var(--pp-pad); background: #fdf4ea; color: #5c3d22; font-size: 13px; line-height: 1.45; border-bottom: 1px solid #f1dcc7; }
.pp-notice i { margin-right: 4px; }

/* Body: optional side panel + main column. Only the conversation area scrolls. */
.pp-body { flex: 1 1 auto; min-height: 0; display: flex; }
.pp-main { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.pp-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }

/* Welcome (empty conversation) and thread (active) */
.pp[data-state="active"] .pp-welcome { display: none; }
.pp[data-state="empty"] .pp-thread { display: none; }
.pp-welcome { margin: auto; width: 100%; max-width: calc(var(--pp-col) + 2 * var(--pp-pad)); padding: 40px var(--pp-pad); text-align: center; display: flex; flex-direction: column; align-items: center; }
.pp-title { margin: 0 0 10px; font-size: 36px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; color: var(--pp-text); overflow-wrap: anywhere; }
.pp-lead { margin: 0 auto; max-width: 640px; color: var(--pp-muted); font-size: 16px; overflow-wrap: anywhere; }
.pp-home { width: 100%; max-width: 680px; margin: 28px auto 0; }
.pp-thread { width: 100%; max-width: calc(var(--pp-col) + 2 * var(--pp-pad)); margin: 0 auto; padding: 28px var(--pp-pad) 8px; }

/* Suggested-question cards */
.pp-cards { width: 100%; max-width: var(--pp-col); margin: 20px auto 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.pp-card { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 14px; border: 1px solid var(--pp-border); border-radius: 12px; background: var(--pp-surface); color: var(--pp-text); text-align: left; font-size: 14px; line-height: 1.4; cursor: pointer; transition: border-color .15s, background-color .15s; }
.pp-card:hover { border-color: color-mix(in srgb, var(--pp-accent) 45%, var(--pp-border)); background: var(--pp-subtle); }
.pp-card-icon { flex: none; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--pp-tint); color: var(--pp-ink); }
.pp-card-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.pp-card-go { flex: none; color: var(--pp-muted); font-size: 12px; }

/* Composer: one form, moved between the welcome and the dock */
.pp-composer { display: flex; align-items: flex-end; gap: 8px; width: 100%; padding: 6px 6px 6px 18px; border: 1px solid var(--pp-border); border-radius: 22px; background: var(--pp-surface); box-shadow: 0 1px 2px rgba(32, 48, 45, .05); }
.pp-composer:focus-within { border-color: color-mix(in srgb, var(--pp-accent) 55%, var(--pp-border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pp-accent) 16%, transparent); }
.pp-composer textarea { flex: 1 1 auto; min-width: 0; min-height: 44px; max-height: 160px; padding: 10px 0; border: 0; outline: 0; resize: none; background: transparent; color: var(--pp-text); font: inherit; font-size: 16px; line-height: 1.5; overflow-y: auto; }
.pp-composer textarea::placeholder { color: var(--pp-muted); }
.pp-composer textarea:focus-visible { outline: 0; }
.pp-send { flex: none; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: var(--pp-accent); color: var(--pp-on-accent); cursor: pointer; }
.pp-send:disabled { opacity: .4; cursor: default; }
.pp-send:not(:disabled):hover { filter: brightness(.93); }

/* Dock: the composer during the conversation, then the footer */
.pp-dock { flex: none; padding: 8px var(--pp-pad) max(10px, env(safe-area-inset-bottom)); background: var(--pp-surface); }
.pp[data-state="active"] .pp-dock { border-top: 1px solid var(--pp-border); padding-top: 12px; }
.pp-dock-inner { max-width: var(--pp-col); margin: 0 auto; }
.pp-dock-inner:empty { display: none; }
.pp-error { max-width: var(--pp-col); margin: 6px auto 0; color: #8a5a33; font-size: 13px; }
.pp-footer { max-width: var(--pp-col); margin: 8px auto 0; color: var(--pp-muted); font-size: 12.5px; line-height: 1.5; text-align: center; }
.pp-footer a { color: inherit; }
.pp-footer:empty { display: none; } /* no note set: take up no space */
.pp-jump { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); z-index: 2; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 1px solid var(--pp-border); border-radius: 999px; background: var(--pp-surface); color: var(--pp-text); font-size: 13px; box-shadow: 0 6px 18px -8px rgba(32, 48, 45, .35); cursor: pointer; }
.pp-jump[hidden] { display: none; }
.pp-noscript { padding: 24px; text-align: center; color: var(--pp-muted); }

/* Messages: user = compact tinted bubble on the right; assistant = readable text with a small avatar */
.pp .chat-row { display: flex; flex-direction: column; align-items: flex-start; margin: 0 0 22px; }
.pp .chat-row-user { align-items: flex-end; }
.pp .chat-bubble { max-width: 100%; overflow-wrap: anywhere; }
.pp .chat-bubble-user { max-width: min(80%, 560px); padding: 10px 14px; border-radius: 18px 18px 4px 18px; background: var(--pp-tint-strong); color: var(--pp-text); white-space: pre-wrap; font-size: 15.5px; line-height: 1.5; }
.pp[data-bubble="square"] .chat-bubble-user { border-radius: 8px 8px 2px 8px; }
.pp .chat-row.pp-marked { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 12px; align-items: start; }
.pp .chat-row.pp-marked > * { grid-column: 2; }
.pp .chat-row.pp-marked > .pp-mark { grid-column: 1; grid-row: 1 / span 3; margin-top: 2px; }
.pp .chat-bubble-bot { padding: 2px 0 0; background: transparent; border: 0; box-shadow: none; color: var(--pp-text); }
.pp .chat-bubble-error .chat-text { color: #8a5a33; }
.pp .chat-text p { margin: 0 0 12px; }
.pp .chat-text > :last-child { margin-bottom: 0; }
.pp .chat-text ul, .pp .chat-text ol { margin: 0 0 12px; padding-left: 1.4rem; }
.pp .chat-text li + li { margin-top: 4px; }
.pp .chat-text .chat-heading { margin: 16px 0 6px; font-weight: 700; }
.pp .chat-text .chat-heading:first-child { margin-top: 0; }
.pp .chat-text a { color: var(--pp-ink); }
.pp .chat-text pre, .pp .chat-text table { display: block; max-width: 100%; overflow-x: auto; }
.pp .chat-text pre { padding: 12px 14px; border-radius: 10px; background: var(--pp-subtle); border: 1px solid var(--pp-border); font-size: 14px; }
.pp .chat-text code { font-size: .92em; color: var(--pp-text); background: var(--pp-subtle); padding: .1em .35em; border-radius: 4px; }
.pp .chat-text pre code { padding: 0; background: transparent; }
.pp .chat-text table { border-collapse: collapse; font-size: 14px; }
.pp .chat-text th, .pp .chat-text td { padding: 6px 10px; border: 1px solid var(--pp-border); }
.pp .chat-sources { margin-top: 10px !important; padding-top: 8px !important; border-top: 1px solid var(--pp-border) !important; font-size: 13px; color: var(--pp-muted); }
.pp .chat-sources a { color: var(--pp-ink); }
.pp .pc-feedback { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; color: var(--pp-muted); }
.pp .pp-typing .chat-bubble-bot { color: var(--pp-ink); padding-top: 6px; }
.pp-row-error { margin-top: 6px; max-width: min(80%, 560px); color: #8a5a33; font-size: 13px; text-align: right; }
.pp-retry { margin-left: 6px; min-height: 32px; padding: 0 10px; border: 1px solid #ecd5c0; border-radius: 999px; background: #fff; color: #6f4a2b; font-size: 13px; cursor: pointer; }
.pp-retry:hover { background: #fbf3ec; }

/* Option 2: Branded introduction. The wider column is the layout's one source of truth: the header, hero, starter
   cards, composer, conversation and footer all derive their width from --pp-col, so every edge lines up. */
.pp[data-layout="branded"] { --pp-col: 1032px; }
.pp-welcome-branded { text-align: left; align-items: stretch; }
.pp-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; align-items: center; padding: 40px; border-radius: 16px; background: var(--pp-tint); overflow: hidden; }
.pp-hero::after { content: ''; position: absolute; right: -80px; bottom: -120px; width: 320px; height: 320px; border-radius: 50%; background: color-mix(in srgb, var(--pp-accent) 8%, transparent); pointer-events: none; }
.pp-hero.has-hero-image { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); }
.pp-hero-text { position: relative; z-index: 1; }
.pp-welcome-branded .pp-title { font-size: 40px; color: var(--pp-ink); }
.pp-hero-rule { display: block; width: 48px; height: 4px; margin: 16px 0 14px; border-radius: 4px; background: var(--pp-warm); }
.pp-welcome-branded .pp-lead { margin: 0; max-width: 560px; }
.pp-hero-img { position: relative; z-index: 1; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; }
.pp-welcome-branded .pp-cards { max-width: none; margin-top: 16px; }
.pp-welcome-branded .pp-home { max-width: none; margin-top: 16px; }


/* Phones and tablets */
@media (max-width: 991.98px) {
    .pp-hero.has-hero-image { grid-template-columns: minmax(0, 1fr); }
    .pp-hero-img { max-height: 280px; }
}
@media (max-width: 575.98px) {
    .pp { --pp-pad: 16px; }
    .pp-title { font-size: 28px; }
    .pp-welcome-branded .pp-title { font-size: 30px; }
    .pp-welcome { padding-top: 28px; padding-bottom: 28px; }
    .pp-hero { padding: 24px 20px; }
    .pp-cards { grid-template-columns: minmax(0, 1fr); }
    .pp-new { min-height: 40px; padding: 0 12px; }
    .pp .chat-bubble-user { max-width: 88%; }
}
@media (prefers-reduced-motion: reduce) {
    .pp *, .pp *::before, .pp *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* The owner's iPhone preview (test mode, body.is-phone): a decorative status bar and room for the home indicator. */
.pp-statusbar { display: none; }
@media (min-width: 0) {
    .is-phone .pp-statusbar { flex: none; display: flex; align-items: center; justify-content: space-between; height: 46px; padding: 10px 26px 0 30px; background: var(--pp-accent); color: var(--pp-on-accent); font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
    .is-phone .pp-statusbar-icons { display: inline-flex; gap: 5px; font-size: 11px; }
    .is-phone .pp-header { padding-top: 6px; min-height: 56px; }
    .is-phone .pp-dock { padding-bottom: 26px; }
}

/* The welcome text is the Welcome message (Markdown): paragraphs and lists inside the lead. */
.pp-lead p { margin: 0 0 8px; }
.pp-lead > :last-child { margin-bottom: 0; }
.pp-lead ul, .pp-lead ol { display: inline-block; margin: 0 0 8px; padding-left: 1.2rem; text-align: left; }
.pp-lead a { color: var(--pp-ink); }
/* An action offered at the start (Collect Leads) shows below the welcome before the first question. */
.pp.has-action[data-state="empty"] .pp-thread { display: block; padding-top: 0; }
.pp .act-card { width: min(100%, 34rem); }
