.public-chat {
    position: fixed; right: 22px; bottom: 22px; z-index: 1055;
    font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; color: #1e2a3a;
    --pc-navy: #0d73b9; --pc-navy-dark: #0a4f80; --pc-accent: #2196db; --pc-accent-dark: #0d73b9;
    --pc-gradient: linear-gradient(135deg, var(--pc-accent) 0%, var(--pc-navy) 55%, var(--pc-navy-dark) 130%);
    --pc-gradient-user: linear-gradient(120deg, #397fa9 0%, var(--pc-navy) 72%, var(--pc-navy-dark) 140%);
}
.public-chat *, .public-chat *::before, .public-chat *::after { box-sizing: border-box; }
.public-chat [hidden] { display: none !important; }
.public-chat .visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.public-chat button, .public-chat input, .public-chat select, .public-chat textarea { font: inherit; }
.public-chat button, .public-chat a { -webkit-tap-highlight-color: transparent; }
.public-chat button { cursor: pointer; }
.public-chat button:disabled { cursor: wait; opacity: .55; }
.public-chat :focus-visible { outline: 3px solid #e1a52b; outline-offset: 3px; }
.public-chat svg { width: 20px; height: 20px; display: block; }

/* Launcher */
.public-chat-launcher {
    position: relative; display: flex; align-items: center; justify-content: center;
    width: 66px; height: 66px; border: 0; border-radius: 50%; flex-shrink: 0; padding: 0;
    background: var(--pc-gradient); color: white;
    box-shadow: 0 10px 30px -6px #0c2c4a66, 0 2px 8px #0c2c4a33;
    transition: transform .18s ease, box-shadow .18s ease;
    animation: pc-launcher-breathe 2.6s ease-in-out infinite;
}
.public-chat-launcher:hover, .public-chat-launcher:focus-visible { transform: translateY(-2px) scale(1.06); box-shadow: 0 14px 36px -6px #0c2c4a80, 0 3px 10px #0c2c4a40; animation-play-state: paused; }
.public-chat-launcher:active { transform: translateY(0) scale(1); }
.public-chat .public-chat-launcher-icon { width: 40px; height: 40px; color: white; position: relative; z-index: 1; }

/* Attention rings: two staggered pulses expanding outward and fading, so the button keeps
   catching the eye without being as distracting as a single fast pulse. Behind the icon
   (z-index: 1 on the icon keeps it crisp) but above the button's own background. */
.public-chat-launcher::before, .public-chat-launcher::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%;
    background: var(--pc-accent); pointer-events: none;
    animation: pc-launcher-ping 2.6s cubic-bezier(0, 0, .2, 1) infinite;
}
.public-chat-launcher::after { animation-delay: 1.3s; }
.public-chat-launcher:hover::before, .public-chat-launcher:hover::after,
.public-chat-launcher:focus-visible::before, .public-chat-launcher:focus-visible::after {
    animation-play-state: paused; opacity: 0;
}
@keyframes pc-launcher-ping {
    0% { transform: scale(1); opacity: .55; }
    75%, 100% { transform: scale(1.7); opacity: 0; }
}
@keyframes pc-launcher-breathe {
    0%, 100% { box-shadow: 0 10px 30px -6px #0c2c4a66, 0 2px 8px #0c2c4a33; }
    50% { box-shadow: 0 10px 34px -4px #0d73b9aa, 0 2px 10px #0c2c4a44; }
}

/* Tooltip: hidden pill label that slides in from the right on hover/focus, MilesWeb-style */
.public-chat-launcher-tooltip {
    position: absolute; right: calc(100% + 12px); top: 50%; transform: translateY(-50%) translateX(6px);
    background: #1e2a3a; color: white; font-size: 13px; font-weight: 600; white-space: nowrap;
    padding: 9px 14px; border-radius: 10px; box-shadow: 0 6px 18px -4px #12203355;
    opacity: 0; pointer-events: none; transition: opacity .15s ease, transform .15s ease;
}
.public-chat-launcher-tooltip::after {
    content: ""; position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
    border: 6px solid transparent; border-left-color: #1e2a3a;
}
.public-chat-launcher:hover .public-chat-launcher-tooltip, .public-chat-launcher:focus-visible .public-chat-launcher-tooltip {
    opacity: 1; transform: translateY(-50%) translateX(0);
}

/* Panel */
.public-chat-panel {
    position: absolute; right: 0; bottom: 70px; width: 440px; max-width: calc(100vw - 32px);
    height: min(668px, calc(100dvh - 120px)); min-height: 240px; background: white;
    border: 1px solid #e7ecf2; border-radius: 28px; box-shadow: 0 24px 70px -12px #12203366, 0 4px 18px #12203322;
    display: flex; flex-direction: column; overflow: hidden;
}

/* Header */
.public-chat-header { background: #fbfcfe; color: #1e2a3a; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid #e9eef5; flex-shrink: 0; }
.public-chat-header-identity { display: flex; align-items: center; gap: 12px; }
.public-chat-avatar {
    display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: 0 0 auto;
    border-radius: 13px; background: var(--pc-gradient-user); border: 0;
}
.public-chat-avatar svg { width: 20px; height: 20px; color: white; }
.public-chat-header strong { font-size: 17px; display: block; letter-spacing: -.3px; }
.public-chat-header small { display: flex; align-items: center; gap: 5px; color: #66778b; font-size: 12px; margin-top: 2px; }
.public-chat-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 2px rgba(74,222,128,.25); flex: 0 0 auto; }
.public-chat-header button { color: #66778b; border: 0; background: #edf3f8; width: 32px; height: 32px; border-radius: 50%; font-size: 20px; line-height: 1; padding: 0; display: flex; align-items: center; justify-content: center; transition: background .15s ease; }
.public-chat-header button:hover { background: #e0ebf4; }

/* Tools row */
.public-chat-tools { display: flex; justify-content: space-between; gap: 8px; padding: 10px 16px; border-bottom: 1px solid #eef2f6; background: white; }
.public-chat-tools button { background: transparent; border: 0; color: var(--pc-accent-dark); font-size: 11.5px; font-weight: 600; text-decoration: none; padding: 2px 0; border-bottom: 1px solid transparent; transition: border-color .15s ease; }
.public-chat-tools button:hover { border-color: var(--pc-accent-dark); }

/* Scroll area / bubbles */
.public-chat-scroll { overflow-y: auto; overscroll-behavior: contain; flex: 1; min-height: 0; padding: 22px 20px; background: white; scrollbar-width: thin; scrollbar-color: #cfdeeb transparent; }
.public-chat-message {
    white-space: pre-wrap; overflow-wrap: anywhere; padding: 0;
    margin: 0 0 18px; background: transparent; border: 0; font-size: 15px; line-height: 1.65;
    animation: pc-pop .18s ease;
}
.public-chat-message.user { background: var(--pc-gradient-user); color: white; margin: 0 0 20px auto; max-width: 86%; width: fit-content; padding: 13px 17px; font-weight: 600; border-radius: 20px 20px 6px 20px; box-shadow: 0 4px 14px -4px #12203355; }
@keyframes pc-pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.public-chat-source { font-size: 11px; color: #64748b; margin: -5px 0 12px; padding-left: 2px; }

/* Actions / role & CTA buttons */
.public-chat-actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 4px; }
.public-chat-roles { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 6px 0 4px; }
.public-chat-actions button, .public-chat-actions a, .public-chat-roles button, .public-chat-pointers button, .public-chat-contact button {
    display: inline-flex; align-items: center; background: white; border: 1.5px solid #d7e0ea; color: var(--pc-navy);
    border-radius: 16px; padding: 13px 16px; font-size: 13px; font-weight: 600; text-decoration: none; text-align: left;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.public-chat-actions button:hover, .public-chat-actions a:hover, .public-chat-roles button:hover, .public-chat-pointers button:hover:not(:disabled), .public-chat-contact button:hover:not(:disabled) {
    transform: translateY(-1px); border-color: var(--pc-accent); box-shadow: 0 4px 12px -4px #12203340;
}
.public-chat-contact button[type=submit], .public-chat-registration button[type=submit] {
    color: white; background: var(--pc-gradient-user); border-color: transparent;
}

/* Forms */
.public-chat-actions > * { min-height: 54px; width: 100%; gap: 12px; border: 1px solid #e0e8f1; box-shadow: 0 2px 4px #12203308; }
.public-chat-actions > *::after { content: ""; margin-left: auto; width: 7px; height: 7px; flex-shrink: 0; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg); }
.public-chat-actions > *:hover { background: #f6faff; }
.public-chat-roles button { justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border: 1px solid #e0e8f1; border-radius: 999px; background: #fbfcfe; color: #52647b; font-size: 14px; box-shadow: 0 2px 4px #12203308; }
.public-chat-roles button svg { width: 18px; height: 18px; flex-shrink: 0; }
.public-chat-roles button[data-audience=candidate] { background: var(--pc-gradient-user); border-color: transparent; color: white; box-shadow: 0 7px 18px -5px #0d73b966; }
.public-chat-roles button[data-audience=company]:hover { background: #f0f7fc; }
.public-chat-contact, .public-chat-pointers { background: white; padding: 16px; border-radius: 16px; margin-top: 12px; border: 1px solid #e7ecf2; box-shadow: 0 2px 10px -4px #12203322; }
.public-chat-contact label, .public-chat-pointers label { display: block; font-size: 12px; font-weight: 700; color: #33465c; margin: 10px 0 5px; }
.public-chat-contact input:not([type=checkbox]), .public-chat-contact select, .public-chat-contact textarea, .public-chat-pointers select {
    width: 100%; border: 1.5px solid #d7e0ea; border-radius: 10px; padding: 9px 11px; background: #fbfcfe; color: #1e2a3a;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.public-chat-contact input:focus, .public-chat-contact select:focus, .public-chat-contact textarea:focus, .public-chat-pointers select:focus {
    border-color: var(--pc-accent); box-shadow: 0 0 0 3px #2196db26; outline: none;
}
.public-chat-consent { font-weight: 400 !important; display: flex !important; align-items: flex-start; gap: 8px; padding: 8px 0; font-size: 12.5px; color: #4b5d72; }
.public-chat-consent input { margin-top: 3px; }
.public-chat-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.public-chat-pointers button { margin-top: 12px; }
.public-chat-registration input { width: 100%; border: 1.5px solid #d7e0ea; border-radius: 10px; padding: 9px 11px; background: #fbfcfe; color: #1e2a3a; }
.public-chat-registration input:focus { border-color: var(--pc-accent); box-shadow: 0 0 0 3px #2196db26; outline: none; }

/* Status */
.public-chat-status { font-size: 12px; margin: 0; padding: 0 16px; color: #b3421f; }
.public-chat-status:not(:empty) { padding-top: 8px; padding-bottom: 8px; }

/* Input bar */
.public-chat-input { display: flex; align-items: center; gap: 8px; margin: 12px 16px 16px; padding: 8px; border: 1px solid #e0e8f1; border-radius: 18px; background: #f4f7fb; flex-shrink: 0; }
.public-chat-input input { width: 0; min-width: 0; flex: 1; color: #1e2a3a; border: 0; border-radius: 10px; padding: 10px; background: transparent; transition: border-color .15s ease, box-shadow .15s ease; }
.public-chat-input input:focus { border-color: var(--pc-accent); box-shadow: 0 0 0 3px #2196db26; outline: none; background: white; }
.public-chat-input button {
    flex: 0 0 auto; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
    border: 0; background: var(--pc-gradient-user); color: white; border-radius: 12px; padding: 0;
    box-shadow: 0 4px 12px -3px #12203355; transition: transform .12s ease;
}
.public-chat-input button svg { width: 18px; height: 18px; margin-left: -1px; }
.public-chat-input button:hover:not(:disabled) { transform: scale(1.06); }

@media (max-width: 480px) {
    .public-chat { bottom: 12px; right: 12px; }
    .public-chat-panel { bottom: 64px; max-width: calc(100vw - 24px); height: min(620px, calc(100dvh - 94px)); border-radius: 20px; }
    .public-chat-launcher { width: 56px; height: 56px; }
    .public-chat .public-chat-launcher-icon { width: 34px; height: 34px; }
    .public-chat-launcher-tooltip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .public-chat *, .public-chat *::before, .public-chat *::after { animation: none !important; transition: none !important; }
}
