#tnpl-chat-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: #0d8364;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(13, 131, 100, 0.35);
    z-index: 999999;
    transition: transform 0.2s ease, background 0.2s ease;
}

#tnpl-chat-bubble:hover {
    transform: scale(1.06);
    background: #09684f;
}

#tnpl-chat-box {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 360px;
    height: 540px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: visible;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Header Section (Green) */
#tnpl-chat-header {
    background: #0d8364;
    color: #ffffff;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    position: relative;
    z-index: 10005;
}

.tnpl-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

#tnpl-chat-back {
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0.8;
}

.tnpl-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff;
    color: #0d8364;
    font-weight: 800;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.8);
    letter-spacing: -0.5px;
}

.tnpl-header-info {
    display: flex;
    flex-direction: column;
}

.tnpl-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.tnpl-subtitle {
    font-size: 11px;
    opacity: 0.85;
    margin-top: 2px;
}

.tnpl-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    background: rgba(255,255,255,0.28);
    transform: translateY(-1px);
}

#tnpl-chat-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    border: 1px solid rgba(255,255,255,0.16);
}

#tnpl-chat-menu:hover {
    background: rgba(255,255,255,0.30);
}

#tnpl-chat-menu {
    position: relative;
    z-index: 10004;
}

#tnpl-chat-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.16);
    transition: background 0.2s ease, transform 0.2s ease;
}

#tnpl-chat-close:hover {
    background: rgba(255,255,255,0.30);
}

.tnpl-dropdown-wrapper {
    position: relative;
    z-index: 10002;
}

.tnpl-menu-dropdown {
    position: absolute;
    right: 0;
    top: 54px;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.18);
    border: 1px solid rgba(0,0,0,0.08);
    min-width: 170px;
    z-index: 10003;
}

.tnpl-menu-item {
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 13px;
    color: #111827;
    cursor: pointer;
}

.tnpl-menu-item:hover {
    background: #f1f5f9;
}


/* Chat Messages Body */
#tnpl-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f8faf9;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tnpl-msg-group {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.tnpl-msg-group.bot {
    align-self: flex-start;
}

.tnpl-msg-group.user {
    align-self: flex-end;
}

.tnpl-sender-name {
    font-size: 11px;
    color: #718096;
    margin-bottom: 4px;
    padding-left: 2px;
}

.tnpl-msg-group.user .tnpl-sender-name {
    text-align: right;
    padding-right: 2px;
}

.tnpl-msg {
    position: relative;
    padding: 12px 14px 22px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
}

.tnpl-msg-bot {
    background: #f1f5f3;
    color: #2d3748;
    border-top-left-radius: 4px;
}

.tnpl-msg-user {
    background: #d6f2e8;
    color: #0d8364;
    border-top-right-radius: 4px;
}

.tnpl-msg-user a {
    color: #0d8364;
    text-decoration: underline;
    font-weight: 500;
}

.tnpl-msg-time {
    position: absolute;
    bottom: 4px;
    right: 10px;
    font-size: 10px;
    color: #a0aec0;
}

.tnpl-tab-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#tnpl-conv-list {
    flex: 1;
    overflow-y: auto;
    background: #ffffff;
}

.tnpl-conv-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f4f2;
    cursor: pointer;
    transition: background 0.15s ease;
}

.tnpl-conv-card:hover {
    background: #f7faf8;
}

.tnpl-conv-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e6f4ef;
    color: #0d8364;
    font-weight: 800;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tnpl-conv-details {
    flex: 1;
    min-width: 0;
}

.tnpl-conv-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.tnpl-conv-name {
    font-size: 14px;
    font-weight: 700;
    color: #2d3748;
}

.tnpl-conv-snippet {
    font-size: 12px;
    color: #718096;
    margin-bottom: 2px;
}

.tnpl-conv-lastmsg {
    font-size: 12px;
    color: #a0aec0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bottom Navigation Bar */
#tnpl-bottom-nav {
    display: flex;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
    padding: 6px 0;
}

.tnpl-nav-item {
    flex: 1;
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 0;
    cursor: pointer;
    color: #a0aec0;
    font-size: 11px;
    font-weight: 600;
    transition: color 0.15s ease;
}

.tnpl-nav-item.active {
    color: #0d8364;
}

.tnpl-nav-item svg {
    stroke: #a0aec0;
}

.tnpl-nav-item.active svg {
    stroke: #0d8364;
}

/* Input Row and Footer Container */
#tnpl-chat-input-container {
    background: #ffffff;
    border-top: 1px solid #edf2f7;
    padding: 10px 14px 8px 14px;
    box-sizing: border-box;
}

#tnpl-chat-input-row {
    display: flex !important;
    align-items: center !important;
    background: #f7faf8 !important;
    border: 1px solid #cbd5e0 !important;
    border-radius: 24px !important;
    padding: 4px 6px 4px 14px !important;
    box-shadow: none !important;
}

#tnpl-chat-input-row:focus-within {
    border-color: #0d8364 !important;
}

#tnpl-chat-input {
    flex: 1 !important;
    border: none !important;
    background: transparent !important;
    font-size: 13px !important;
    outline: none !important;
    color: #2d3748 !important;
    box-shadow: none !important;
    padding: 6px 0 !important;
    margin: 0 !important;
    height: auto !important;
    width: 100% !important;
}

#tnpl-chat-send {
    background: transparent !important;
    color: #0d8364 !important;
    border: none !important;
    padding: 6px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: none !important;
}

#tnpl-chat-send:hover {
    background: #e6f4ef !important;
}

#tnpl-chat-footer-note {
    text-align: center;
    font-size: 11px;
    color: #a0aec0;
    margin-top: 6px;
}

/* Inline "chat ended" system notice */
.tnpl-session-ended {
    text-align: center;
    font-size: 12px;
    color: #a0aec0;
    margin: 8px 0;
    line-height: 1.6;
}

.tnpl-session-ended .tnpl-session-restart {
    display: inline-block;
    margin-top: 4px;
    color: #0d8364 !important;
    font-weight: 600 !important;
    text-decoration: underline !important;
    cursor: pointer !important;
}

/* Loading Dots */
.tnpl-loading-dots span {
    animation: blink 1.4s infinite both;
    font-size: 18px;
    font-weight: bold;
}
.tnpl-loading-dots span:nth-child(2) { animation-delay: .2s; }
.tnpl-loading-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes blink {
    0% { opacity: .2; }
    20% { opacity: 1; }
    100% { opacity: .2; }
}


