* { box-sizing: border-box; }
body { margin: 0; font-family: 'Roboto', system-ui, -apple-system, sans-serif; background: #f5f7fb; color: #0f172a; }

.rtd-chat {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: 100vh;
    background: #fff;
    max-width: 1200px;
    margin: 0 auto;
    box-shadow: 0 0 30px rgba(0,0,0,.06);
}

.rtd-chat__list { border-right: 1px solid #e2e8f0; display: flex; flex-direction: column; background: #fafbfc; min-height: 0; }
.rtd-chat__list-head { padding: 16px; border-bottom: 1px solid #e2e8f0; background: #fff; display: flex; align-items: center; gap: 10px; }
.rtd-chat__list-head h1 { margin: 0; font-size: 18px; font-weight: 700; }
.rtd-chat__home { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 4px 8px; border-radius: 8px; background: transparent; text-decoration: none; transition: background .15s; }
.rtd-chat__home img { height: 28px; width: auto; display: block; }
.rtd-chat__home:hover { background: #f1f5f9; }
.rtd-chat__list-items { flex: 1; overflow-y: auto; }

.rtd-chat__item { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: background .1s; }
.rtd-chat__item:hover { background: #f1f5f9; }
.rtd-chat__item.is-active { background: #e0e7ff; }
.rtd-chat__item-top { display: flex; justify-content: space-between; align-items: baseline; }
.rtd-chat__item-name { font-weight: 600; font-size: 14px; color: #0f172a; }
.rtd-chat__item-time { font-size: 11px; color: #94a3b8; }
.rtd-chat__item-prop { font-size: 12px; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rtd-chat__item-last { font-size: 12px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rtd-chat__item-badge { display: inline-block; background: #2563eb; color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 10px; font-weight: 700; margin-left: 6px; }
.rtd-chat__empty { padding: 24px 16px; text-align: center; color: #94a3b8; font-size: 13px; }

.rtd-chat__panel { display: flex; flex-direction: column; min-height: 0; }
.rtd-chat__panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid #e2e8f0; background: #fff; }
.rtd-chat__back { background: none; border: none; font-size: 24px; cursor: pointer; color: #475569; display: none; padding: 0 4px; }
.rtd-chat__panel-info { flex: 1; min-width: 0; }
.rtd-chat__peer { font-weight: 600; font-size: 15px; }
.rtd-chat__prop { font-size: 12px; color: #2563eb; text-decoration: none; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rtd-chat__prop:hover { text-decoration: underline; }

.rtd-chat__messages { flex: 1; overflow-y: auto; padding: 16px 18px; background: #f8fafc; display: flex; flex-direction: column; gap: 6px; }
.rtd-chat__placeholder { margin: auto; color: #94a3b8; font-size: 14px; text-align: center; }

.rtd-msg { max-width: 75%; padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.4; word-wrap: break-word; position: relative; }
.rtd-msg__time { font-size: 10px; opacity: .7; margin-top: 3px; display: block; text-align: right; }
.rtd-msg--mine { background: #2563eb; color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.rtd-msg--peer { background: #fff; color: #0f172a; align-self: flex-start; border: 1px solid #e2e8f0; border-bottom-left-radius: 4px; }

.rtd-chat__input { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid #e2e8f0; background: #fff; }
.rtd-chat__input input { flex: 1; padding: 10px 14px; border: 1px solid #cbd5e1; border-radius: 22px; font-size: 14px; outline: none; transition: border-color .15s; }
.rtd-chat__input input:focus { border-color: #2563eb; }
.rtd-chat__send { background: #2563eb; color: #fff; border: none; border-radius: 50%; width: 40px; height: 40px; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.rtd-chat__send:hover { background: #1d4ed8; }
.rtd-chat__send:disabled { background: #94a3b8; cursor: not-allowed; }

@media (max-width: 720px) {
    .rtd-chat { grid-template-columns: 1fr; }
    .rtd-chat__list { display: flex; }
    .rtd-chat__panel { display: none; }
    .rtd-chat.is-open .rtd-chat__list { display: none; }
    .rtd-chat.is-open .rtd-chat__panel { display: flex; }
    .rtd-chat__back { display: block; }
}
