/* Public Agent page — mirrors gPanel hp-agent-main look */
.ag-body {
    --hp-brand: var(--gs-brand);
    --hp-brand-2: var(--gs-brand);
    --hp-brand-soft: var(--gs-brand-soft, #bfab9f);
    --hp-text: #1e1714;
    --hp-muted: #6d5c52;
    --hp-line: rgba(30, 23, 20, 0.1);
    --hp-line-2: rgba(30, 23, 20, 0.14);
    background: #0c0b0a;
    color: #f2eee9;
}
.ag-page-wrap { min-height: 100vh; }
.ag-stage {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding: 24px var(--ld-gutter, 20px) 40px;
    box-sizing: border-box;
}
.ag-panel.hp-agent-main {
    flex: none;
    width: 100%;
    min-height: min(780px, calc(100vh - 140px));
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    color: var(--hp-text);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    position: relative;
}

/* Head */
.ag-panel .hp-agent-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 16px 4px;
    font-weight: 700;
    flex-shrink: 0;
}
.ag-panel .hp-agent-head-left,
.ag-panel .hp-agent-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ag-panel .hp-agent-head-actions { gap: 4px; }
.ag-panel .hp-agent-head .hp-icon { color: var(--hp-brand-2); }
.ag-panel .hp-agent-head-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
}
.ag-panel .hp-icon-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: inherit;
    display: grid;
    place-items: center;
    text-decoration: none;
    cursor: pointer;
}
.ag-panel .hp-icon-btn:hover { background: rgba(0, 0, 0, 0.06); }
.ag-panel .hp-icon-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Banner */
.ag-panel .hp-agent-upgrade {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 8px 16px 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(139, 110, 93, 0.16);
    color: var(--hp-text);
    font-size: 13px;
    line-height: 1.4;
    flex-shrink: 0;
}
.ag-panel .hp-agent-upgrade[hidden],
.ag-panel .hp-agent-whatsnew[hidden] { display: none !important; }
.ag-panel .hp-agent-upgrade-ico {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    color: var(--hp-brand);
    flex-shrink: 0;
}
.ag-panel .hp-agent-upgrade-copy { margin: 0; flex: 1; min-width: 0; }
.ag-panel .hp-agent-upgrade-link {
    display: inline;
    color: var(--hp-brand);
    font-weight: 700;
    text-decoration: underline;
}
.ag-panel .hp-agent-banner-close {
    width: 24px;
    height: 24px;
    margin: -2px -4px 0 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0.7;
}
.ag-panel .hp-agent-banner-close:hover { opacity: 1; background: rgba(0, 0, 0, 0.06); }

/* Body */
.ag-panel .hp-agent-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    padding: 0 16px;
}
.ag-panel .hp-agent-chatbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0 0;
    flex-shrink: 0;
}
.ag-panel .hp-agent-chatbar[hidden] { display: none !important; }
.ag-panel .hp-agent-newchat {
    height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(191, 171, 159, 0.35);
    border-radius: 999px;
    background: transparent;
    color: var(--hp-brand);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.ag-panel .hp-agent-listen-hint {
    font-size: 11px;
    color: var(--hp-muted);
}
.ag-panel .hp-agent-thread-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 8px 0;
}
.ag-panel .hp-agent-thread-scroll[hidden] { display: none !important; }
.ag-panel .hp-agent-thread {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ag-bubble {
    max-width: 92%;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.4;
}
.ag-bubble strong {
    display: block;
    margin-bottom: 4px;
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.65;
}
.ag-bubble p { margin: 0; }
.ag-bubble--agent {
    align-self: flex-start;
    background: rgba(139, 110, 93, 0.12);
}
.ag-bubble--user {
    align-self: flex-end;
    background: color-mix(in srgb, var(--gs-brand) 22%, #fff);
}
.ag-bubble--system {
    align-self: stretch;
    max-width: 100%;
    text-align: center;
    color: var(--hp-muted);
    background: transparent;
    border: 1px dashed var(--hp-line);
}

.ag-panel .hp-agent-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px 8px 8px;
    min-height: 160px;
}
.ag-panel .hp-agent-hero[hidden] { display: none !important; }
.ag-panel .hp-kodee-lg {
    width: 48px;
    height: 48px;
    color: var(--hp-brand-2);
    margin-bottom: 16px;
    display: grid;
    place-items: center;
}
.ag-panel .hp-kodee-lg .hp-icon { width: 48px; height: 48px; }
.ag-panel .hp-agent-hero h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}
.ag-panel .hp-agent-hero p {
    margin: 8px 0 0;
    color: var(--hp-muted);
    font-size: 15px;
    line-height: 1.35;
}
.ag-panel .hp-agent-brain-tag {
    margin-top: 10px !important;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--hp-line);
    background: color-mix(in srgb, var(--gs-brand) 18%, transparent);
    color: var(--hp-brand) !important;
    font-size: 11px !important;
    font-weight: 600;
}

.ag-panel .hp-agent-footer-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 8px;
    flex-shrink: 0;
}
.ag-panel .hp-agent-footer-stack[hidden] { display: none !important; }
.ag-panel .hp-agent-nudges {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}
.ag-panel .hp-agent-nudges > li + li { border-top: 1px solid var(--hp-line); }
.ag-panel .hp-agent-nudge {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    min-height: 48px;
    padding: 12px 8px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: inherit;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}
.ag-panel .hp-agent-nudge:hover { background: rgba(0, 0, 0, 0.04); }
.ag-panel .hp-agent-nudge-ico {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    color: #fff;
}
.ag-panel .hp-agent-nudge-ico .hp-icon { width: 14px; height: 14px; }
.ag-panel .hp-agent-nudge-ico.red { background: #e11d48; }
.ag-panel .hp-agent-nudge-ico.purple { background: transparent; color: var(--hp-brand); }
.ag-panel .hp-agent-nudge-ico.purple .hp-icon { width: 20px; height: 20px; }
.ag-panel .hp-agent-nudge-ico.blue { background: var(--gs-brand); }
.ag-panel .hp-agent-nudge-label { flex: 1; min-width: 0; line-height: 1.35; }
.ag-panel .hp-agent-nudge-arrow {
    display: grid;
    place-items: center;
    color: var(--hp-muted);
    opacity: 0;
    transition: opacity 0.15s ease;
}
.ag-panel .hp-agent-nudge:hover .hp-agent-nudge-arrow { opacity: 1; }

.ag-panel .hp-agent-whatsnew {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: 12px;
    background: rgba(139, 110, 93, 0.22);
    overflow: hidden;
}
.ag-panel .hp-agent-whatsnew-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    min-height: 46px;
    padding: 10px 36px 10px 12px;
    color: inherit;
    text-decoration: none;
}
.ag-panel .hp-agent-whatsnew-ico { color: var(--hp-brand); flex-shrink: 0; display: grid; place-items: center; }
.ag-panel .hp-agent-whatsnew-copy {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ag-panel .hp-agent-whatsnew-link {
    color: var(--hp-brand);
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    text-decoration: none;
}
.ag-panel .hp-agent-whatsnew .hp-agent-banner-close {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
}

/* Composer */
.ag-panel .hp-agent-composer-wrap {
    padding: 8px 16px 12px;
    flex-shrink: 0;
}
.ag-panel .hp-composer {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1.5px solid var(--hp-line-2);
    border-radius: 24px;
    padding: 8px 12px;
    background: #f5f5f6;
    min-height: 96px;
}
.ag-panel .hp-composer textarea {
    width: 100%;
    border: 0;
    outline: none;
    resize: none;
    font-size: 13px;
    line-height: 1.4;
    color: var(--hp-text);
    background: transparent;
    min-height: 38px;
    max-height: 120px;
    padding: 8px 0;
    font-family: inherit;
}
.ag-panel .hp-composer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.ag-panel .hp-composer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ag-panel .hp-composer-left .hp-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
}
.ag-panel .hp-skills {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 8px;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.06);
    color: var(--hp-text);
    font-size: 12px;
    font-weight: 600;
    cursor: not-allowed;
    opacity: 0.55;
}
.ag-panel .ag-send.hp-mic {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--gs-brand);
    color: var(--gs-ink, #1e1714);
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
}
.ag-panel .ag-send.hp-mic:hover { filter: brightness(1.05); }
.ag-panel .ag-send.hp-mic:disabled { opacity: 0.5; cursor: wait; }
.ag-panel .hp-agent-note {
    margin: 10px 4px 0;
    text-align: center;
    font-size: 11px;
    line-height: 1.35;
    color: var(--hp-muted);
}

.ag-contact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 6px;
}
.ag-contact[hidden] { display: none !important; }
.ag-contact label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    color: var(--hp-muted);
}
.ag-contact input {
    height: 34px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid var(--hp-line-2);
    background: #fff;
    color: var(--hp-text);
    font: inherit;
    font-size: 13px;
}
.ag-flash {
    margin: 8px 16px 0;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 13px;
}
.ag-flash--err {
    background: #fee2e2;
    color: #991b1b;
}
.ag-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}
.ag-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;
}

/* Dark theme (matches gPanel agent) */
html.ld-theme-dark .ag-body,
html.theme-dark .ag-body {
    --hp-text: #f3ebe4;
    --hp-muted: #a7a7a7;
    --hp-line: rgba(191, 171, 159, 0.12);
    --hp-line-2: rgba(255, 255, 255, 0.1);
    --hp-brand-soft: var(--gs-brand-soft, #bfab9f);
}
html.ld-theme-dark .ag-panel.hp-agent-main,
html.theme-dark .ag-panel.hp-agent-main {
    background: #18181a;
    color: var(--hp-brand-soft);
}
html.ld-theme-dark .ag-panel .hp-agent-head,
html.theme-dark .ag-panel .hp-agent-head { color: var(--hp-brand-soft); }
html.ld-theme-dark .ag-panel .hp-icon-btn:hover,
html.theme-dark .ag-panel .hp-icon-btn:hover { background: rgba(243, 235, 228, 0.08); }
html.ld-theme-dark .ag-panel .hp-agent-upgrade,
html.theme-dark .ag-panel .hp-agent-upgrade {
    background: rgba(139, 110, 93, 0.28);
    color: var(--hp-brand-soft);
}
html.ld-theme-dark .ag-panel .hp-agent-upgrade-link,
html.theme-dark .ag-panel .hp-agent-upgrade-link { color: var(--gs-brand-soft); }
html.ld-theme-dark .ag-panel .hp-agent-hero h2,
html.theme-dark .ag-panel .hp-agent-hero h2 { color: var(--hp-brand-soft); }
html.ld-theme-dark .ag-panel .hp-agent-hero p,
html.theme-dark .ag-panel .hp-agent-hero p { color: #a7a7a7; }
html.ld-theme-dark .ag-panel .hp-agent-nudge,
html.theme-dark .ag-panel .hp-agent-nudge { color: var(--hp-brand-soft); }
html.ld-theme-dark .ag-panel .hp-agent-nudge:hover,
html.theme-dark .ag-panel .hp-agent-nudge:hover { background: rgba(243, 235, 228, 0.06); }
html.ld-theme-dark .ag-panel .hp-agent-whatsnew,
html.theme-dark .ag-panel .hp-agent-whatsnew {
    background: rgba(139, 110, 93, 0.28);
    color: var(--hp-brand-soft);
}
html.ld-theme-dark .ag-panel .hp-composer,
html.theme-dark .ag-panel .hp-composer {
    border-color: rgba(255, 255, 255, 0.1);
    background: #222225;
}
html.ld-theme-dark .ag-panel .hp-composer textarea,
html.theme-dark .ag-panel .hp-composer textarea { color: var(--hp-brand-soft); }
html.ld-theme-dark .ag-panel .hp-composer textarea::placeholder,
html.theme-dark .ag-panel .hp-composer textarea::placeholder { color: #9d9ea4; }
html.ld-theme-dark .ag-panel .hp-skills,
html.theme-dark .ag-panel .hp-skills {
    background: rgba(255, 255, 255, 0.1);
    color: var(--gs-brand-soft);
}
html.ld-theme-dark .ag-contact input,
html.theme-dark .ag-contact input {
    background: #18181a;
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--hp-brand-soft);
}
html.ld-theme-dark .ag-bubble--agent,
html.theme-dark .ag-bubble--agent { background: rgba(191, 171, 159, 0.12); }
html.ld-theme-dark .ag-bubble--user,
html.theme-dark .ag-bubble--user {
    background: color-mix(in srgb, var(--gs-brand) 28%, #222225);
}

@media (max-width: 520px) {
    .ag-stage { max-width: none; padding-top: 12px; }
    .ag-panel.hp-agent-main {
        border-radius: 16px 16px 0 0;
        min-height: calc(100vh - 100px);
    }
    .ag-contact { grid-template-columns: 1fr; }
}
