.polyphonos-intelligence-widget {
    --piw-navy: #002155;
    --piw-blue: #0b3f75;
    --piw-orange: #db6412;
    --piw-header-text: #fff;
    --piw-header-subtitle: #d7e3f3;
    position: fixed;
    bottom: 24px;
    z-index: 99999;
    width: min(390px, calc(100vw - 32px));
    height: 82px;
    color: #142238;
    font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    pointer-events: none;
}
.polyphonos-intelligence-widget--right { right: 24px; }
.polyphonos-intelligence-widget--left { left: 24px; }
.piw-panel {
    position: absolute;
    bottom: 96px;
    left: 0;
    width: 100%;
    max-height: min(var(--piw-panel-max-height, calc(100vh - 120px)), calc(100vh - 24px));
    margin: 0 !important;
    padding: 0 !important;
    overflow: auto;
    border: 1px solid rgba(0, 33, 85, .16);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 18px 60px rgba(0, 22, 55, .24);
    pointer-events: auto;
}
.piw-panel[hidden] { display: none; }
.piw-panel > .piw-drag-handle {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    width: 100%;
    min-height: 72px;
    margin: 0 !important;
    padding: 12px 14px !important;
    border: 0 !important;
    gap: 12px;
    background: linear-gradient(135deg, var(--piw-navy), var(--piw-blue)) !important;
    color: var(--piw-header-text) !important;
    user-select: none;
}
.piw-drag-handle { cursor: grab; touch-action: none; }
.is-dragging .piw-drag-handle,
.is-dragging .piw-toggle__avatar { cursor: grabbing; }
.piw-brand { display: flex; align-items: center; min-width: 0; gap: 10px; }
.piw-brand img,
.piw-toggle__avatar img { display: block; object-fit: cover; border-radius: 50%; background: #fff; }
.piw-toggle__avatar img { pointer-events: none; user-select: none; -webkit-user-drag: none; }
.piw-brand img { flex: 0 0 auto; border: 2px solid rgba(255, 255, 255, .82); }
.piw-brand strong,
.piw-brand small { display: block; }
.piw-brand strong { font-size: 15px; line-height: 1.2; }
.piw-brand small { margin-top: 3px; color: var(--piw-header-subtitle); font-size: 11px; line-height: 1.2; }
.piw-close,
.piw-panel form button,
.piw-contact { border: 0; cursor: pointer; }
.piw-close {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: var(--piw-header-text);
    font-size: 24px;
    line-height: 1;
}
.piw-close:hover,
.piw-close:focus-visible { background: rgba(255, 255, 255, .24); }
.piw-messages { max-height: 300px; overflow: auto; padding: 16px; background: #f4f7fb; }
.piw-messages p {
    width: fit-content;
    max-width: 88%;
    margin: 0 0 10px;
    padding: 10px 12px;
    border-radius: 14px;
    white-space: pre-wrap;
    box-shadow: 0 2px 8px rgba(0, 33, 85, .05);
}
.piw-messages p:last-child { margin-bottom: 0; }
.piw-assistant { border-bottom-left-radius: 4px !important; background: #fff; }
.piw-visitor { margin-left: auto !important; border-bottom-right-radius: 4px !important; background: #dcecff; }
.piw-typing { display: flex; align-items: center; min-width: 82px; gap: 9px; }
.piw-typing img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.piw-typing__dots { display: inline-flex; align-items: center; height: 20px; gap: 4px; }
.piw-typing__dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--piw-blue);
    animation: piw-typing-bounce .9s ease-in-out infinite;
}
.piw-typing__dots i:nth-child(2) { animation-delay: .14s; }
.piw-typing__dots i:nth-child(3) { animation-delay: .28s; }
@keyframes piw-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: .45; }
    30% { transform: translateY(-5px); opacity: 1; }
}
.piw-messages a { color: var(--piw-blue); font-weight: 700; }
.piw-messages .piw-navigation {
    display: inline-block;
    margin-top: 9px;
    padding: 7px 11px;
    border: 1px solid rgba(0, 33, 85, .16);
    border-radius: 999px;
    background: #eef3f8;
    line-height: 1.25;
    text-decoration: none;
}
.piw-messages .piw-navigation:hover,
.piw-messages .piw-navigation:focus-visible { background: #dfeaf5; }
.piw-panel form { display: grid; padding: 14px; gap: 9px; }
.piw-panel form[hidden] { display: none; }
.piw-panel input:not([type=checkbox]),
.piw-panel textarea {
    box-sizing: border-box;
    width: 100%;
    padding: 10px 11px;
    border: 1px solid #b8c6d7;
    border-radius: 9px;
    background: #fff;
    color: #142238;
    font: inherit;
}
.piw-panel textarea { min-height: 72px; resize: vertical; }
.piw-panel input:focus,
.piw-panel textarea:focus { outline: 3px solid var(--piw-orange); outline-offset: 1px; border-color: var(--piw-orange); }
.piw-panel form button {
    box-sizing: border-box;
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 11px 16px;
    appearance: none;
    border-radius: 999px;
    background: var(--piw-orange);
    color: #fff;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    font-size: 16px !important;
    font-weight: 750 !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}
.piw-panel form button:hover,
.piw-panel form button:focus-visible { filter: brightness(.88); }
.piw-panel form button:disabled { opacity: .62; cursor: wait; }
.piw-panel form > small { color: #5b6978; font-size: 11px; }
.piw-consent { display: flex; align-items: flex-start; gap: 7px; font-size: 12px; }
.piw-consent input { margin-top: 3px; }
.piw-contact {
    display: block;
    width: calc(100% - 28px);
    margin: 0 14px 14px;
    padding: 10px 14px;
    border: 1px solid rgba(0, 33, 85, .14);
    border-radius: 999px;
    background: #eef3f8;
    color: var(--piw-navy);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
    text-align: center;
    text-decoration: none;
    text-transform: none !important;
}
.piw-contact[hidden] { display: none; }
.piw-contact:hover,
.piw-contact:focus-visible { background: #e1eaf3; }
.piw-fallback { padding: 16px 14px 4px; background: #f4f7fb; }
.piw-fallback[hidden] { display: none; }
.piw-fallback h3 { margin: 0 0 5px; color: var(--piw-navy); font-size: 19px; line-height: 1.25; }
.piw-fallback > p { margin: 0 0 10px; font-size: 13px; }
.piw-fallback .piw-lead-form { padding: 8px 0 10px; }
.piw-fallback-status:empty { display: none; }
.piw-fallback-status { color: var(--piw-blue); font-weight: 700; }
.piw-toggle {
    position: absolute;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
    padding: 0;
    border: 0;
    gap: 10px;
    background: transparent;
    cursor: pointer;
    pointer-events: auto;
}
.polyphonos-intelligence-widget--left .piw-toggle { right: auto; left: 0; flex-direction: row-reverse; margin-right: auto; margin-left: 0; }
.piw-toggle__prompt {
    display: none;
    max-width: 220px;
    padding: 10px 13px;
    border: 1px solid rgba(0, 33, 85, .12);
    border-radius: 15px 15px 3px 15px;
    background: #fff;
    color: var(--piw-navy);
    box-shadow: 0 8px 26px rgba(0, 22, 55, .18);
    font-size: 14px;
    font-weight: 750;
    text-align: left;
}
.piw-toggle:hover .piw-toggle__prompt,
.piw-toggle:focus-visible .piw-toggle__prompt { display: block; }
.polyphonos-intelligence-widget--left .piw-toggle__prompt { border-radius: 15px 15px 15px 3px; }
.piw-toggle__avatar {
    position: relative;
    display: block;
    flex: 0 0 auto;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 8px 26px rgba(0, 22, 55, .28);
    cursor: grab;
    touch-action: none;
}
.piw-status-dot {
    position: absolute;
    right: 1px;
    bottom: 5px;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #c83232;
}
.is-available .piw-status-dot { background: #32a852; }
.polyphonos-intelligence-widget.is-open .piw-toggle__prompt { display: none !important; }
.piw-toggle:hover .piw-toggle__avatar,
.piw-toggle:focus-visible .piw-toggle__avatar { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0, 22, 55, .34); }
.polyphonos-intelligence-widget.has-manual-position .piw-toggle:hover .piw-toggle__avatar,
.polyphonos-intelligence-widget.has-manual-position .piw-toggle:focus-visible .piw-toggle__avatar { transform: none; }
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    border: 0;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}
@media (max-width: 700px) {
    .polyphonos-intelligence-widget,
    .polyphonos-intelligence-widget--right,
    .polyphonos-intelligence-widget--left { top: auto !important; right: 12px !important; bottom: 12px !important; left: 12px !important; width: auto; height: 74px; }
    .piw-panel { bottom: 88px; max-height: calc(100vh - 112px); }
    .piw-messages { max-height: 34vh; }
    .piw-toggle__prompt { max-width: min(220px, calc(100vw - 120px)); }
    .piw-drag-handle,
    .piw-toggle__avatar { cursor: default; }
    .piw-toggle__avatar img { width: 68px; height: 68px; }
}
@media (prefers-reduced-motion: reduce) {
    .piw-toggle__avatar { transition: none; }
    .piw-typing__dots i { animation: none; }
}
