/* 🌐 Czat ze strony — the floating chat on the public pages (docs/SITE_CHAT.md, js/site-chat.js). */
.tgsc, .tgsc * { box-sizing: border-box; }
.tgsc { --tgsc-blue: #0066cc; --tgsc-blue-dark: #004c99; --tgsc-orange: #ff6b35; --tgsc-ink: #1f2933; --tgsc-muted: #6b7280;
    --tgsc-line: #e5e7eb; --tgsc-bg: #f5f7fa; font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px; line-height: 1.45; color: var(--tgsc-ink); }

/* the launcher */
.tgsc-launcher { position: fixed; right: 20px; bottom: 20px; z-index: 990; display: inline-flex; align-items: center; gap: 10px;
    padding: 0 20px 0 16px; height: 56px; border: 0; border-radius: 28px; background: var(--tgsc-blue); color: #fff; font: inherit;
    font-weight: 600; cursor: pointer; box-shadow: 0 8px 24px rgba(0, 76, 153, 0.35); transition: transform .2s, background .2s; }
.tgsc-launcher:hover { background: var(--tgsc-blue-dark); transform: translateY(-2px); }
.tgsc-launcher:focus-visible, .tgsc button:focus-visible, .tgsc a:focus-visible, .tgsc input:focus-visible,
.tgsc select:focus-visible, .tgsc textarea:focus-visible { outline: 3px solid rgba(255, 107, 53, 0.6); outline-offset: 2px; }
.tgsc-launcher svg { width: 24px; height: 24px; flex-shrink: 0; }
.tgsc-launcher .tgsc-dot { position: absolute; top: 6px; left: 34px; width: 12px; height: 12px; border-radius: 50%; background: #22c55e;
    border: 2px solid var(--tgsc-blue); display: none; }
.tgsc-launcher.is-live .tgsc-dot { display: block; }
.tgsc-launcher .tgsc-badge { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
    background: var(--tgsc-orange); color: #fff; font-size: 12px; line-height: 22px; text-align: center; display: none; }
.tgsc-launcher.has-unread .tgsc-badge { display: block; }
.tgsc.is-open .tgsc-launcher { display: none; }

/* the panel */
.tgsc-panel { position: fixed; right: 20px; bottom: 20px; z-index: 991; width: 380px; max-width: calc(100vw - 32px); height: 620px;
    max-height: calc(100vh - 40px); display: none; flex-direction: column; background: #fff; border-radius: 16px; overflow: hidden;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.25); }
.tgsc.is-open .tgsc-panel { display: flex; }
.tgsc-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 18px; background: var(--tgsc-blue); color: #fff; }
.tgsc-head-text { flex: 1; min-width: 0; }
.tgsc-head-title { font-weight: 700; font-size: 16px; }
.tgsc-head-sub { font-size: 13px; opacity: .92; display: flex; align-items: center; gap: 6px; }
.tgsc-head-sub::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; flex-shrink: 0; }
.tgsc-head.is-live .tgsc-head-sub::before { background: #4ade80; }
.tgsc-icon-btn { width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.14); color: #fff; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; }
.tgsc-icon-btn:hover { background: rgba(255, 255, 255, 0.26); }
.tgsc-icon-btn svg { width: 20px; height: 20px; }

.tgsc-body { flex: 1; overflow-y: auto; background: var(--tgsc-bg); padding: 16px; -webkit-overflow-scrolling: touch; }
.tgsc-note { background: #fff; border: 1px solid var(--tgsc-line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.tgsc-note.is-warn { background: #fff7ed; border-color: #fed7aa; color: #7c2d12; }
.tgsc-note.is-ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }

/* forms */
.tgsc-form { display: flex; flex-direction: column; gap: 10px; }
.tgsc-field label, .tgsc-legend { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: #374151; }
.tgsc-field label small { font-weight: 400; color: var(--tgsc-muted); }
.tgsc-field input, .tgsc-field select, .tgsc-field textarea { width: 100%; font: inherit; font-size: 15px; color: var(--tgsc-ink);
    padding: 10px 12px; border: 1.5px solid #d1d5db; border-radius: 10px; background: #fff; }
.tgsc-field textarea { resize: vertical; min-height: 84px; }
.tgsc-field input:focus, .tgsc-field select:focus, .tgsc-field textarea:focus { border-color: var(--tgsc-blue); outline: none; }
.tgsc-field.has-error input, .tgsc-field.has-error textarea, .tgsc-field.has-error select { border-color: #dc2626; }
.tgsc-error { color: #b91c1c; font-size: 13px; margin-top: 4px; }
.tgsc-row { display: flex; gap: 8px; }
.tgsc-row > * { flex: 1; min-width: 0; }
.tgsc-ways { display: flex; gap: 6px; flex-wrap: wrap; }
.tgsc-ways label { flex: 1; min-width: 80px; margin: 0; padding: 8px 10px; border: 1.5px solid #d1d5db; border-radius: 10px; background: #fff;
    font-size: 14px; font-weight: 600; text-align: center; cursor: pointer; }
.tgsc-ways input { position: absolute; opacity: 0; pointer-events: none; }
.tgsc-ways input:checked + span { color: var(--tgsc-blue); }
.tgsc-ways label:has(input:checked) { border-color: var(--tgsc-blue); background: #eff6ff; }
.tgsc-field label.tgsc-consent, .tgsc-consent { display: flex; gap: 8px; margin: 0; font-weight: 400; align-items: flex-start; font-size: 13px; line-height: 1.45; color: #374151; }
.tgsc-consent input { width: 18px; height: 18px; margin: 1px 0 0; flex-shrink: 0; }
.tgsc-consent a { color: var(--tgsc-blue); }
.tgsc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.tgsc-primary { width: 100%; border: 0; border-radius: 10px; padding: 12px 16px; background: var(--tgsc-orange); color: #fff; font: inherit;
    font-weight: 700; font-size: 15px; cursor: pointer; transition: background .2s; }
.tgsc-primary:hover { background: #e85a26; }
.tgsc-primary[disabled] { opacity: .6; cursor: default; }
.tgsc-small { font-size: 12px; color: var(--tgsc-muted); }
.tgsc-small a { color: inherit; }

/* the conversation */
.tgsc-list { display: flex; flex-direction: column; gap: 8px; }
.tgsc-msg { max-width: 82%; padding: 9px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--tgsc-line);
    align-self: flex-start; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.tgsc-msg.is-visitor { align-self: flex-end; background: var(--tgsc-blue); border-color: var(--tgsc-blue); color: #fff; border-bottom-right-radius: 4px; }
.tgsc-msg.is-staff { border-bottom-left-radius: 4px; }
.tgsc-msg a { color: inherit; text-decoration: underline; }
.tgsc-meta { display: block; font-size: 11px; margin-top: 3px; opacity: .7; }
.tgsc-who { display: block; font-size: 12px; font-weight: 700; color: var(--tgsc-blue); margin-bottom: 2px; }
.tgsc-msg.is-pending { opacity: .6; }
.tgsc-sys { align-self: center; font-size: 12px; color: var(--tgsc-muted); text-align: center; padding: 4px 8px; }

.tgsc-foot { border-top: 1px solid var(--tgsc-line); background: #fff; padding: 10px 12px; }
.tgsc-compose { display: flex; gap: 8px; align-items: flex-end; }
.tgsc-compose textarea { flex: 1; font: inherit; font-size: 15px; resize: none; max-height: 120px; min-height: 44px; padding: 11px 12px;
    border: 1.5px solid #d1d5db; border-radius: 12px; }
.tgsc-compose textarea:focus { border-color: var(--tgsc-blue); outline: none; }
.tgsc-send { width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 50%; background: var(--tgsc-blue); color: #fff; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; }
.tgsc-send svg { width: 20px; height: 20px; }
.tgsc-send[disabled] { opacity: .5; cursor: default; }
.tgsc-foot-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; }
.tgsc-link { border: 0; background: none; padding: 0; font: inherit; font-size: 12px; color: var(--tgsc-muted); cursor: pointer; text-decoration: underline; }
.tgsc-closed { text-align: center; }
.tgsc-closed strong { display: block; margin-bottom: 8px; }

@media (max-width: 520px) {
    .tgsc-launcher { right: 16px; bottom: 16px; width: 56px; padding: 0; justify-content: center; }
    .tgsc-launcher .tgsc-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .tgsc-launcher .tgsc-dot { left: 36px; }
    .tgsc-panel { right: 0; bottom: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
    .tgsc-head { padding-top: calc(14px + env(safe-area-inset-top)); }
    .tgsc-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
    .tgsc-field input, .tgsc-field select, .tgsc-field textarea, .tgsc-compose textarea { font-size: 16px; } /* no zoom on iOS */
}
@media print { .tgsc { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .tgsc-launcher { transition: none; } }
