.psychz-livechat-widget,
.psychz-livechat-widget * {
    box-sizing: border-box;
}

.psychz-livechat-widget {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 2147483000;
    font-family: Arial, Helvetica, sans-serif;
    color: #1d2733;
}

.psychz-livechat-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: #0f4c81;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 12px 28px rgba(15, 76, 129, 0.28);
    cursor: pointer;
}

.psychz-livechat-toggle:hover,
.psychz-livechat-toggle:focus {
    background: #0d3f6a;
    outline: none;
}

.psychz-livechat-panel {
    position: absolute;
    right: 0;
    bottom: 52px;
    display: none;
    width: 320px;
    max-width: calc(100vw - 32px);
    max-height: min(70vh, 520px);
    overflow: hidden;
    border: 1px solid rgba(29, 39, 51, 0.1);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(15, 29, 51, 0.25);
}

.psychz-livechat-widget.is-open .psychz-livechat-panel {
    display: flex;
    flex-direction: column;
}

.psychz-livechat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 12px;
    background: linear-gradient(135deg, #0f4c81 0%, #164b66 100%);
    color: #ffffff;
}

.psychz-livechat-header-text {
    min-width: 0;
}

.psychz-livechat-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

.psychz-livechat-status {
    margin-top: 4px;
    min-height: 18px;
    font-size: 12px;
    line-height: 1.35;
    opacity: 0.9;
}

.psychz-livechat-new-chat {
    display: inline-block;
    margin-top: 8px;
    min-height: 36px;
    padding: 5px 10px;
    border: 1px solid #ffffff;
    border-radius: 6px;
    background: #ffffff;
    color: #0f4c81;
    font-size: 12px;
    font-weight: 700;
    line-height: 20px;
    cursor: pointer;
}

.psychz-livechat-new-chat[hidden] {
    display: none !important;
}

.psychz-livechat-new-chat:hover,
.psychz-livechat-new-chat:focus {
    background: #f1f5f9;
    outline: 2px solid rgba(255, 255, 255, 0.9);
    outline-offset: 2px;
}

.psychz-livechat-new-chat:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.psychz-livechat-close {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.psychz-livechat-close:hover,
.psychz-livechat-close:focus {
    background: rgba(255, 255, 255, 0.26);
    outline: none;
}

.psychz-livechat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 14px 10px;
    background: #f6f8fb;
}

.psychz-livechat-message {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.psychz-livechat-message-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #566575;
}

.psychz-livechat-message-body {
    display: inline-block;
    padding: 10px 12px;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(29, 39, 51, 0.06);
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.psychz-livechat-panel.is-composer-expanded {
    max-height: min(85vh, 700px);
}

.psychz-livechat-message-body a {
    color: #0b5cad;
    text-decoration: underline;
    cursor: pointer;
    pointer-events: auto;
}

.psychz-livechat-message--visitor {
    align-items: flex-end;
}

.psychz-livechat-message--visitor .psychz-livechat-message-body {
    background: #0f4c81;
    color: #ffffff;
}

.psychz-livechat-message--visitor .psychz-livechat-message-body a {
    color: #ffffff;
}

.psychz-livechat-message--system {
    align-items: center;
}

.psychz-livechat-message--system .psychz-livechat-message-label {
    display: none;
}

.psychz-livechat-message--system .psychz-livechat-message-body {
    background: #e8eff8;
    color: #2e4055;
    text-align: center;
}

.psychz-livechat-message-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #7a8794;
}

.psychz-livechat-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 12px 14px;
    border-top: 1px solid rgba(29, 39, 51, 0.08);
    background: #ffffff;
}

.psychz-livechat-input {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 56px;
    max-height: 234px;
    padding: 10px 12px;
    border: 1px solid #c8d2de;
    border-radius: 10px;
    background: #ffffff;
    color: #1d2733;
    font-size: 14px;
    line-height: 21px;
    resize: none;
    overflow-y: hidden;
}

.psychz-livechat-rating {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}

.psychz-livechat-rating-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    opacity: 0.78;
}

.psychz-livechat-rating-button.is-selected {
    background: rgba(15, 76, 129, 0.12);
    color: #0f4c81;
    opacity: 1;
}

.psychz-livechat-rating-button:hover {
    background: rgba(15, 76, 129, 0.08);
    opacity: 1;
}

.psychz-livechat-rating-button:focus-visible,
.psychz-livechat-rating-sheet button:focus-visible,
.psychz-livechat-rating-sheet select:focus-visible,
.psychz-livechat-rating-sheet textarea:focus-visible {
    outline: 2px solid #0f4c81;
    outline-offset: 2px;
}

.psychz-livechat-rating-sheet {
    position: absolute;
    right: 8px;
    bottom: 72px;
    left: 8px;
    z-index: 3;
    display: none;
    padding: 10px;
    border: 1px solid rgba(29, 39, 51, 0.14);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(29, 39, 51, 0.18);
}

.psychz-livechat-rating-sheet.is-visible {
    display: block;
}

.psychz-livechat-rating-sheet-title {
    margin: 0 0 7px;
    color: #1d2733;
    font-size: 13px;
    line-height: 18px;
}

.psychz-livechat-rating-sheet select,
.psychz-livechat-rating-sheet textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    border: 1px solid #c8d2de;
    border-radius: 5px;
    padding: 6px;
    box-sizing: border-box;
    font-size: 11px;
}

.psychz-livechat-rating-sheet textarea {
    margin-top: 6px;
    resize: vertical;
}

.psychz-livechat-rating-sheet-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 8px;
}

.psychz-livechat-rating-sheet-actions button {
    min-height: 28px;
    padding: 4px 9px;
    border: 1px solid #c8d2de;
    border-radius: 5px;
    background: #ffffff;
    color: #1d2733;
    cursor: pointer;
    font-size: 11px;
}

.psychz-livechat-rating-sheet-submit {
    border-color: #0f4c81 !important;
    background: #0f4c81 !important;
    color: #ffffff !important;
}

.psychz-livechat-toast {
    position: absolute;
    right: 12px;
    bottom: 68px;
    left: 12px;
    z-index: 4;
    display: none;
    padding: 7px 9px;
    border-radius: 6px;
    background: #1d2733;
    color: #ffffff;
    font-size: 11px;
    line-height: 15px;
    text-align: center;
}

.psychz-livechat-toast.is-visible {
    display: block;
}

.psychz-livechat-toast.is-error {
    background: #8a2f2f;
}

.psychz-livechat-rating-button:disabled,
.psychz-livechat-rating-sheet button:disabled {
    cursor: wait;
    opacity: 0.55;
}

.psychz-livechat-form-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
}

.psychz-livechat-expand {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 4px 8px;
    border: 0;
    background: transparent;
    color: #0f4c81;
    font-size: 12px;
    cursor: pointer;
}

.psychz-livechat-expand:focus {
    outline: 2px solid rgba(15, 76, 129, 0.24);
    outline-offset: 2px;
}

.psychz-livechat-counter {
    flex: 1 1 auto;
    min-width: 0;
    color: #64748b;
    font-size: 11px;
    text-align: right;
    white-space: nowrap;
}

.psychz-livechat-counter.is-warning {
    color: #9a6700;
}

.psychz-livechat-counter.is-danger {
    color: #b42318;
}

.psychz-livechat-input:focus {
    border-color: #0f4c81;
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.14);
}

.psychz-livechat-send {
    flex: 0 0 auto;
    min-width: 76px;
    height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    background: #0f4c81;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.psychz-livechat-send:hover,
.psychz-livechat-send:focus {
    background: #0d3f6a;
    outline: none;
}

.psychz-livechat-send:disabled,
.psychz-livechat-input:disabled,
.psychz-livechat-expand:disabled {
    opacity: 0.72;
    cursor: not-allowed;
}

.psychz-livechat-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 480px) {
    .psychz-livechat-widget {
        right: 12px;
        left: 12px;
        bottom: 12px;
    }

    .psychz-livechat-toggle {
        float: right;
    }

    .psychz-livechat-panel {
        right: 0;
        left: 0;
        width: auto;
        max-width: none;
    }

    .psychz-livechat-form-controls {
        gap: 4px;
    }

    .psychz-livechat-new-chat {
        max-width: 100%;
        padding-right: 8px;
        padding-left: 8px;
        font-size: 11px;
    }

    .psychz-livechat-send {
        min-width: 68px;
        padding: 0 10px;
    }
}

.psychz-livechat-identity {
    padding: 10px 14px 0;
}

.psychz-livechat-identity-copy {
    margin: 0 0 8px;
    color: #52606d;
    font-size: 12px;
    line-height: 1.4;
}

.psychz-livechat-identity-input {
    display: block;
    width: 100%;
    height: 34px;
    margin-bottom: 8px;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
}

.psychz-livechat-identity-input:focus {
    border-color: #0f4c81;
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.14);
}
