:root {
    --tlc-navy: #072342;
    --tlc-blue: #1269e8;
    --tlc-pale: #f3f6fa;
    --tlc-border: #dfe5ec;
    --tlc-text: #10233a;
}

#tlc-button {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99998;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 0;
    border-radius: 999px;
    padding: 14px 20px;
    background: var(--tlc-navy);
    color: #fff;
    font: 700 15px/1 system-ui, -apple-system, sans-serif;
    box-shadow: 0 10px 32px #071d3640;
    cursor: pointer;
    transition:
        transform 0.2s,
        box-shadow 0.2s;
}

#tlc-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px #071d3652;
}

.tlc-button-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #38cf83;
    box-shadow: 0 0 0 4px #38cf8326;
}

#tlc-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99999;
    display: grid;
    grid-template-rows: auto 1fr auto;
    width: min(390px, calc(100vw - 24px));
    height: min(620px, calc(100vh - 48px));
    overflow: hidden;
    border: 1px solid #ffffff66;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 70px #071d3650;
    color: var(--tlc-text);
    font:
        15px/1.45 system-ui,
        -apple-system,
        sans-serif;
}

#tlc-panel[hidden] {
    display: none;
}

#tlc-panel header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 0 20px;
    background: linear-gradient(
        135deg,
        var(--tlc-navy),
        #104a7e
    );
    color: #fff;
}

#tlc-panel header div {
    display: grid;
    gap: 2px;
}

#tlc-panel header strong {
    font-size: 17px;
}

#tlc-status {
    font-size: 12px;
    color: #dce8f4;
}

#tlc-status::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    border-radius: 50%;
    background: #9eabba;
}

#tlc-status.online::before {
    background: #38cf83;
}

#tlc-status.offline::before {
    background: #f5b544;
}

#tlc-close {
    border: 0;
    background: transparent;
    color: #fff;
    font: 300 30px/1 system-ui;
    cursor: pointer;
}

#tlc-log {
    overflow: auto;
    padding: 18px;
    background: var(--tlc-pale);
    scroll-behavior: smooth;
}

.tlc-welcome {
    display: grid;
    gap: 5px;
    margin: 0 0 18px;
    padding: 14px;
    border: 1px solid var(--tlc-border);
    border-radius: 14px;
    background: #fff;
}

.tlc-welcome strong {
    font-size: 16px;
}

.tlc-welcome span {
    color: #5f6f82;
    font-size: 13px;
}

.tlc-msg {
    display: grid;
    gap: 4px;
    width: fit-content;
    max-width: 82%;
    margin: 9px 0;
    padding: 10px 13px;
    border: 1px solid var(--tlc-border);
    border-radius: 14px 14px 14px 4px;
    background: #fff;
    box-shadow: 0 2px 8px #071d3608;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.tlc-msg.visitor {
    margin-left: auto;
    border-color: var(--tlc-blue);
    border-radius: 14px 14px 4px 14px;
    background: var(--tlc-blue);
    color: #fff;
}

.tlc-msg.system {
    max-width: 100%;
    border-color: #ffd5d5;
    background: #fff2f2;
    color: #9b1c1c;
}

.tlc-msg time {
    justify-self: end;
    font-size: 10px;
    opacity: 0.65;
}

#tlc-form {
    display: grid;
    gap: 9px;
    padding: 13px 14px 12px;
    border-top: 1px solid var(--tlc-border);
    background: #fff;
}

#tlc-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

#tlc-details.is-complete {
    display: none;
}

#tlc-form input,
#tlc-form textarea {
    box-sizing: border-box;
    width: 100%;
    border: 1px solid var(--tlc-border);
    border-radius: 10px;
    padding: 10px 11px;
    background: #fff;
    color: var(--tlc-text);
    font: inherit;
    outline: none;
}

#tlc-form input:focus,
#tlc-form textarea:focus {
    border-color: var(--tlc-blue);
    box-shadow: 0 0 0 3px #1269e81a;
}

.tlc-compose {
    display: grid;
    grid-template-columns: 1fr 44px;
    gap: 8px;
    align-items: end;
}

.tlc-compose textarea {
    height: 48px;
    min-height: 48px;
    max-height: 100px;
    resize: vertical;
}

.tlc-compose button {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 11px;
    background: var(--tlc-blue);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

.tlc-compose button:disabled {
    opacity: 0.55;
    cursor: wait;
}

#tlc-privacy {
    color: #7b8795;
    font-size: 10px;
    line-height: 1.35;
}

@media (max-width: 520px) {
    #tlc-button {
        right: 14px;
        bottom: 14px;
    }

    #tlc-panel {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
    }

    #tlc-details {
        grid-template-columns: 1fr;
    }
}