#pg-chatbot-launcher, #pg-chatbot-panel, #pg-chatbot-panel * {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

#pg-chatbot-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    height: 52px;
    width: auto;
    padding: 0 20px 0 16px;
    border-radius: 999px;
    background: #cd402c;
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(205, 64, 44, 0.4);
    z-index: 999998;
    transition: transform 0.2s;
    white-space: nowrap;
}
#pg-chatbot-launcher:hover { transform: scale(1.04); }
.pg-launcher-label {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.1px;
}

@media (max-width: 480px) {
    #pg-chatbot-launcher {
        height: 48px;
        padding: 0 16px 0 14px;
    }
    .pg-launcher-label { font-size: 13px; }
}

#pg-chatbot-panel {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 140px); /* fallback for browsers without dvh support */
    max-height: calc(100dvh - 140px); /* dvh accounts for Safari's collapsing address bar — prevents the jump/overflow that 100vh causes as the toolbar shows/hides */
    background: #1a2332;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border: 1px solid #2d3748;
    display: none;
    flex-direction: column;
    z-index: 999999;
}
#pg-chatbot-panel.pg-open { display: flex; }

.pg-chatbot-header {
    background: #151b27;
    padding: 16px 18px;
    border-bottom: 1px solid #2d3748;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}
.pg-chatbot-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.2);
    flex-shrink: 0;
}
.pg-chatbot-header .pg-chatbot-title { color: #fff; font-size: 15px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 6px; }
.pg-bot-name-link { color: #fff; text-decoration: none; border-bottom: 1px dotted rgba(255,255,255,0.4); }
.pg-bot-name-link:hover { border-bottom-color: #cd402c; }
.pg-ai-tag {
    font-size: 9px; font-weight: 800; letter-spacing: 0.5px; color: #cd402c;
    background: rgba(205,64,44,0.15); border: 1px solid rgba(205,64,44,0.4);
    border-radius: 4px; padding: 2px 5px; text-transform: uppercase;
}
.pg-chatbot-header p { color: #9ca3af; font-size: 11px; margin: 0; }
#pg-chatbot-close {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: #9ca3af; font-size: 22px; cursor: pointer; line-height: 1;
}

.pg-chatbot-disclaimer {
    background: rgba(205,64,44,0.1);
    border-bottom: 1px solid rgba(205,64,44,0.25);
    color: #f0a99c;
    font-size: 11px;
    padding: 8px 18px;
    line-height: 1.5;
}

.pg-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pg-msg { max-width: 85%; padding: 11px 13px; border-radius: 12px; font-size: 13.5px; line-height: 1.55; }
.pg-msg.pg-bot { background: rgba(255,255,255,0.04); border: 1px solid #2d3748; color: #e5e7eb; align-self: flex-start; border-bottom-left-radius: 3px; }
.pg-msg.pg-user { background: #cd402c; color: #fff; align-self: flex-end; border-bottom-right-radius: 3px; }
.pg-msg .pg-cause-title { font-weight: 700; color: #fff; margin-bottom: 6px; font-size: 13.5px; }
.pg-msg a { color: #38bdf8; }
.pg-msg .pg-caveat { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #2d3748; font-size: 11.5px; color: #f0a99c; font-style: italic; }
.pg-msg .pg-safety { margin-top: 8px; padding: 8px 10px; background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3); border-radius: 8px; font-size: 12px; color: #fcd34d; }
.pg-msg .pg-cta {
    display: inline-block; margin-top: 10px; background: #cd402c; color: #fff; text-decoration: none;
    font-size: 12px; font-weight: 700; padding: 8px 14px; border-radius: 6px; text-transform: uppercase; letter-spacing: 0.3px;
}
.pg-msg .pg-cta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pg-msg .pg-cta-row .pg-cta { margin-top: 0; }

.pg-typing { align-self: flex-start; display: flex; gap: 4px; padding: 11px 13px; }
.pg-typing span { width: 6px; height: 6px; border-radius: 50%; background: #9ca3af; animation: pgBounce 1.2s infinite ease-in-out; }
.pg-typing span:nth-child(2) { animation-delay: 0.15s; }
.pg-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pgBounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }

.pg-chatbot-chips { display: flex; gap: 8px; padding: 0 16px 12px; flex-wrap: wrap; }
.pg-chip {
    background: rgba(255,255,255,0.05); border: 1px solid #2d3748; color: #d1d5db; font-size: 11px;
    padding: 6px 10px; border-radius: 999px; cursor: pointer; transition: all 0.2s;
}
.pg-chip:hover { border-color: #cd402c; color: #fff; }

.pg-chatbot-input-row { display: flex; gap: 8px; padding: 14px; border-top: 1px solid #2d3748; background: #151b27; }
.pg-chatbot-input-row input {
    flex: 1; background: rgba(255,255,255,0.05); border: 1px solid #2d3748; border-radius: 8px;
    padding: 11px 14px; color: #fff; font-size: 16px; outline: none;
    /* 16px is deliberate, not arbitrary: iOS Safari auto-zooms the whole page
       when a focused text input is smaller than this, and that zoomed state
       can persist through a refresh. This is the standard fix. */
}
.pg-chatbot-input-row input::placeholder { color: #6b7280; }
.pg-chatbot-input-row input:focus { border-color: #cd402c; }
.pg-chatbot-input-row button { background: #cd402c; border: none; color: #fff; padding: 0 18px; border-radius: 8px; font-weight: 700; cursor: pointer; font-size: 13px; }
.pg-chatbot-input-row button:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 480px) {
    #pg-chatbot-panel {
        right: 16px; left: 16px; width: auto; bottom: 90px;
        height: calc(100vh - 160px); /* fallback */
        height: calc(100dvh - 160px);
    }
}
