/* ---------------------------------------------------------------------------------------------
   The organisation's help assistant (/help/{org}), shown to homeowners on its own or framed by the
   website widget (?embed=1). Customer-facing, so it shares the quotation's light palette rather than
   the staff app's dark one, and declares every token locally (.hc-shell) so nothing leaks in.
   --------------------------------------------------------------------------------------------- */

.hc-shell {
    --hc-ink: #1a1d21;
    --hc-ink-soft: #5b6470;
    --hc-ink-faint: #8a939e;
    --hc-line: #e1e5ea;
    --hc-paper: #ffffff;
    --hc-ground: #f4f6f8;
    --hc-accent: #14532d;
    --hc-accent-ink: #ffffff;
    --hc-accent-soft: #e8f1ec;
    --hc-bot: #f1f4f7;
    --hc-team: #eef3fb;
    --hc-team-line: #d4e0f3;
    --hc-team-ink: #1e3a8a;
    --hc-warn: #9a3412;
    --hc-warn-soft: #fff1e6;
    --hc-danger: #991b1b;
    --hc-danger-soft: #fdecec;
    --hc-radius: 18px;

    min-height: 100vh;
    background: var(--hc-ground);
    color: var(--hc-ink);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    padding: 20px 16px 32px;
    box-sizing: border-box;
}
.hc-shell *, .hc-shell *::before, .hc-shell *::after { box-sizing: border-box; }

/* ---- Page header (full page only) ---- */
.hc-site-head {
    max-width: 1120px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.hc-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hc-logo { max-height: 44px; max-width: 180px; object-fit: contain; }
.hc-company { font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.hc-tagline { font-size: 13px; color: var(--hc-ink-soft); }
.hc-site-contact { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; }
.hc-site-contact a, .hc-ways a { color: var(--hc-ink-soft); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.hc-site-contact a:hover, .hc-ways a:hover { color: var(--hc-accent); text-decoration: underline; }

/* ---- Layout ---- */
.hc-layout {
    max-width: 1120px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: start;
}

.hc-chat {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 128px);
    min-height: 540px;
    background: var(--hc-paper);
    border: 1px solid var(--hc-line);
    border-radius: var(--hc-radius);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 28px rgba(15, 23, 42, .06);
}

/* ---- Chat header ---- */
.hc-chat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--hc-line);
    background: var(--hc-paper);
    flex: none;
}
.hc-head-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.hc-head-text b { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-head-text small { font-size: 12.5px; color: var(--hc-ink-soft); display: flex; align-items: center; gap: 6px; min-width: 0; }
.hc-status { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; flex: none; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.hc-dot.is-live { background: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.hc-head-actions { display: flex; gap: 4px; }

.hc-icon-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--hc-ink-soft);
    cursor: pointer;
    font-size: 16px;
    flex: none;
}
.hc-icon-btn:hover { background: var(--hc-ground); color: var(--hc-ink); }
.hc-icon-btn:focus-visible, .hc-choice:focus-visible, .hc-send:focus-visible, .hc-photo-drop:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.hc-icon-btn:disabled { opacity: .45; cursor: default; }

.hc-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--hc-accent);
    color: var(--hc-accent-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .02em;
    flex: none;
}
.hc-avatar.is-small { width: 28px; height: 28px; font-size: 11px; }
.hc-avatar.is-person { width: 28px; height: 28px; font-size: 12px; background: var(--hc-team-ink); }
.hc-avatar.is-ghost { background: var(--hc-line); }

/* ---- Conversation ---- */
.hc-log {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overscroll-behavior: contain;
    scroll-padding-bottom: 12px;
}

.hc-row { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; animation: hc-in .22s ease-out; }
.hc-row.is-grouped { margin-top: -6px; }
.hc-row.is-grouped > .hc-avatar { visibility: hidden; }
.hc-row.is-customer { justify-content: flex-end; }

.hc-bubble {
    max-width: min(78%, 520px);
    padding: 10px 14px;
    border-radius: 16px;
    background: var(--hc-bot);
    white-space: pre-line;
    overflow-wrap: anywhere;
}
.is-assistant .hc-bubble { border-bottom-left-radius: 6px; }
.is-customer .hc-bubble { background: var(--hc-accent); color: var(--hc-accent-ink); border-bottom-right-radius: 6px; }
.hc-team { display: flex; flex-direction: column; gap: 3px; max-width: min(78%, 520px); }
.hc-team .hc-bubble { max-width: 100%; background: var(--hc-team); border: 1px solid var(--hc-team-line); border-bottom-left-radius: 6px; }
.hc-name { font-size: 12px; font-weight: 600; color: var(--hc-team-ink); padding-left: 4px; }
.hc-name span { font-weight: 400; color: var(--hc-ink-faint); margin-left: 4px; }

.hc-steps { margin: 8px 0 2px; padding-left: 20px; display: grid; gap: 6px; }
.hc-steps li { padding-left: 2px; }

.hc-notice { display: flex; align-items: center; gap: 10px; color: var(--hc-ink-faint); font-size: 12px; margin: 4px 0; }
.hc-notice::before, .hc-notice::after { content: ""; flex: 1; height: 1px; background: var(--hc-line); }
.hc-notice span { white-space: nowrap; }

.hc-typing { display: inline-flex; align-items: center; gap: 4px; padding: 13px 16px; }
.hc-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--hc-ink-faint); animation: hc-blink 1.2s infinite ease-in-out; }
.hc-typing i:nth-child(2) { animation-delay: .15s; }
.hc-typing i:nth-child(3) { animation-delay: .3s; }

/* ---- Case card ---- */
.hc-card {
    width: min(78%, 420px);
    border: 1px solid var(--hc-line);
    border-radius: 14px;
    padding: 14px 16px;
    background: var(--hc-paper);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
.hc-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hc-card-ref { font-weight: 700; font-size: 17px; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.hc-card-subject { margin-top: 4px; color: var(--hc-ink-soft); font-size: 14px; }
.hc-card-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--hc-line); }
.hc-card-facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--hc-ink-faint); }
.hc-card-facts dd { margin: 2px 0 0; font-size: 13.5px; font-weight: 550; }

.hc-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--hc-ground);
    color: var(--hc-ink-soft);
    white-space: nowrap;
}
.hc-pill.is-open { background: var(--hc-accent-soft); color: var(--hc-accent); }
.hc-pill.is-done { background: #e7f6ec; color: #166534; }
.hc-pill.is-waiting, .hc-pill.is-high { background: var(--hc-warn-soft); color: var(--hc-warn); }
.hc-pill.is-urgent { background: var(--hc-danger-soft); color: var(--hc-danger); }

/* ---- Quick replies ---- */
.hc-choices { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 4px 0 0 36px; animation: hc-in .22s ease-out; }
.hc-choices.is-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.hc-choice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 14px;
    border: 1.5px solid var(--hc-accent);
    border-radius: 12px;
    background: var(--hc-paper);
    color: var(--hc-accent);
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
}
.hc-choice i { width: 16px; text-align: center; opacity: .85; flex: none; }
.hc-choice:hover { background: var(--hc-accent); color: var(--hc-accent-ink); }

.hc-photo-drop {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: 36px;
    padding: 16px;
    border: 1.5px dashed var(--hc-accent);
    border-radius: 14px;
    background: var(--hc-accent-soft);
    color: var(--hc-accent);
    cursor: pointer;
}
.hc-photo-drop i { font-size: 22px; }
.hc-photo-drop span { display: flex; flex-direction: column; }
.hc-photo-drop small { color: var(--hc-ink-soft); font-size: 12.5px; }

/* ---- Composer ---- */
.hc-composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--hc-line);
    background: var(--hc-paper);
    flex: none;
}
.hc-input {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    max-height: 132px;
    resize: none;
    overflow-y: hidden;
    padding: 10px 14px;
    border: 1px solid var(--hc-line);
    border-radius: 12px;
    background: var(--hc-ground);
    color: var(--hc-ink);
    font: inherit;
    line-height: 1.4;
}
.hc-input:focus { outline: none; border-color: var(--hc-accent); background: var(--hc-paper); box-shadow: 0 0 0 3px rgba(20, 83, 45, .12); }
.hc-input:disabled { opacity: .6; }
.hc-input::placeholder { color: var(--hc-ink-faint); }
.hc-send {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: var(--hc-accent);
    color: var(--hc-accent-ink);
    font-size: 16px;
    cursor: pointer;
    flex: none;
}
.hc-send:disabled { background: var(--hc-line); color: var(--hc-ink-faint); cursor: default; }
.hc-attach.is-busy { color: var(--hc-accent); }
.hc-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.hc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hc-privacy { padding: 0 16px 10px; font-size: 11.5px; color: var(--hc-ink-faint); background: var(--hc-paper); flex: none; }

/* ---- Side panels (full page only) ---- */
.hc-aside { display: flex; flex-direction: column; gap: 14px; }
.hc-panel { background: var(--hc-paper); border: 1px solid var(--hc-line); border-radius: 14px; padding: 18px; }
.hc-panel h2 { font-size: 14px; font-weight: 650; margin: 0 0 12px; letter-spacing: -0.005em; }
.hc-how { margin: 0; padding: 0; list-style: none; counter-reset: hc-step; display: grid; gap: 12px; }
.hc-how li { counter-increment: hc-step; display: grid; grid-template-columns: 26px 1fr; column-gap: 10px; }
.hc-how li::before { content: counter(hc-step); grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; background: var(--hc-accent-soft); color: var(--hc-accent); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.hc-how b { font-size: 14px; }
.hc-how span { font-size: 13px; color: var(--hc-ink-soft); }
.hc-targets { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; font-size: 13px; color: var(--hc-ink-soft); }
.hc-targets li { display: grid; grid-template-columns: 70px 1fr; column-gap: 8px; align-items: center; }
.hc-targets b { grid-column: 2; color: var(--hc-ink); font-weight: 600; }
.hc-targets .hc-pill { grid-row: span 2; justify-self: start; }
.hc-ways { display: grid; gap: 10px; font-size: 14px; }

.hc-missing { max-width: 520px; margin: 12vh auto 0; text-align: center; background: var(--hc-paper); border: 1px solid var(--hc-line); border-radius: 14px; padding: 40px 24px; }
.hc-missing h1 { font-size: 22px; margin: 0 0 8px; }
.hc-missing p { color: var(--hc-ink-soft); margin: 0; }

/* ---- Framed by the website widget: the chat is the whole frame ---- */
.hc-shell.is-embedded { padding: 0; background: var(--hc-paper); }
.hc-shell.is-embedded .hc-layout { display: block; max-width: none; }
.hc-shell.is-embedded .hc-chat { height: 100vh; min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
.hc-shell.is-embedded .hc-bubble, .hc-shell.is-embedded .hc-team { max-width: 84%; }
.hc-shell.is-embedded .hc-card { width: 86%; }
.hc-shell.is-embedded .hc-choices.is-grid { grid-template-columns: 1fr; }

@media (max-width: 900px) {
    .hc-layout { grid-template-columns: 1fr; }
    .hc-aside { display: none; }
}

@media (max-width: 600px) {
    /* The page is the chat: header on top, conversation filling exactly the rest of the screen. */
    .hc-shell { padding: 0; height: 100dvh; min-height: 0; display: flex; flex-direction: column; }
    .hc-site-head { margin: 0; padding: 12px 16px; background: var(--hc-paper); border-bottom: 1px solid var(--hc-line); flex: none; }
    .hc-site-contact { display: none; }
    .hc-layout { display: block; flex: 1; min-height: 0; width: 100%; }
    .hc-chat { height: 100%; min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
    .hc-bubble, .hc-team { max-width: 86%; }
    .hc-card { width: 88%; }
    .hc-choices { padding-left: 0; }
    .hc-choices.is-grid { grid-template-columns: 1fr; }
    .hc-photo-drop { margin-left: 0; }
}

@keyframes hc-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes hc-blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

@media (prefers-reduced-motion: reduce) {
    .hc-row, .hc-choices { animation: none; }
    .hc-typing i { animation: none; opacity: .6; }
}

/* ---------------------------------------------------------------------------------------------
   /help/{org}/demo: a stand-in for the organisation's own website, carrying the real widget.
   --------------------------------------------------------------------------------------------- */
.hd-site {
    --hd-ink: #1b2430;
    --hd-soft: #5d6876;
    --hd-line: #e3e8ee;
    --hd-accent: #14532d;
    min-height: 100vh;
    background: #fbfaf7;
    color: var(--hd-ink);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
.hd-loading { padding: 40px; color: var(--hd-soft); }
.hd-ribbon { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 24px; background: #fff7e0; border-bottom: 1px solid #f1e2b3; color: #6b4e00; font-size: 13.5px; }
.hd-ribbon a { margin-left: auto; color: #6b4e00; font-weight: 600; }
.hd-head { display: flex; align-items: center; gap: 28px; padding: 18px 40px; background: #fff; border-bottom: 1px solid var(--hd-line); }
.hd-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.hd-brand img { max-height: 40px; max-width: 160px; object-fit: contain; }
.hd-mark { width: 36px; height: 36px; border-radius: 9px; background: var(--hd-accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.hd-nav { display: flex; gap: 22px; font-size: 14.5px; color: var(--hd-soft); }
.hd-phone { margin-left: auto; font-weight: 600; font-size: 14.5px; display: inline-flex; gap: 8px; align-items: center; }
.hd-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 40px; align-items: center; max-width: 1160px; margin: 0 auto; padding: 64px 40px 48px; }
.hd-kicker { display: inline-block; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--hd-accent); margin-bottom: 14px; }
.hd-hero h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 16px; text-wrap: balance; }
.hd-hero p { font-size: 18px; color: var(--hd-soft); margin: 0 0 26px; max-width: 46ch; }
.hd-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hd-btn { display: inline-flex; align-items: center; height: 48px; padding: 0 22px; border-radius: 10px; border: 1.5px solid var(--hd-ink); font-weight: 600; }
.hd-btn.is-primary { background: var(--hd-accent); border-color: var(--hd-accent); color: #fff; }
.hd-hero-art { background: linear-gradient(160deg, #eef3f0, #f6efe3); border-radius: 24px; padding: 36px; display: flex; justify-content: center; }
.hd-hero-art svg { width: 100%; max-width: 320px; height: auto; }
.hd-features { max-width: 1160px; margin: 0 auto; padding: 8px 40px 72px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.hd-features div { background: #fff; border: 1px solid var(--hd-line); border-radius: 16px; padding: 22px; display: grid; gap: 6px; }
.hd-features i { color: var(--hd-accent); font-size: 20px; margin-bottom: 6px; }
.hd-features span { color: var(--hd-soft); font-size: 14.5px; }
.hd-foot { border-top: 1px solid var(--hd-line); padding: 22px 40px; color: var(--hd-soft); font-size: 13px; }

@media (max-width: 860px) {
    .hd-nav { display: none; }
    .hd-head { padding: 14px 16px; }
    .hd-hero { grid-template-columns: 1fr; padding: 36px 16px; }
    .hd-hero-art { display: none; }
    .hd-features { grid-template-columns: 1fr; padding: 0 16px 96px; }
    .hd-ribbon { padding: 10px 16px; }
    .hd-ribbon a { margin-left: 0; }
}
html:has(.hd-site), html:has(.hd-site) body { background: #fbfaf7; }

/* The staff app paints a dark ground on html/body; this page must not sit on it. */
html:has(.hc-shell), html:has(.hc-shell) body { background: #f4f6f8; }
html:has(.hc-shell.is-embedded), html:has(.hc-shell.is-embedded) body { background: #ffffff; }
