/* Peter — ten sam widget przed i po zalogowaniu. */
.peter-widget { position: fixed; bottom: 28px; right: 28px; z-index: 9999; font-family: var(--font, Roboto, Arial, sans-serif); text-align: left; pointer-events: none; }
.peter-widget-app { z-index: 9999991999; }
.peter-widget button { margin: 0; float: none; line-height: normal; box-shadow: none; text-transform: none; letter-spacing: normal; }
.peter-bubble { background: #fff; border: 1px solid #E0E0E0; border-radius: 14px; box-shadow: 0 8px 32px rgba(0,0,0,0.14); padding: 18px 18px; max-width: 260px; width: 260px; position: absolute; bottom: 76px; right: 0; opacity: 0; transform: translateY(10px) scale(0.95); transition: opacity 0.25s ease, transform 0.25s ease; pointer-events: none; }
@media (max-width: 767px) {
  .peter-widget { bottom: 20px; right: 16px; }
  .peter-bubble { position: fixed; bottom: 100px; left: 16px; right: 16px; width: auto; max-width: none; }
}
.peter-bubble.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.peter-bubble::after { content: ''; position: absolute; bottom: -8px; right: 22px; width: 14px; height: 14px; background: #fff; border-right: 1px solid #E0E0E0; border-bottom: 1px solid #E0E0E0; transform: rotate(45deg); }
.peter-bubble-name { font-size: 10px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--cc-accent, #006CFF); margin-bottom: 5px; }
.peter-bubble-text { font-size: 13px; font-weight: 400; color: #1C1C1C; line-height: 1.5; }
.peter-bubble-cta { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 12px; font-weight: 700; color: #fff; background:#006CFF; padding: 8px 14px; text-decoration: none; border: none; border-radius: 8px; box-shadow: none; cursor: pointer; }
.peter-bubble-cta:hover { background:#0052CC; }
.peter-bubble-cta svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.peter-close { position: absolute; top: 8px; right: 10px; background: none; border: none; cursor: pointer; font-size: 14px; color: #999; padding: 2px 4px; }
.peter-btn { width: 64px; height: 64px; border-radius: 50%; border: none; background: none; cursor: pointer; padding: 0; position: relative; transition: transform 0.2s; filter: drop-shadow(0 4px 16px rgba(0,0,0,0.22)); pointer-events: auto; display: block; }
.peter-btn:hover { transform: scale(1.08); }
.peter-btn img { width: 64px; height: 64px; border-radius: 50%; position: absolute; top: 0; left: 0; transition: opacity 0.3s; max-width: none; }
.peter-btn .img-idle { opacity: 1; } .peter-btn .img-active { opacity: 0; }
.peter-btn:hover .img-idle, .peter-btn.active .img-idle { opacity: 0; }
.peter-btn:hover .img-active, .peter-btn.active .img-active { opacity: 1; }
.peter-btn::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid rgba(0,108,255,0.4); animation: peterPulse 2.5s ease-in-out infinite; }
@keyframes peterPulse { 0%,100%{transform:scale(1);opacity:0.7} 50%{transform:scale(1.12);opacity:0} }

.peter-chat { position: absolute; bottom: 76px; right: 0; width: 380px; max-width: calc(100vw - 36px); height: 560px; max-height: calc(100vh - 140px); background: #fff; border: 1px solid #E0E0E0; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,0.18); display: flex; flex-direction: column; opacity: 0; transform: translateY(10px) scale(0.97); transition: opacity 0.25s ease, transform 0.25s ease; pointer-events: none; overflow: hidden; }
.peter-chat.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
@media (max-width: 767px) {
  .peter-chat { position: fixed; bottom: 100px; left: 16px; right: 16px; width: auto; max-width: none; height: calc(100vh - 140px); }
}
.peter-chat-header { display: flex; align-items: center; justify-content: space-between; background: #006CFF; color: #fff; padding: 12px 14px; flex-shrink: 0; }
.peter-chat-header-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.peter-chat-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; background: #fff; }
.peter-chat-titles { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.peter-chat-name { font-size: 15px; font-weight: 700; color: #fff; }
.peter-chat-role { font-size: 11px; font-weight: 400; color: rgba(255,255,255,0.85); }
.peter-chat-close { background: none; border: none; color: #fff; font-size: 16px; cursor: pointer; padding: 4px 6px; opacity: 0.85; transition: opacity 0.15s; }
.peter-chat-close:hover { opacity: 1; }

.peter-chat-messages { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 16px 8px; font-size: 13px; line-height: 1.55; color: #1C1C1C; background: #fff; scrollbar-width: thin; scrollbar-color: #ccc transparent; }
.peter-chat-messages::-webkit-scrollbar { width: 6px; }
.peter-chat-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
.peter-chat-intro h3 { font-size: 14px; font-weight: 700; color: #0A0A0A; margin-bottom: 8px; }
.peter-chat-intro p { font-size: 12px; color: #4a4a4a; margin-bottom: 8px; line-height: 1.5; }
.peter-chat-msg { margin-bottom: 10px; padding: 8px 10px; border-radius: 6px; word-wrap: break-word; word-break: break-word; }
.peter-msg-user, .peter-chat-messages .my_msq { background: #FFF4D1; color: #1C1C1C; }
.peter-chat-messages .my_msq, .peter-chat-messages .answear_msg { margin-bottom: 10px; padding: 8px 10px; border-radius: 6px; }
.peter-chat-messages .answear_msg { background: #F4F6FA; color: #1C1C1C; }
.peter-msg-bot { background: #F4F6FA; color: #1C1C1C; }
.peter-msg-thinking { background: transparent; color: #6B6B6B; font-style: italic; padding: 4px 0; }
.peter-msg-error { background: #FEF2F2; color: #991B1B; }
.peter-chat-msg b, .peter-chat-msg strong { font-weight: 700; color: #000; }
.peter-chat-msg a { color: #006CFF; text-decoration: underline; word-break: break-all; }
.peter-chat-msg a:hover { text-decoration: none; }
.peter-chat-msg h1, .peter-chat-msg h2, .peter-chat-msg h3 { font-size: 14px; font-weight: 700; margin: 8px 0 4px; color: #0A0A0A; }
.peter-chat-msg ul, .peter-chat-msg ol { margin: 6px 0 6px 18px; padding-left: 16px; }
.peter-chat-msg li { margin-bottom: 3px; }
.peter-chat-msg code { background: #ECEEF2; padding: 1px 5px; border-radius: 3px; font-family: Consolas, Menlo, monospace; font-size: 12px; }
.peter-chat-msg pre { background: #F4F6FA; padding: 10px; border-radius: 6px; overflow-x: auto; font-size: 12px; margin: 6px 0; }
.peter-chat-msg blockquote { border-left: 3px solid #E0E0E0; padding-left: 10px; margin: 6px 0; color: #555; font-style: italic; }

.peter-chat-input { display: flex; align-items: stretch; flex-shrink: 0; border-top: 1px solid #E0E0E0; padding: 10px 12px; gap: 0; }
.peter-widget .peter-chat-input input { flex: 1; border: none; margin: 0; padding: 11px 14px; font-size: 13px; font-family: var(--font, Roboto, Arial, sans-serif); background: #F4F5F7; color: #1C1C1C; outline: none; min-width: 0; width: auto; height: auto; border-radius: 8px 0 0 8px; box-sizing: border-box; }
.peter-chat-input input:focus { background: #fff; box-shadow: inset 0 0 0 2px #006CFF; }
.peter-chat-send { background: #006CFF; color: #fff; border: none; width: 46px; flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s; border-radius: 0 8px 8px 0; }
.peter-chat-send:hover { background: #0052CC; }
.peter-chat-send:disabled { opacity: 0.55; cursor: default; }
.peter-chat-send svg { width: 18px; height: 18px; }
.peter-chat-input input:disabled { opacity: 0.55; }
.peter-thinking-spinner { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border: 2px solid #ccc; border-top-color: #006CFF; border-radius: 50%; vertical-align: -2px; animation: peterSpin 0.7s linear infinite; }
@keyframes peterSpin { to { transform: rotate(360deg); } }
.peter-msg-clarify { border-left: 3px solid #006CFF; padding-left: 8px; }
.peter-msg-escalate { border-left: 3px solid #B45309; padding-left: 8px; }
.peter-kind-label { font-size: 11px; font-weight: 700; color: #006CFF; margin-bottom: 4px; }
.peter-kind-note { margin: 8px 0 0; font-size: 12px; color: #B45309; }

.peter-chat-bottom { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; flex-shrink: 0; padding: 6px 12px; background: #FAFBFC; border-top: 1px solid #EFEFEF; font-size: 10px; color: #999; }
.peter-chat-bottom a, .peter-chat-clear { color: #006CFF; font-size: 10px; text-decoration: none; background: none; border: none; cursor: pointer; padding: 0; font-family: inherit; }
.peter-chat-bottom a:hover, .peter-chat-clear:hover { color: #0A0A0A; text-decoration: underline; }
.peter-chat-sep { color: #ccc; }

.peter-widget.peter-flip-x .peter-bubble,
.peter-widget.peter-flip-x .peter-chat,
.peter-widget.peter-flip-x .peter-move-hint { right: auto; left: 0; }
.peter-widget.peter-flip-x .peter-bubble::after { right: auto; left: 22px; }
.peter-widget.peter-flip-y .peter-bubble,
.peter-widget.peter-flip-y .peter-chat,
.peter-widget.peter-flip-y .peter-move-hint { bottom: auto; top: 76px; }
.peter-widget.peter-flip-y .peter-bubble::after { bottom: auto; top: -8px; border-right: none; border-bottom: none; border-left: 1px solid #E0E0E0; border-top: 1px solid #E0E0E0; }
.peter-move-hint { display: none; position: absolute; bottom: 76px; right: 0; width: 210px; background: #fff; border: 1px solid #E0E0E0; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.14); padding: 10px 12px; font-size: 12px; font-weight: 600; line-height: 1.4; color: #1C1C1C; pointer-events: none; }
.peter-moving .peter-move-hint { display: block; }
.peter-moving .peter-btn,
.peter-moving .peter-btn:hover { cursor: grab; touch-action: none; transform: none; }
.peter-moving .peter-btn::after { animation: none; opacity: 1; border-style: dashed; }
.peter-moving .peter-bubble,
.peter-moving .peter-chat { opacity: 0 !important; pointer-events: none !important; }

@media (max-width: 767px) {
  .peter-widget.peter-placed .peter-bubble,
  .peter-widget.peter-placed .peter-chat {
    position: absolute;
    bottom: 76px;
    left: auto;
    right: 0;
    width: min(320px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    height: min(480px, calc(100vh - 140px));
  }
  .peter-widget.peter-placed.peter-flip-x .peter-bubble,
  .peter-widget.peter-placed.peter-flip-x .peter-chat { right: auto; left: 0; }
  .peter-widget.peter-placed.peter-flip-y .peter-bubble,
  .peter-widget.peter-placed.peter-flip-y .peter-chat { bottom: auto; top: 76px; }
}
@media print {
  .peter-widget { display: none !important; }
}
