.ltcw-widget {
    position: fixed;
    right: 18px;
    bottom: 88px;
    z-index: 1400;
    font-family: 'Noto Sans Myanmar', sans-serif;
}

.ltcw-thread-list[hidden],
.ltcw-messages[hidden],
.ltcw-form[hidden],
.ltcw-back[hidden],
.ltcw-delete[hidden] {
    display: none !important;
}

.ltcw-head {
    width: 58px;
    height: 58px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #111827;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.22);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transform: translateX(0) scale(1);
    opacity: 1;
    pointer-events: auto;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.ltcw-head i {
    font-size: 1.2rem;
}

.ltcw-head:hover {
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.28);
}

.ltcw-head-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    border: 2px solid #ffffff;
    color: #ffffff;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    box-sizing: border-box;
}

.ltcw-head-dot.is-visible {
    display: inline-flex;
}

.ltcw-widget.is-visible .ltcw-head {
    transform: translateX(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.ltcw-widget.is-bounce-in .ltcw-head {
    animation: ltcw-head-slide-in 0.62s cubic-bezier(0.17, 0.89, 0.32, 1.32);
}

@keyframes ltcw-head-slide-in {
    0% {
        transform: translateX(120px) scale(0.75);
        opacity: 0;
    }
    70% {
        transform: translateX(-8px) scale(1.05);
        opacity: 1;
    }
    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.ltcw-box {
    width: min(360px, calc(100vw - 26px));
    height: min(520px, calc(100vh - 150px));
    margin-top: 12px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 22px 54px rgba(15, 23, 42, 0.24);
    overflow: hidden;
    display: none;
    grid-template-rows: auto 1fr auto;
}

.ltcw-widget.is-open .ltcw-box {
    display: grid;
}

.ltcw-box-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid #edf0f5;
    background: #ffffff;
}

.ltcw-avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #374151;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ltcw-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ltcw-meta strong {
    color: #111827;
    font-size: 0.95rem;
    line-height: 1.2;
}

.ltcw-meta span {
    color: #6b7280;
    font-size: 0.78rem;
}

.ltcw-close {
    margin-left: auto;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 0;
    background: #f3f4f6;
    color: #374151;
    cursor: pointer;
}

.ltcw-back {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 0;
    background: #f3f4f6;
    color: #374151;
    cursor: pointer;
}

.ltcw-delete {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 0;
    background: #fff1f2;
    color: #b91c1c;
    cursor: pointer;
}

.ltcw-thread-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 10px;
    border-bottom: 1px solid #edf0f5;
    background: #ffffff;
    min-height: 0;
}

.ltcw-thread-toolbar {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #ffffff;
    border: 1px solid #edf0f5;
    border-radius: 10px;
    padding: 8px;
    display: grid;
    gap: 7px;
}

.ltcw-thread-search {
    width: 100%;
    height: 34px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0 10px;
    font-size: 0.8rem;
    outline: none;
}

.ltcw-thread-search:focus {
    border-color: #9ca3af;
}

.ltcw-thread-filters {
    display: flex;
    gap: 6px;
}

.ltcw-filter-btn {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 0.72rem;
    cursor: pointer;
}

.ltcw-filter-btn.is-active {
    background: #111827;
    color: #ffffff;
    border-color: #111827;
}

.ltcw-thread-summary {
    color: #6b7280;
    font-size: 0.7rem;
}

.ltcw-thread-item {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.8rem;
    line-height: 1.25;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    text-align: left;
}

.ltcw-thread-item.is-active {
    background: #111827;
    color: #ffffff;
    border-color: #111827;
}

.ltcw-thread-unread {
    min-width: 17px;
    height: 17px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.67rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-sizing: border-box;
}

.ltcw-thread-main {
    min-width: 0;
}

.ltcw-thread-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ltcw-thread-title {
    font-weight: 700;
    margin-bottom: 2px;
}

.ltcw-thread-time {
    color: #6b7280;
    font-size: 0.68rem;
    white-space: nowrap;
}

.ltcw-thread-subject {
    display: block;
    font-size: 0.72rem;
    color: #4b5563;
    margin-bottom: 2px;
}

.ltcw-thread-preview {
    font-size: 0.72rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 230px;
}

.ltcw-thread-item.is-active .ltcw-thread-preview {
    color: rgba(255, 255, 255, 0.82);
}

.ltcw-thread-item.is-active .ltcw-thread-subject,
.ltcw-thread-item.is-active .ltcw-thread-time {
    color: rgba(255, 255, 255, 0.78);
}

.ltcw-messages {
    background: #ffffff;
    overflow-y: auto;
    padding: 12px 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ltcw-msg {
    max-width: 82%;
    border-radius: 14px;
    padding: 9px 11px;
    font-size: 0.88rem;
    line-height: 1.45;
    word-break: break-word;
}

.ltcw-msg-body {
    white-space: pre-wrap;
}

.ltcw-msg-body a {
    color: inherit;
    text-decoration: underline;
    word-break: break-all;
}

.ltcw-msg-body a.lt-link-btn {
    display: inline-block;
    margin: 4px 0;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid rgba(17, 24, 39, 0.2);
    background: #ffffff;
    color: #111827;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 700;
    word-break: normal;
}

.ltcw-msg.outgoing .ltcw-msg-body a.lt-link-btn {
    background: rgba(255, 255, 255, 0.96);
    color: #111827;
    border-color: rgba(255, 255, 255, 0.72);
}

.ltcw-msg-actions {
    margin-top: 6px;
    display: inline-flex;
    justify-content: flex-end;
}

.ltcw-msg-edit {
    border: 1px solid rgba(107, 114, 128, 0.35);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font-size: 0.72rem;
    padding: 2px 7px;
    cursor: pointer;
    opacity: 0.86;
}

.ltcw-msg-edit:hover {
    opacity: 1;
}

.ltcw-msg-meta {
    display: block;
    margin-top: 6px;
    font-size: 0.72rem;
    color: #6b7280;
}

.ltcw-msg-row {
    display: flex;
    align-items: flex-end;
    gap: 7px;
    align-self: flex-start;
    max-width: 90%;
}

.ltcw-sender-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #374151;
    color: #ffffff;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.ltcw-sender-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.ltcw-msg.incoming {
    background: #f3f4f6;
    color: #111827;
    border-bottom-left-radius: 6px;
}

.ltcw-msg.incoming.is-forecast-notice {
    background: #fff4cf;
    border: 1px solid #f3d98a;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.ltcw-msg.outgoing {
    align-self: flex-end;
    background: #111827;
    color: #ffffff;
    border-bottom-right-radius: 6px;
}

.ltcw-msg.outgoing .ltcw-msg-meta {
    color: rgba(255, 255, 255, 0.78);
}

.ltcw-empty {
    margin: auto 0;
    text-align: center;
    color: #6b7280;
    font-size: 0.88rem;
    padding: 16px;
}

.ltcw-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #edf0f5;
    background: #ffffff;
}

.ltcw-form input {
    border: 1px solid #d1d5db;
    background: #ffffff;
    border-radius: 999px;
    height: 38px;
    padding: 0 12px;
    font-size: 0.9rem;
    color: #111827;
    outline: none;
}

.ltcw-form input:focus {
    border-color: #9ca3af;
}

.ltcw-form button {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 0;
    background: #111827;
    color: #ffffff;
    cursor: pointer;
}

.ltcw-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    display: grid;
    place-items: center;
    z-index: 2000;
    padding: 16px;
}

.ltcw-confirm-overlay[hidden] {
    display: none !important;
}

.ltcw-confirm-dialog {
    width: min(330px, calc(100vw - 32px));
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 24px 54px rgba(15, 23, 42, 0.28);
    padding: 14px;
}

.ltcw-confirm-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #111827;
    margin-bottom: 8px;
}

.ltcw-confirm-message {
    color: #374151;
    font-size: 0.86rem;
    line-height: 1.45;
    margin-bottom: 12px;
}

.ltcw-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.ltcw-confirm-btn {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    border-radius: 8px;
    padding: 7px 11px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.ltcw-confirm-btn.is-danger {
    border-color: #ef4444;
    background: #fee2e2;
    color: #991b1b;
}

.ltcw-edit-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    display: grid;
    place-items: center;
    z-index: 2001;
    padding: 16px;
}

.ltcw-edit-overlay[hidden] {
    display: none !important;
}

.ltcw-edit-dialog {
    width: min(380px, calc(100vw - 32px));
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 24px 54px rgba(15, 23, 42, 0.28);
    padding: 14px;
}

.ltcw-edit-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #111827;
    margin-bottom: 8px;
}

.ltcw-edit-input {
    width: 100%;
    min-height: 88px;
    max-height: 180px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 0.86rem;
    color: #111827;
    resize: vertical;
    outline: none;
}

.ltcw-edit-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.ltcw-edit-btn {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    border-radius: 8px;
    padding: 7px 11px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.ltcw-edit-btn.is-primary {
    border-color: #111827;
    background: #111827;
    color: #ffffff;
}

@media (max-width: 768px) {
    .ltcw-widget {
        right: 12px;
        bottom: calc(76px + env(safe-area-inset-bottom));
    }

    .ltcw-box {
        width: min(340px, calc(100vw - 20px));
        height: min(500px, calc(100vh - 180px));
    }
}
