.tg-chat-launcher {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 99990;
    display: none;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 10px 14px;
    border: 0;
    border-radius: 999px;
    background: #007aff;
    color: #fff;
    box-shadow: 0 14px 34px rgba(0, 122, 255, 0.25), 0 8px 18px rgba(15, 23, 42, 0.12);
    cursor: pointer;
    font-family: "Open Sans", Arial, sans-serif;
    font-size: 13px;
    font-weight: 800;
}

.tg-chat-launcher.tg-chat-launcher-visible {
    display: inline-flex;
}

.tg-chat-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99990;
    display: none;
    background: rgba(15, 23, 42, 0.42);
}

.tg-chat-popup-mode .tg-chat-backdrop {
    display: block;
}

.tg-chat-launcher svg,
.tg-chat-panel svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.tg-chat-panel {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 99991;
    display: none;
    width: min(420px, calc(100vw - 32px));
    height: min(680px, calc(100vh - 36px));
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22), 0 8px 22px rgba(15, 23, 42, 0.12);
    color: #111827;
    font-family: "Open Sans", Arial, sans-serif;
}

.tg-chat-panel.tg-chat-panel-open {
    display: flex;
    flex-direction: column;
}

.tg-chat-popup-mode .tg-chat-panel {
    top: 50%;
    right: auto;
    bottom: auto;
    left: 50%;
    width: min(440px, calc(100vw - 32px));
    height: min(680px, calc(100vh - 48px));
    transform: translate(-50%, -50%);
}

body.tg-chat-popup-open {
    overflow: hidden;
}

.tg-chat-standalone-page {
    margin: 0;
    overflow: hidden;
    background: #f8fafc;
}

.tg-chat-standalone-mode .tg-chat-launcher,
.tg-chat-standalone-mode .tg-chat-backdrop,
.tg-chat-standalone-mode .tg-chat-popout {
    display: none;
}

.tg-chat-standalone-mode .tg-chat-panel {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.tg-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    background: #007aff;
    color: #fff;
}

.tg-chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.tg-chat-title-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    flex: 0 0 38px;
    box-sizing: border-box;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.16);
}

.tg-chat-title-avatar {
    background: #0f172a;
    color: #fff;
    font-size: 17px;
    line-height: 1;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.tg-chat-title-avatar-image {
    overflow: hidden;
    background: #fff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
}

.tg-chat-title-avatar-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tg-chat-title strong {
    display: block;
    overflow: hidden;
    max-width: 210px;
    font-size: 17px;
    line-height: 21px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tg-chat-status {
    display: block;
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 11px;
    font-weight: 700;
}

.tg-chat-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.tg-chat-close,
.tg-chat-popout,
.tg-chat-back,
.tg-chat-end {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
}

.tg-chat-close,
.tg-chat-popout,
.tg-chat-back {
    width: 36px;
}

.tg-chat-end {
    gap: 6px;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 800;
}

.tg-chat-close:hover,
.tg-chat-popout:hover,
.tg-chat-back:hover,
.tg-chat-end:hover {
    background: rgba(255, 255, 255, 0.22);
}

.tg-chat-end:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.tg-chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 18px 16px;
    background: #f8fafc;
}

.tg-chat-messages-overview,
.tg-chat-messages-waiting {
    background: #f8fafc;
}

.tg-chat-empty,
.tg-chat-error,
.tg-chat-ended,
.tg-chat-loading {
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
}

.tg-chat-error {
    border-color: #fecaca;
    color: #b91c1c;
    background: #fff7f7;
}

.tg-chat-ended {
    border-color: #bfdbfe;
    color: #1d4ed8;
    background: #eff6ff;
}

.tg-chat-start {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px;
    padding: 4px 2px 14px;
    border-bottom: 1px solid #eef2f7;
    background: #fff;
}

.tg-chat-start-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    flex: 0 0 36px;
    box-sizing: border-box;
    border-radius: 12px;
    background: #eef6ff;
    color: #007aff;
}

.tg-chat-start-copy strong {
    display: block;
    color: #0f172a;
    font-size: 20px;
    line-height: 26px;
    font-weight: 800;
}

.tg-chat-start-copy p {
    margin: 6px 0 0;
    color: #475569;
    font-size: 13px;
    line-height: 20px;
    font-weight: 600;
}

.tg-chat-start-hint {
    grid-column: 1 / -1;
    margin-top: 2px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: #64748b;
    font-size: 12px;
    line-height: 18px;
    font-weight: 700;
}

.tg-chat-waiting {
    display: grid;
    justify-items: center;
    gap: 16px;
    width: 100%;
    padding: 18px 8px;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
}

.tg-chat-waiting-top {
    display: grid;
    justify-items: center;
    gap: 14px;
    width: 100%;
    text-align: center;
}

.tg-chat-waiting-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    min-width: 72px;
    min-height: 72px;
    flex: 0 0 72px;
    box-sizing: border-box;
    border-radius: 24px;
    background: #eef6ff;
    color: #007aff;
}

.tg-chat-waiting-icon svg {
    width: 30px;
    height: 30px;
}

.tg-chat-waiting-dots {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 12px;
}

.tg-chat-waiting-dots span {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #007aff;
    opacity: 0.28;
    animation: tg-chat-waiting-bounce 1.2s ease-in-out infinite;
}

.tg-chat-waiting-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.tg-chat-waiting-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes tg-chat-waiting-bounce {
    0%,
    80%,
    100% {
        opacity: 0.28;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

.tg-chat-waiting-copy strong {
    display: block;
    color: #0f172a;
    font-size: 19px;
    line-height: 25px;
    font-weight: 800;
}

.tg-chat-waiting-copy p {
    max-width: 300px;
    margin: 7px auto 0;
    color: #475569;
    font-size: 13px;
    line-height: 20px;
    font-weight: 600;
}

.tg-chat-waiting-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 0;
    border-top: 1px solid #eef2f7;
    border-bottom: 1px solid #eef2f7;
    border-radius: 0;
    background: transparent;
    color: #475569;
    font-size: 13px;
    line-height: 19px;
    font-weight: 700;
}

.tg-chat-waiting-meta strong {
    color: #0f172a;
    font-size: 15px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.tg-chat-waiting-message {
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.tg-chat-waiting-message span {
    display: block;
    margin-bottom: 7px;
    color: #64748b;
    font-size: 11px;
    line-height: 16px;
    font-weight: 800;
}

.tg-chat-waiting-message p {
    margin: 0;
    padding: 11px 13px;
    border-radius: 14px;
    background: #f8fafc;
    color: #1f2937;
    font-size: 13px;
    line-height: 19px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.tg-chat-overview {
    display: grid;
    gap: 14px;
}

.tg-chat-overview-hero {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px;
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.tg-chat-overview-new {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 52px;
    padding: 13px 16px;
    border: 0;
    border-radius: 12px;
    background: #007aff;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    line-height: 18px;
    font-weight: 700;
    box-shadow: 0 12px 24px rgba(0, 122, 255, 0.2);
}

.tg-chat-overview-new:hover {
    background: #006ee6;
}

.tg-chat-email-action {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #fed7aa;
    border-radius: 12px;
    background: #fff;
    color: #c2410c;
    font-size: 13px;
    line-height: 18px;
    font-weight: 700;
    text-decoration: none;
}

.tg-chat-email-action:hover {
    border-color: #fdba74;
    background: #fff7ed;
    color: #9a3412;
    text-decoration: none;
}

.tg-chat-email-action svg {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
}

.tg-chat-wait-estimate {
    grid-column: 1 / -1;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    max-width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #475569;
    font-size: 12px;
    line-height: 16px;
    font-weight: 700;
}

.tg-chat-wait-estimate svg {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
}

.tg-chat-wait-estimate-busy {
    color: #c2410c;
}

.tg-chat-overview-list {
    display: grid;
    gap: 10px;
    grid-column: 1 / -1;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.tg-chat-overview-list > strong {
    color: #0f172a;
    font-size: 13px;
    line-height: 18px;
    font-weight: 700;
}

.tg-chat-overview-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #111827;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.tg-chat-overview-item:hover {
    border-color: #bfdbfe;
    background: #f8fbff;
}

.tg-chat-overview-active-list {
    margin-top: 2px;
}

.tg-chat-overview-item-active {
    border: 1px solid #dbeafe;
    background: #f8fbff;
}

.tg-chat-overview-item-active:hover {
    border-color: #bfdbfe;
    background: #f8fbff;
}

.tg-chat-overview-item-main {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.tg-chat-overview-item-main strong {
    overflow: hidden;
    color: #0f172a;
    font-size: 13px;
    line-height: 18px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tg-chat-overview-item-main small {
    color: #64748b;
    font-size: 11px;
    line-height: 16px;
    font-weight: 400;
}

.tg-chat-overview-badge {
    flex: 0 0 auto;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 10px;
    line-height: 14px;
    font-weight: 700;
}

.tg-chat-overview-badge-active {
    background: #dcfce7;
    color: #15803d;
}

.tg-chat-overview-badge-closed {
    background: #e2e8f0;
    color: #475569;
}

.tg-chat-overview-empty {
    padding: 12px 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #64748b;
    font-size: 12px;
    line-height: 18px;
    font-weight: 400;
    text-align: left;
}

.tg-chat-overview-hero .tg-chat-closed {
    margin-bottom: 0;
    box-shadow: none;
}

.tg-chat-closed {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 14px;
    padding: 18px;
    margin-bottom: 14px;
    border: 1px solid #fed7aa;
    border-radius: 16px;
    background: linear-gradient(180deg, #fff 0%, #fff7ed 100%);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06);
}

.tg-chat-closed-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    flex: 0 0 42px;
    box-sizing: border-box;
    border-radius: 14px;
    background: #f97316;
    color: #fff;
    box-shadow: 0 10px 20px rgba(249, 115, 22, 0.18);
}

.tg-chat-closed-copy strong,
.tg-chat-hours strong {
    display: block;
    color: #0f172a;
    font-size: 15px;
    line-height: 21px;
    font-weight: 800;
}

.tg-chat-closed-copy p {
    margin: 7px 0 0;
    color: #475569;
    font-size: 13px;
    line-height: 20px;
    font-weight: 600;
}

.tg-chat-hours {
    display: grid;
    grid-column: 1 / -1;
    gap: 0;
    overflow: hidden;
    border: 1px solid #ffedd5;
    border-radius: 12px;
    background: #fff;
}

.tg-chat-hours-table {
    display: grid;
    overflow: hidden;
    border: 1px solid #ffedd5;
    border-radius: 12px;
    background: #fff;
}

.tg-chat-hours-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-bottom: 1px solid #fff7ed;
    color: #111827;
    font-size: 12px;
    line-height: 18px;
    font-weight: 400;
}

.tg-chat-hours-row:last-child {
    border-bottom: 0;
}

.tg-chat-hours-row > span:first-child {
    font-weight: 700;
}

.tg-chat-hours-row-today {
    background: #f8fbff;
}

.tg-chat-hours-open {
    color: #111827;
    white-space: nowrap;
}

.tg-chat-hours-closed {
    color: #ef4444;
    font-weight: 600;
    white-space: nowrap;
}

.tg-chat-rating {
    display: grid;
    gap: 14px;
    padding: 16px;
    margin-bottom: 14px;
    border: 1px solid #dbeafe;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06);
}

.tg-chat-rating-copy strong {
    display: block;
    color: #0f172a;
    font-size: 15px;
    line-height: 21px;
    font-weight: 800;
}

.tg-chat-rating-copy p {
    margin: 6px 0 0;
    color: #475569;
    font-size: 12px;
    line-height: 18px;
    font-weight: 600;
}

.tg-chat-rating-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.tg-chat-rating-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 10px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    line-height: 16px;
    font-weight: 800;
}

.tg-chat-rating-actions button:hover {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
}

.tg-chat-rating-actions button:disabled {
    cursor: default;
}

.tg-chat-rating-actions .tg-chat-rating-active {
    border-color: #22c55e;
    background: #f0fdf4;
    color: #15803d;
}

.tg-chat-rating-actions .tg-chat-rating-negative-active {
    border-color: #f87171;
    background: #fef2f2;
    color: #b91c1c;
}

.tg-chat-message {
    display: flex;
    margin-bottom: 14px;
}

.tg-chat-message-user {
    justify-content: flex-end;
}

.tg-chat-bubble {
    max-width: 82%;
    padding: 10px 12px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #1f2937;
    font-size: 13px;
    line-height: 19px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.tg-chat-message-user .tg-chat-bubble {
    border-color: #007aff;
    background: #007aff;
    color: #fff;
}

.tg-chat-bubble-large-emoji {
    padding: 10px 14px;
    font-size: 38px;
    line-height: 1.12;
}

.tg-chat-message-user .tg-chat-bubble-large-emoji {
    border-color: #007aff;
    background: #007aff;
    color: #fff;
}

.tg-chat-bubble-has-image {
    width: 100%;
    max-width: 100%;
    padding: 6px;
}

.tg-chat-message-attachments {
    display: grid;
    gap: 7px;
    margin-top: 7px;
}

.tg-chat-message-attachments:first-child {
    margin-top: 0;
}

.tg-chat-message-attachments a {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    color: inherit;
    font-weight: 800;
    text-decoration: none;
}

.tg-chat-message-attachments svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.tg-chat-message-attachments span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tg-chat-message-attachment-image {
    display: grid;
    gap: 6px;
    width: 100%;
}

.tg-chat-message-attachment-image img {
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: 360px;
    object-fit: cover;
    border-radius: 10px;
}

.tg-chat-popup-mode .tg-chat-bubble-has-image,
.tg-chat-standalone-mode .tg-chat-bubble-has-image {
    width: min(100%, 360px);
    max-width: 82%;
}

.tg-chat-popup-mode .tg-chat-message-attachment-image img,
.tg-chat-standalone-mode .tg-chat-message-attachment-image img {
    max-height: 280px;
    object-fit: contain;
    background: #f8fafc;
}

.tg-chat-message-typing .tg-chat-bubble {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: auto;
    min-width: 54px;
    padding: 12px 14px;
}

.tg-chat-message-typing .tg-chat-bubble span {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #94a3b8;
    animation: tg-chat-typing-dot 1.1s infinite ease-in-out;
}

.tg-chat-message-typing .tg-chat-bubble span:nth-child(2) {
    animation-delay: 0.15s;
}

.tg-chat-message-typing .tg-chat-bubble span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes tg-chat-typing-dot {
    0%,
    80%,
    100% {
        opacity: 0.35;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

.tg-chat-message-closed-by-agent .tg-chat-bubble {
    width: 100%;
    max-width: 100%;
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
}

.tg-chat-bubble-title,
.tg-chat-bubble-text {
    display: block;
}

.tg-chat-bubble-title {
    margin-bottom: 5px;
    color: #172554;
    font-weight: 800;
}

.tg-chat-bubble-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 40px;
    margin-top: 10px;
    padding: 8px 10px;
    border: 0;
    border-radius: 11px;
    background: #007aff;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    line-height: 16px;
    font-weight: 800;
}

.tg-chat-bubble-action:hover {
    background: #006ee6;
}

.tg-chat-bubble-action:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.tg-chat-meta {
    display: block;
    margin-top: 5px;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 700;
}

.tg-chat-message-user .tg-chat-meta {
    color: rgba(255, 255, 255, 0.72);
}

.tg-chat-system-notice {
    margin: 0 0 14px;
    text-align: center;
}

.tg-chat-system-notice span {
    display: inline-flex;
    max-width: 100%;
    padding: 7px 10px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 11px;
    line-height: 16px;
    font-weight: 800;
}

.tg-chat-form {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.tg-chat-attachments {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.tg-chat-attachment-pill,
.tg-chat-attachment-uploading {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    min-height: 30px;
    padding: 6px 9px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font: inherit;
    font-size: 11px;
    line-height: 15px;
    font-weight: 800;
}

.tg-chat-attachment-pill {
    cursor: pointer;
}

.tg-chat-attachment-pill span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tg-chat-attachment-pill svg {
    width: 13px;
    height: 13px;
    flex: 0 0 13px;
}

.tg-chat-attachment-uploading {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #c2410c;
}

.tg-chat-file {
    display: none;
}

.tg-chat-emoji {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 66px;
    z-index: 2;
    display: none;
    overflow: hidden;
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 16px 44px rgba(15, 23, 42, 0.18);
}

.tg-chat-emoji.tg-chat-emoji-open {
    display: block;
}

.tg-chat-emoji-search {
    width: calc(100% - 20px);
    margin: 10px;
    padding: 9px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    outline: none;
    color: #111827;
    font: inherit;
    font-size: 12px;
}

.tg-chat-emoji-search:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.08);
}

.tg-chat-emoji-cats {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0 10px 8px;
}

.tg-chat-emoji-cats button {
    flex: 0 0 auto;
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
}

.tg-chat-emoji-cats .tg-chat-emoji-cat-active {
    border-color: #007aff;
    background: #eff6ff;
    color: #007aff;
}

.tg-chat-emoji-list {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    max-height: 210px;
    overflow-y: auto;
    padding: 8px 10px 10px;
    border-top: 1px solid #eef2f7;
}

.tg-chat-emoji-list button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.tg-chat-emoji-list button:hover {
    background: #eff6ff;
}

.tg-chat-emoji-loading {
    grid-column: 1 / -1;
    padding: 18px 4px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.tg-chat-input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 42px;
    max-height: 112px;
    padding: 11px var(--tg-chat-input-action-padding, 84px) 11px 12px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    outline: none;
    resize: none;
    color: #111827;
    background: #fff;
    font: inherit;
    font-size: 13px;
    line-height: 18px;
}

.tg-chat-input:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.08);
}

.tg-chat-attach,
.tg-chat-emoji-toggle,
.tg-chat-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    background: #007aff;
    color: #fff;
    cursor: pointer;
}

.tg-chat-attach,
.tg-chat-emoji-toggle {
    position: absolute;
    bottom: 17px;
    z-index: 1;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: #f1f5f9;
    color: #475569;
}

.tg-chat-attach {
    right: var(--tg-chat-attach-right, 96px);
}

.tg-chat-emoji-toggle {
    right: var(--tg-chat-emoji-right, 62px);
}

.tg-chat-attach:hover,
.tg-chat-emoji-toggle:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.tg-chat-send:disabled,
.tg-chat-attach:disabled,
.tg-chat-emoji-toggle:disabled,
.tg-chat-input:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

html.dark .tg-chat-panel {
    border-color: #1e293b;
    background: #0f172a;
    color: #f8fafc;
}

html.dark .tg-chat-messages {
    background: #020617;
}

html.dark .tg-chat-messages-overview,
html.dark .tg-chat-messages-waiting {
    background: #0f172a;
}

html.dark .tg-chat-empty,
html.dark .tg-chat-ended,
html.dark .tg-chat-loading {
    border-color: #1e293b;
    background: #0f172a;
    color: #94a3b8;
}

html.dark .tg-chat-bubble {
    border-color: #1e293b;
    background: #111827;
    color: #e5e7eb;
}

html.dark .tg-chat-popup-mode .tg-chat-message-attachment-image img,
html.dark .tg-chat-standalone-mode .tg-chat-message-attachment-image img {
    background: #020617;
}

html.dark .tg-chat-attachment-pill {
    border-color: rgba(96, 165, 250, 0.35);
    background: rgba(96, 165, 250, 0.12);
    color: #93c5fd;
}

html.dark .tg-chat-attachment-uploading {
    border-color: rgba(251, 146, 60, 0.35);
    background: rgba(251, 146, 60, 0.12);
    color: #fdba74;
}

html.dark .tg-chat-message-typing .tg-chat-bubble span {
    background: #cbd5e1;
}

html.dark .tg-chat-message-closed-by-agent .tg-chat-bubble {
    border-color: #1d4ed8;
    background: rgba(96, 165, 250, 0.12);
    color: #dbeafe;
}

html.dark .tg-chat-bubble-title {
    color: #eff6ff;
}

html.dark .tg-chat-start {
    border-color: #1e293b;
    background: #0f172a;
}

html.dark .tg-chat-waiting-dots span {
    background: #93c5fd;
}

html.dark .tg-chat-waiting-meta {
    border-color: #1e293b;
    background: transparent;
    color: #94a3b8;
}

html.dark .tg-chat-waiting-meta strong {
    color: #f8fafc;
}

html.dark .tg-chat-waiting-message {
    background: transparent;
}

html.dark .tg-chat-waiting-message span {
    color: #93c5fd;
}

html.dark .tg-chat-waiting-message p {
    background: #111827;
    color: #dbeafe;
}

html.dark .tg-chat-system-notice span {
    background: rgba(14, 165, 233, 0.16);
    color: #7dd3fc;
}

html.dark .tg-chat-start-copy strong,
html.dark .tg-chat-waiting-copy strong {
    color: #f8fafc;
}

html.dark .tg-chat-start-copy p,
html.dark .tg-chat-waiting-copy p {
    color: #cbd5e1;
}

html.dark .tg-chat-start-hint {
    color: #94a3b8;
}

html.dark .tg-chat-overview-hero {
    border-color: #1e293b;
    background: #0f172a;
}

html.dark .tg-chat-wait-estimate {
    color: #93c5fd;
}

html.dark .tg-chat-wait-estimate-busy {
    color: #fdba74;
}

html.dark .tg-chat-overview-list > strong,
html.dark .tg-chat-overview-item-main strong {
    color: #f8fafc;
}

html.dark .tg-chat-overview-item {
    border-color: #1e293b;
    background: #0f172a;
    color: #f8fafc;
}

html.dark .tg-chat-overview-item:hover {
    border-color: #334155;
    background: #111827;
}

html.dark .tg-chat-overview-item-active {
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.1);
}

html.dark .tg-chat-overview-item-active:hover {
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.14);
}

html.dark .tg-chat-overview-item-main small {
    color: #94a3b8;
}

html.dark .tg-chat-overview-badge-active {
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
}

html.dark .tg-chat-overview-badge-closed {
    background: #1e293b;
    color: #cbd5e1;
}

html.dark .tg-chat-overview-empty {
    border-color: #334155;
    background: rgba(15, 23, 42, 0.72);
    color: #94a3b8;
}

html.dark .tg-chat-closed {
    border-color: rgba(249, 115, 22, 0.34);
    background: linear-gradient(180deg, #0f172a 0%, #1c1917 100%);
}

html.dark .tg-chat-closed-copy strong,
html.dark .tg-chat-hours strong {
    color: #f8fafc;
}

html.dark .tg-chat-closed-copy p {
    color: #cbd5e1;
}

html.dark .tg-chat-email-action {
    border-color: rgba(249, 115, 22, 0.34);
    background: #111827;
    color: #fdba74;
}

html.dark .tg-chat-email-action:hover {
    border-color: rgba(251, 146, 60, 0.62);
    background: rgba(249, 115, 22, 0.12);
    color: #fed7aa;
}

html.dark .tg-chat-hours-table {
    border-color: rgba(249, 115, 22, 0.24);
    background: #0f172a;
}

html.dark .tg-chat-hours {
    border-color: rgba(249, 115, 22, 0.24);
    background: #0f172a;
}

html.dark .tg-chat-hours-row {
    border-color: rgba(249, 115, 22, 0.12);
    color: #cbd5e1;
}

html.dark .tg-chat-hours-row-today {
    background: rgba(96, 165, 250, 0.08);
}

html.dark .tg-chat-hours-open {
    color: #cbd5e1;
}

html.dark .tg-chat-rating {
    border-color: #1e293b;
    background: #0f172a;
}

html.dark .tg-chat-rating-copy strong {
    color: #f8fafc;
}

html.dark .tg-chat-rating-copy p {
    color: #cbd5e1;
}

html.dark .tg-chat-rating-actions button {
    border-color: #334155;
    background: #111827;
    color: #cbd5e1;
}

html.dark .tg-chat-rating-actions button:hover {
    border-color: #60a5fa;
    background: rgba(96, 165, 250, 0.12);
    color: #93c5fd;
}

html.dark .tg-chat-rating-actions .tg-chat-rating-active {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
}

html.dark .tg-chat-rating-actions .tg-chat-rating-negative-active {
    border-color: #f87171;
    background: rgba(248, 113, 113, 0.12);
    color: #fca5a5;
}

html.dark .tg-chat-form {
    border-color: #1e293b;
    background: #0f172a;
}

html.dark .tg-chat-emoji {
    border-color: #334155;
    background: #0f172a;
}

html.dark .tg-chat-emoji-search {
    border-color: #334155;
    background: #020617;
    color: #f8fafc;
}

html.dark .tg-chat-emoji-cats button {
    border-color: #334155;
    background: #111827;
    color: #cbd5e1;
}

html.dark .tg-chat-emoji-cats .tg-chat-emoji-cat-active {
    border-color: #60a5fa;
    background: rgba(96, 165, 250, 0.12);
    color: #93c5fd;
}

html.dark .tg-chat-emoji-list {
    border-color: #1e293b;
}

html.dark .tg-chat-emoji-list button:hover,
html.dark .tg-chat-emoji-toggle {
    background: #111827;
    color: #cbd5e1;
}

html.dark .tg-chat-input {
    border-color: #334155;
    background: #020617;
    color: #f8fafc;
}

html.dark .tg-chat-attach,
html.dark .tg-chat-emoji-toggle {
    background: #1e293b;
    color: #cbd5e1;
}

@media (max-width: 520px) {
    .tg-chat-launcher {
        right: 14px;
        bottom: 14px;
    }

    .tg-chat-panel {
        inset: 0;
        width: auto;
        height: auto;
        border: 0;
        border-radius: 0;
    }

    .tg-chat-end {
        width: 36px;
        padding: 0;
    }

    .tg-chat-end span {
        display: none;
    }

    .tg-chat-start,
    .tg-chat-overview-hero {
        grid-template-columns: 36px minmax(0, 1fr);
        gap: 12px;
        padding: 14px;
    }

    .tg-chat-overview {
        gap: 12px;
    }

    .tg-chat-start-copy strong {
        font-size: 17px;
        line-height: 23px;
    }

    .tg-chat-start-copy p {
        font-size: 12px;
        line-height: 19px;
    }

    .tg-chat-overview-new {
        min-height: 48px;
        padding: 12px;
    }

    .tg-chat-overview-list {
        gap: 8px;
        padding: 0;
    }

    .tg-chat-overview-item {
        align-items: flex-start;
        gap: 10px;
        padding: 11px;
    }

    .tg-chat-overview-item-main strong {
        white-space: normal;
    }

    .tg-chat-overview-badge {
        margin-top: 1px;
        padding: 4px 7px;
    }

    .tg-chat-closed {
        grid-template-columns: 42px minmax(0, 1fr);
        gap: 12px;
        padding: 16px;
    }

    .tg-chat-title-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        flex-basis: 36px;
    }

    .tg-chat-start-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        flex-basis: 36px;
    }

    .tg-chat-closed-icon {
        width: 42px;
        height: 42px;
        min-width: 42px;
        min-height: 42px;
        flex-basis: 42px;
    }

    .tg-chat-emoji-list {
        grid-template-columns: repeat(7, 1fr);
    }

    body.tg-chat-open {
        overflow: hidden;
    }
}
