.sms-chat {
    display: flex;
    flex-direction: column;
    /*height: 100%;*/
    min-height: 420px;
    background: #f7f7fa;
    border: 1px solid #d9dbe2;
    border-radius: 6px;
    overflow: hidden;
    font-family: Arial, Helvetica, sans-serif;
    color: #2f3542;
}

.sms-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7ee;
}

.sms-chat__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.sms-chat__subtitle {
    margin: 2px 0 0;
    font-size: 12px;
    color: #7a8191;
}

.sms-chat__status {
    font-size: 12px;
    color: #7a8191;
    white-space: nowrap;
}

.sms-chat__body {
    position: relative;
    flex: 1 1 auto;
    min-height: 220px;
    background: #f4f5f8;
}

.sms-chat__messages {
    height: 100%;
    overflow-y: auto;
    padding: 14px;
    scroll-behavior: smooth;
}

.sms-chat__empty,
.sms-chat__loader,
.sms-chat__error {
    margin: 10px auto;
    max-width: 360px;
    text-align: center;
    font-size: 13px;
    line-height: 1.5;
    color: #7a8191;
}

.sms-chat__error {
    color: #b34747;
}

.sms-chat__day-separator {
    margin: 12px 0;
    text-align: center;
}

.sms-chat__day-separator span {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    color: #7a8191;
    background: #eceef4;
    border-radius: 999px;
}

.sms-chat__message-row {
    display: flex;
    margin-bottom: 10px;
}

.sms-chat__message-row--incoming {
    justify-content: flex-start;
}

.sms-chat__message-row--outgoing {
    justify-content: flex-end;
}

.sms-chat__message-row--system {
    justify-content: center;
}

.sms-chat__message {
    display: inline-flex;
    flex-direction: column;
    gap: 6px;
    max-width: min(78%, 560px);
    padding: 10px 12px;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(31, 41, 55, 0.06);
    word-break: break-word;
}

.sms-chat__message--incoming {
    background: #ffffff;
    border: 1px solid #e3e7ef;
    border-bottom-left-radius: 4px;
}

.sms-chat__message--outgoing {
    background: #e7f0ff;
    border: 1px solid #cfe0ff;
    border-bottom-right-radius: 4px;
}

.sms-chat__message--system {
    max-width: 90%;
    background: #f1f2f6;
    border: 1px dashed #d5d8e1;
    color: #5f6676;
}

.sms-chat__message-text {
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.sms-chat__message-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 11px;
    color: #7a8191;
}

.sms-chat__message-author {
    font-weight: 700;
    color: #4d5566;
}

.sms-chat__message-status {
    white-space: nowrap;
}

.sms-chat__new-indicator {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    display: none;
    padding: 8px 14px;
    border: none;
    border-radius: 999px;
    background: #4c84ff;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(76, 132, 255, 0.24);
}

.sms-chat__new-indicator.is-visible {
    display: inline-block;
}

.sms-chat__footer {
    padding: 12px;
    background: #ffffff;
    border-top: 1px solid #e5e7ee;
}

.sms-chat__compose {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.sms-chat__textarea {
    flex: 1 1 auto;
    min-height: 76px;
    max-height: 160px;
    padding: 10px 12px;
    border: 1px solid #d5dae6;
    border-radius: 8px;
    resize: vertical;
    font-size: 14px;
    line-height: 1.4;
    color: #2f3542;
    outline: none;
}

.sms-chat__textarea:focus {
    border-color: #7ea7ff;
    box-shadow: 0 0 0 3px rgba(126, 167, 255, 0.16);
}

.sms-chat__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 120px;
}

.sms-chat__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid #4c84ff;
    border-radius: 8px;
    background: #4c84ff;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.sms-chat__button:hover {
    opacity: 0.94;
}

.sms-chat__button:active {
    transform: translateY(1px);
}

.sms-chat__button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.sms-chat__button--secondary {
    border-color: #d5dae6;
    background: #ffffff;
    color: #4d5566;
}

.sms-chat__hint {
    margin-top: 8px;
    font-size: 11px;
    color: #7a8191;
}

@media (max-width: 820px) {
    .sms-chat__compose {
        flex-direction: column;
        align-items: stretch;
    }

    .sms-chat__actions {
        width: 100%;
        flex-direction: row;
    }

    .sms-chat__button {
        width: 100%;
    }

    .sms-chat__message {
        max-width: 90%;
    }
}

.sms-chat__templates {
    position: relative;
    width: 100%;
}

.sms-chat__templates-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 20;
    display: none;
    width: 320px;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    background: #ffffff;
    border: 1px solid #d5dae6;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(31, 41, 55, 0.16);
}

.sms-chat__templates-menu.is-open {
    display: block;
}

.sms-chat__templates-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    margin: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.sms-chat__templates-item:hover {
    background: #f4f7ff;
}

.sms-chat__templates-item-title {
    font-size: 13px;
    font-weight: 700;
    color: #2f3542;
    margin-bottom: 4px;
}

.sms-chat__templates-item-description {
    font-size: 11px;
    color: #7a8191;
    margin-bottom: 4px;
}

.sms-chat__templates-item-preview {
    font-size: 12px;
    color: #5f6676;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}

.sms-chat__templates-empty {
    padding: 10px 12px;
    font-size: 12px;
    color: #7a8191;
}

@media (max-width: 820px) {
    .sms-chat__templates-menu {
        left: 0;
        right: 0;
        bottom: calc(100% + 8px);
        width: 100%;
    }
}
