.nt-chat {
    --nt-chat-bottom: 82px;
    --nt-chat-right: 20px;
    position: fixed;
    right: var(--nt-chat-right);
    bottom: max(var(--nt-chat-bottom), calc(78px + env(safe-area-inset-bottom, 0px)));
    z-index: 1000000;
    color: #24334a;
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
}
.nt-chat [hidden] { display: none !important; }
.nt-chat button { margin: 0; min-height: 0; text-transform: none; letter-spacing: normal; font-weight: 600; line-height: 1.4; }
.nt-chat__toggle {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    min-width: 94px; height: 48px; padding: 0 15px;
    border: 1px solid #0a8d88; border-radius: 24px; background: #087f7a; color: #fff;
    box-shadow: 0 5px 18px #123d3a29; cursor: pointer;
}
.nt-chat__toggle:hover, .nt-chat__toggle:focus-visible { background: #056762; color: #fff; }
.nt-chat button:focus-visible, .nt-chat a:focus-visible, .nt-chat textarea:focus-visible { outline: 3px solid #55c9c3; outline-offset: 3px; }
.nt-chat__panel {
    position: absolute; right: 0; bottom: 60px; width: 360px;
    height: 500px; max-height: calc(100dvh - var(--nt-chat-bottom) - 85px);
    display: flex; flex-direction: column; overflow: hidden;
    border: 1px solid #dce7e9; border-radius: 18px; background: #fff;
    box-shadow: 0 12px 44px #102d3c29;
}
.nt-chat__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 19px 17px 16px; background: #087f7a; color: #fff; }
.nt-chat__header h2 { margin: 0 0 4px; color: inherit; font-size: 18px; line-height: 1.3; }
.nt-chat__header p { margin: 0; color: #d2f2ef; font-size: 12px; }
.nt-chat .nt-chat__close { padding: 0; border: 0; border-radius: 50%; width: 32px; height: 32px; background: #ffffff1c; color: #fff; font-size: 25px; font-weight: 400; flex-shrink: 0; }
.nt-chat__messages { flex: 1; min-height: 65px; overflow-y: auto; overscroll-behavior: contain; padding: 18px 14px; background: #f4f8f9; scrollbar-width: thin; }
.nt-chat__empty { text-align: center; margin: 35px 10px; color: #6c7b88; }
.nt-chat__empty strong { display: block; color: #354a5e; font-size: 15px; margin-bottom: 6px; }
.nt-chat__message { margin-bottom: 15px; max-width: 90%; }
.nt-chat__message:last-child { margin-bottom: 0; }
.nt-chat__message.is-mine { margin-left: auto; }
.nt-chat__meta { display: flex; align-items: center; gap: 8px; padding: 0 3px 4px; color: #71808b; font-size: 11px; }
.nt-chat__meta strong { color: #3d5266; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.nt-chat__meta time { margin-left: auto; white-space: nowrap; }
.nt-chat__avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: 0 0 28px; overflow: hidden; border-radius: 50%; background: #d5eae7; color: #24625b; font-size: 12px; font-weight: 700; }
.nt-chat__avatar img { position: absolute; inset: 0; width: 28px; height: 28px; object-fit: cover; border-radius: inherit; }
.nt-chat__admin { padding: 1px 5px; border-radius: 4px; background: #dff3ee; color: #126554; font-size: 9px; font-weight: 700; flex-shrink: 0; }
.nt-chat__meta strong { min-width: 0; }
.nt-chat__body { margin: 0; padding: 10px 12px; border: 1px solid #e1e9ec; border-radius: 0 12px 12px; background: #fff; color: #26384a; white-space: pre-wrap; overflow-wrap: anywhere; }
.nt-chat__text { margin: 0; }
.nt-chat__text a { color: #087f7a; text-decoration: underline; }
.nt-chat__photo { display: block; width: auto; max-width: 100%; height: auto; max-height: 220px; object-fit: contain; border-radius: 8px; margin-top: 6px; }
.nt-chat__story { display: flex; align-items: center; gap: 10px; padding: 10px; margin-top: 6px; border: 1px solid #cde2df; border-radius: 9px; background: #eff8f5; color: #24564e; white-space: normal; }
.nt-chat__story > span:first-child { font-size: 29px; }
.nt-chat__story strong, .nt-chat__story small { display: block; }
.nt-chat__story strong { font-size: 12px; line-height: 1.4; }
.nt-chat__story small { font-size: 11px; color: #6a8179; margin-top: 3px; }
.nt-chat__tools { display: flex; align-items: center; gap: 5px; margin: -4px 0 9px; }
.nt-chat .nt-chat__form .nt-chat__tools button { padding: 5px 8px; background: #eef5f4; color: #3e6f68; border-radius: 7px; font-size: 11px; }
.nt-chat .nt-chat__form .nt-chat__tools .nt-chat__emoji-toggle { font-size: 20px; padding: 0 7px; }
.nt-chat__emojis { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; margin: 0 0 9px; padding: 6px; border-radius: 9px; background: #f2f6f7; }
.nt-chat .nt-chat__emojis button { background: transparent; border: 0; font-size: 22px; padding: 3px; line-height: 1.2; }
.nt-chat__attachments { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.nt-chat__pending-image { position: relative; flex-shrink: 0; }
.nt-chat__pending-image img { display: block; width: 60px; height: 60px; object-fit: cover; border-radius: 8px; }
.nt-chat__pending-story { display: flex; flex: 1; align-items: center; min-width: 0; }
.nt-chat__pending-story .nt-chat__story { flex: 1; min-width: 0; margin: 0; padding: 6px; }
.nt-chat__pending-story .nt-chat__story > span:first-child { font-size: 20px; }
.nt-chat .nt-chat__attachments button { padding: 0; width: 22px; height: 22px; min-width: 22px; border-radius: 50%; background: #e7eeed; color: #3e5650; font-size: 17px; }
.nt-chat__pending-image button { position: absolute; right: -6px; top: -6px; }
.nt-chat__message.is-mine .nt-chat__body { background: #ddf4ef; border-color: #cce9e3; border-radius: 12px 0 12px 12px; }
.nt-chat .nt-chat__delete { padding: 0 3px; border: 0; background: transparent; color: #8a5960; font-size: 11px; flex-shrink: 0; }
.nt-chat__status { flex-shrink: 0; margin: 0; padding: 0 14px; font-size: 12px; color: #8b4a28; background: #fff; }
.nt-chat__status:not(:empty) { padding-top: 9px; padding-bottom: 9px; }
.nt-chat__login { padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; border-top: 1px solid #e5edef; color: #687987; font-size: 13px; }
.nt-chat__login a { padding: 8px 22px; border-radius: 20px; background: #087f7a; color: #fff; font-weight: 600; }
.nt-chat__form { padding: 12px; margin: 0; border-top: 1px solid #e5edef; background: #fff; }
.nt-chat .nt-chat__form textarea { display: block; width: 100%; min-height: 65px; max-height: 130px; resize: vertical; margin: 0 0 10px; border: 1px solid #d6e3e6; border-radius: 10px; padding: 9px 11px; box-shadow: none; font-size: 14px; background: #fff; color: #26384a; }
.nt-chat__form-bottom { display: flex; align-items: center; gap: 12px; }
.nt-chat__form-bottom > span { color: #86939d; font-size: 10px; flex: 1; }
.nt-chat .nt-chat__form button { padding: 8px 16px; border: 0; border-radius: 18px; background: #087f7a; color: #fff; font-size: 13px; }
.nt-chat button:disabled { opacity: .55; cursor: wait; }
@media (max-width: 549px) {
    .nt-chat { --nt-chat-right: 15px; }
    .nt-chat__panel { width: min(360px, calc(100vw - 30px)); height: 460px; border-radius: 15px; }
    .nt-chat__toggle { min-width: 84px; height: 46px; padding: 0 12px; }
}
@media (max-height: 600px) {
    .nt-chat__header { padding: 11px 14px; }
    .nt-chat__messages { min-height: 30px; padding: 10px; }
    .nt-chat__form { padding: 8px; }
    .nt-chat .nt-chat__form textarea { min-height: 44px; }
    .nt-chat__emojis { max-height: 76px; overflow-y: auto; }
}
