@font-face {
    font-family: "Vazirmatn";
    src: url("/assets/Vazirmatn-Regular.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Vazirmatn";
    src: url("/assets/Vazirmatn-Bold.ttf") format("truetype");
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: "Font Awesome 6 Free Solid";
    src: url("/assets/fontawesome.woff2") format("woff2");
    font-style: normal;
    font-weight: normal;
    font-display: block;
}

.fa-icon {
    font-family: "Font Awesome 6 Free Solid", sans-serif;
    font-style: normal;
    font-weight: normal;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    font-family: "Vazirmatn", Tahoma, sans-serif;
    direction: rtl;
    background: #f1ede7;
    color: #1c1c21;
}

#root,
.app-root {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.messenger {
    display: flex;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.nav-rail {
    width: 84px;
    background: #f6f7f8;
    border-left: 1px solid #e0e2e8;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 12px 6px;
    flex-shrink: 0;
    min-height: 0;
}

.nav-rail-user {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.nav-rail-bar {
    display: flex;
    flex-direction: column;
    gap: 17px;
    align-items: stretch;
    flex: 1;
    min-height: 0;
}

.nav-rail-bar .nav-rail-item:last-child {
    margin-top: auto;
}

.nav-rail-top {
    display: none;
}

.nav-rail-items {
    display: none;
}

.nav-rail-spacer {
    display: none;
}

.nav-rail-item {
    width: 100%;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #8c8c94;
    cursor: pointer;
    padding: 7px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.nav-rail-item:hover {
    background: rgba(99, 102, 241, 0.08);
}

.nav-rail-item.active {
    background: rgba(99, 102, 241, 0.14);
    color: #6366f1;
}

.nav-rail-icon,
.nav-rail-item .fa-icon {
    font-size: 20px;
    line-height: 1;
}

.nav-rail-label {
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
}

.list-placeholder {
    padding: 40px 20px;
    text-align: center;
    color: #8c8c94;
}

.list-placeholder-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
    color: #c4c4cc;
}

.list-placeholder p {
    margin: 0;
    font-size: 14px;
}

.list-loading {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.list-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e0e2e8;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: list-spinner-spin 0.75s linear infinite;
}

@keyframes list-spinner-spin {
    to {
        transform: rotate(360deg);
    }
}

.settings-panel {
    --settings-bg: #f2f2f7;
    --settings-group-bg: #fff;
    --settings-divider: #e5e5ea;
    --settings-icon: #8e8e93;
    --settings-chevron: #c7c7cc;
    --settings-label: #1c1c1e;
    --settings-value: #8e8e93;
    --settings-subpanel-bg: #fff;
    background: var(--settings-bg);
    overflow: hidden;
}

.settings-panel .chat-header,
.settings-panel .settings-header {
    background: var(--settings-bg);
    border-bottom: none;
    box-shadow: none;
}

.settings-panel .chat-header .title p {
    display: none;
}

.settings-panel .settings-header .title h2 {
    font-size: 17px;
    font-weight: 600;
}

.settings-panel .settings-header {
    gap: 14px;
    justify-content: flex-start;
}

.settings-back-btn,
.chat-header-back {
    background: transparent;
    width: auto;
    height: auto;
    min-width: 0;
    padding: 6px 10px 6px 6px;
    margin-inline-end: 4px;
    border-radius: 0;
    color: #4f46e5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-back-btn:hover,
.chat-header-back:hover {
    background: transparent;
    color: #4338ca;
}

.settings-back-btn .fa-icon,
.chat-header-back .fa-icon {
    font-size: 22px;
    line-height: 1;
    color: inherit;
    -webkit-text-stroke: 0.35px currentColor;
}

.settings-panel .settings-body {
    flex: 1;
    min-height: 0;
    padding: 8px 16px 32px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 22px;
    background: var(--settings-bg);
}

.settings-panel .settings-body > .settings-group,
.settings-panel .settings-body > .settings-status,
.settings-panel .settings-body > .settings-logout-wrap {
    flex-shrink: 0;
}

.settings-status {
    background: #d9fdd3;
    color: #111b21;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.45;
}

.settings-group {
    background: var(--settings-group-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.04);
}

.settings-group + .settings-group {
    margin-top: 0;
}

.settings-profile-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px 18px;
}

.settings-profile-row {
    gap: 14px;
    min-height: 72px;
    padding: 10px 16px;
}

.settings-profile-row .settings-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    flex-shrink: 0;
}

.settings-profile-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: right;
}

.settings-profile-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--settings-label);
    line-height: 1.25;
}

.settings-profile-sub {
    font-size: 14px;
    color: var(--settings-value);
    direction: ltr;
    text-align: right;
    word-break: break-all;
}

.settings-avatar-btn {
    position: relative;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    align-self: center;
}

.settings-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
}

.settings-avatar--large {
    width: 96px;
    height: 96px;
}

.settings-avatar-edit {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent, #6366F1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
    pointer-events: none;
}

.settings-avatar-edit .fa-icon {
    font-size: 12px;
    line-height: 1;
}

.settings-file-input {
    display: none;
}

.settings-label {
    font-size: 13px;
    color: var(--settings-value);
}

.settings-input {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--settings-divider);
    border-radius: 0;
    padding: 8px 0;
    font: inherit;
    font-size: 16px;
    background: transparent;
    color: var(--settings-label);
}

.settings-input:focus {
    outline: none;
    border-bottom-color: #00a884;
}

.settings-mxid {
    margin: 0;
    font-size: 14px;
    color: var(--settings-value);
    direction: ltr;
    text-align: right;
    word-break: break-all;
}

.settings-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.settings-btn {
    border: 0;
    border-radius: 20px;
    padding: 8px 16px;
    background: #00a884;
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.settings-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.settings-btn-ghost {
    background: var(--settings-divider);
    color: var(--settings-label);
}

.settings-btn-danger {
    background: #ea0038;
    color: #fff;
}

.settings-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    min-height: 50px;
    border: none;
    background: var(--settings-group-bg);
    padding: 11px 16px;
    font: inherit;
    font-size: 17px;
    color: var(--settings-label);
    text-decoration: none;
    cursor: pointer;
    text-align: right;
}

.settings-item::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 56px;
    left: 16px;
    height: 0.5px;
    background: var(--settings-divider);
    pointer-events: none;
}

.settings-group > :last-child.settings-item::after,
.settings-group > :last-child:not(.settings-subpanel) .settings-item:last-child::after {
    display: none;
}

.settings-item:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.settings-item--static {
    cursor: default;
}

.settings-item--choice {
    cursor: default;
}

.settings-item--choice .settings-item-select {
    margin-inline-start: auto;
}

.settings-item-icon {
    flex-shrink: 0;
    width: 28px;
    text-align: center;
    font-size: 18px;
    font-weight: 400;
    color: var(--settings-icon);
    line-height: 1;
}

.settings-item-label {
    flex: 1;
    min-width: 0;
    font-weight: 400;
}

.settings-item-value {
    flex-shrink: 0;
    color: var(--settings-value);
    font-size: 15px;
    max-width: 42%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-item-badge {
    flex-shrink: 0;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: #8e8e93;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 22px;
    text-align: center;
}

.settings-item-chevron {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--settings-chevron);
    line-height: 1;
    opacity: 0.9;
}

.settings-item-select {
    flex-shrink: 0;
    max-width: 46%;
    border: none;
    background: transparent;
    color: var(--settings-value);
    font: inherit;
    font-size: 15px;
    text-align: left;
    direction: ltr;
    cursor: pointer;
    appearance: none;
    padding: 0 4px 0 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='12' viewBox='0 0 8 12'%3E%3Cpath fill='%23c7c7cc' d='M6.5 1L1.5 6l5 5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left center;
    padding-left: 14px;
}

.settings-switch {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    width: 51px;
    height: 31px;
    cursor: pointer;
}

.settings-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.settings-switch-slider {
    position: absolute;
    inset: 0;
    background: #e9e9ea;
    border-radius: 31px;
    transition: background 0.2s ease;
}

.settings-switch-slider::before {
    content: "";
    position: absolute;
    height: 27px;
    width: 27px;
    right: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease;
}

.settings-switch input:checked + .settings-switch-slider {
    background: #34c759;
}

.settings-switch input:checked + .settings-switch-slider::before {
    transform: translateX(-20px);
}

.settings-subpanel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 18px 14px;
    background: var(--settings-subpanel-bg);
}

.settings-subpanel--flat {
    padding: 16px 18px 18px;
}

.settings-device-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-device {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f2f2f7;
}

.settings-device-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--settings-label);
}

.settings-device-meta {
    font-size: 13px;
    color: var(--settings-value);
    margin-top: 2px;
    direction: ltr;
    text-align: right;
}

.settings-badge {
    font-size: 11px;
    font-weight: 500;
    background: #d9fdd3;
    color: #008069;
    border-radius: 999px;
    padding: 2px 8px;
}

.settings-logout-wrap {
    display: flex;
    justify-content: center;
    padding: 4px 0 8px;
}

.settings-logout-btn {
    border: none;
    border-radius: 0;
    background: transparent;
    color: #ff3b30;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 17px;
    font-weight: 400;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.settings-logout-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.nav-user-btn {
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
}

.nav-user-btn:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.logout-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: #f1ede7;
}

.new-chat-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.call-overlay {
    position: fixed;
    inset: 0;
    z-index: 10002;
    background: rgba(28, 28, 33, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.call-card {
    width: min(360px, 100%);
    background: #fff;
    border-radius: 20px;
    padding: 32px 24px 24px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.call-avatar-ring {
    width: 88px;
    height: 88px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: call-pulse 2s ease-in-out infinite;
}

.call-avatar-icon {
    font-size: 32px;
    color: #fff;
}

@keyframes call-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

.call-title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 600;
    color: #1c1c21;
}

.call-subtitle {
    margin: 0 0 20px;
    font-size: 14px;
    color: #8c8c94;
}

.call-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.call-btn {
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}

.call-btn-accept {
    background: #22c55e;
    color: #fff;
}

.call-btn-reject,
.call-btn-hangup {
    background: #ef4444;
    color: #fff;
}

.call-btn-mute {
    background: #e0e2e8;
    color: #1c1c21;
}

.call-btn-mute.active {
    background: #6366f1;
    color: #fff;
}

.chat-header-icon.active {
    color: #6366f1;
}

.chat-header-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.new-chat-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}
.new-chat-card h2 {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 700;
}
.new-chat-hint {
    margin: 0 0 12px;
    font-size: 12px;
    color: #8c8c94;
}
.new-chat-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
.new-chat-actions .btn {
    flex: 1;
}
.new-chat-user-section {
    margin: 12px 0 0;
}
.new-chat-user-label {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #1c1c21;
}
.new-chat-user-list {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #e0e2e8;
    border-radius: 12px;
    background: #fafafa;
}
.new-chat-user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    min-height: 52px;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: right;
    font-family: inherit;
}
.new-chat-user-row:hover {
    background: #f0f0fc;
}
.new-chat-user-row.selected {
    background: #e8e8fc;
}
.new-chat-user-row .avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}
.new-chat-user-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.new-chat-user-meta .name {
    font-size: 14px;
    font-weight: 600;
    color: #1c1c21;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.new-chat-user-meta .mxid {
    font-size: 12px;
    color: #8c8c94;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: ltr;
    text-align: right;
}
.new-chat-user-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px 16px;
    font-size: 13px;
    color: #8c8c94;
    text-align: center;
}
.new-chat-user-state .list-spinner {
    width: 24px;
    height: 24px;
}

.header-icon-btn {
    border: none;
    background: #f6f7f8;
    color: #8c8c94;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    flex-shrink: 0;
}

.header-fa-icon {
    font-size: 16px;
    color: #8c8c94;
}

.chat-list-panel {
    width: 320px;
    background: #fff;
    border-left: 1px solid #e0e2e8;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.list-header {
    padding: 14px 16px;
    border-bottom: 1px solid #e0e2e8;
    background: #fff;
}
.list-header-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.list-header h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}
.list-new-chat-btn {
    border: none;
    background: #f6f7f8;
    color: #8c8c94;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.list-new-chat-btn:hover {
    background: #ececf0;
    color: #6366f1;
}
.list-new-chat-btn .fa-icon {
    font-size: 15px;
}
.search {
    margin-top: 10px;
    width: 100%;
    border: none;
    background: #f6f7f8;
    border-radius: 10px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
}

.room-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.room-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    min-height: 56px;
    cursor: pointer;
    border: none;
    width: 100%;
    background: transparent;
    text-align: right;
    font-family: inherit;
    box-sizing: border-box;
    position: relative;
}
/* خط جداکننده: از چپ با پدینگ، تا قبل از آواتار در راست (RTL) */
.room-row:not(:last-child)::after {
    content: "";
    position: absolute;
    bottom: 0;
    /* از بعد از آواتار (پدینگ راست ۱۴ + عرض ۴۴ + فاصله ۱۰) */
    right: 68px;
    /* پدینگ سمت چپ ردیف */
    left: 14px;
    height: 1px;
    background: #e8e8ee;
    pointer-events: none;
}
.room-row:hover {
    background: #f8f8fa;
}
.room-row.active {
    background: #f0f0fc;
}
.room-row.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #6366f1;
    z-index: 1;
}
.avatar,
.nav-user-avatar,
.chat-header-avatar {
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}
.room-row .avatar {
    width: 44px;
    height: 44px;
}
.nav-user-avatar {
    width: 48px;
    height: 48px;
    margin-bottom: 4px;
    font-size: 18px;
}
.chat-header-avatar {
    width: 44px;
    height: 44px;
}
.avatar img,
.nav-user-avatar img,
.chat-header-avatar img,
.avatar-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-photo.hidden {
    display: none;
}
.avatar .initial,
.nav-user-avatar .initial,
.chat-header-avatar .initial {
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.room-meta {
    flex: 1;
    min-width: 0;
}
.room-meta .top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.room-meta .name {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.room-meta .time {
    font-size: 12px;
    color: #8c8c94;
    flex-shrink: 0;
}
.room-meta .preview {
    font-size: 13px;
    color: #8c8c94;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: transparent;
}

.chat-body {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #f1ede7;
}

.chat-header {
    height: 66px;
    background: #fff;
    color: #1c1c21;
    border-bottom: 1px solid #e0e2e8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    flex-shrink: 0;
}

.chat-header-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.chat-header-icon {
    border: none;
    background: transparent;
    color: #8c8c94;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.chat-header-icon:hover {
    background: rgba(99, 102, 241, 0.08);
}

.chat-header-icon .fa-icon {
    font-size: 16px;
    line-height: 1;
}

.chat-header .title {
    flex: 1;
    min-width: 0;
}
.chat-header .title h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #1c1c21;
}
.chat-header .title p {
    margin: 2px 0 0;
    font-size: 12px;
    color: #8c8c94;
}

.timeline {
    flex: 1;
    overflow-y: auto;
    padding: 12px 27px 8px;
    display: flex;
    flex-direction: column;
    background: transparent;
    gap: 8px;
    min-height: 0;
}

.timeline-hint {
    text-align: center;
    font-size: 12px;
    color: #8c8c94;
    padding: 8px 0;
    flex-shrink: 0;
}

.bot-start-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 24px 48px;
    gap: 12px;
    min-height: 240px;
}

.bot-start-avatar {
    width: 88px;
    height: 88px;
    font-size: 32px;
    margin-bottom: 4px;
}

.bot-start-name {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1e;
}

.bot-start-desc {
    margin: 0;
    max-width: 320px;
    font-size: 14px;
    line-height: 1.55;
    color: #6b6b73;
}

.bot-start-btn {
    margin-top: 8px;
    min-width: 140px;
    padding: 11px 28px;
    border: none;
    border-radius: 22px;
    background: #2aabee;
    color: #fff;
    font-family: "Vazirmatn", Tahoma, sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.bot-start-btn .bot-btn-icon {
    color: #fff;
    font-size: 14px;
}

.bot-start-btn:hover {
    background: #229bd9;
}

.bot-start-btn:active {
    background: #1f8fc9;
}

.timeline-date {
    align-self: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.92);
    color: #6b6b73;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 8px;
    margin: 4px 0 8px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.bubble-row {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.bubble-row.mine {
    align-items: flex-start;
}
.bubble-row.theirs {
    align-items: flex-end;
}

.room-row .name .bot-badge,
.new-chat-user-meta .name .bot-badge {
    display: inline-block;
    margin-inline-start: 6px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
    color: #3d5afe;
    background: #e8edff;
    border-radius: 4px;
    vertical-align: middle;
}

.bot-keyboard {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
    max-width: min(92%, 360px);
}

.bubble-row.mine .bot-keyboard {
    align-self: flex-start;
}

.bubble-row.theirs .bot-keyboard {
    align-self: flex-end;
}

.bot-keyboard-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bot-keyboard-btn {
    flex: 1 1 auto;
    min-width: 72px;
    padding: 8px 12px;
    font-size: 13px;
    color: #3d5afe;
    background: #fff;
    border: 1px solid #c5cff9;
    border-radius: 8px;
    cursor: pointer;
}

.bot-keyboard-btn:hover {
    background: #f0f3ff;
}

.bubble {
    max-width: min(72%, 520px);
    padding: 10px 14px;
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    position: relative;
}
.bubble.mine {
    background: #d0f1d5;
}
.bubble.theirs {
    background: #fff;
}

.typing-row {
    margin-top: 2px;
}

.typing-bubble {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    color: #8c8c94;
    font-size: 14px;
}

.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-inline-start: 2px;
}

.typing-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #8c8c94;
    animation: typing-dot-bounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typing-dot-bounce {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.45;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.bubble .text {
    font-size: 15px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.bubble .meta {
    display: flex;
    flex-direction: row;
    direction: ltr;
    justify-content: flex-start;
    align-items: center;
    gap: 4px;
    margin-top: 9px;
    font-size: 11px;
    color: #8c8c94;
}

.bubble .meta .time {
    line-height: 1;
}

.bubble .meta .tick {
    font-size: 11px;
    line-height: 1;
    flex-shrink: 0;
}

.bubble .meta .tick.sent {
    color: #8c8c94;
}

.bubble .meta .tick.read {
    color: #6366f1;
}
.bubble img {
    max-width: 280px;
    border-radius: 10px;
    display: block;
}

.bubble-image-wrap {
    position: relative;
    display: inline-block;
    max-width: 280px;
    min-width: 120px;
    min-height: 90px;
}

.bubble-upload-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 22, 30, 0.55);
    border-radius: 10px;
    z-index: 2;
}

.bubble-upload-ring {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

.bubble-upload-ring-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bubble-upload-pct {
    font-size: 13px;
    font-weight: 800;
    color: #1c1c21;
    line-height: 1;
    letter-spacing: -0.02em;
}

.bubble-upload-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: list-spinner-spin 0.75s linear infinite;
}

.bubble-file-wrap {
    position: relative;
    min-width: 200px;
    max-width: 280px;
}

.bubble-file-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.08);
    color: inherit;
    text-decoration: none;
}

.bubble.mine .bubble-file-link {
    background: rgba(61, 155, 82, 0.12);
}

.bubble-file-link--pending {
    cursor: default;
}

.bubble-file-badge {
    width: 58px;
    height: 58px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex-shrink: 0;
    background: rgba(99, 102, 241, 0.14);
    color: #4f46e5;
}

.bubble-file-badge-icon {
    font-size: 24px;
    line-height: 1;
}

.bubble-file-badge-label {
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.02em;
}

.bubble-file-badge--pdf {
    background: rgba(220, 53, 69, 0.12);
    color: #c62828;
}

.bubble-file-badge--word {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}

.bubble-file-badge--sheet {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
}

.bubble-file-badge--slides {
    background: rgba(234, 88, 12, 0.12);
    color: #c2410c;
}

.bubble-file-badge--archive {
    background: rgba(161, 98, 7, 0.12);
    color: #a16207;
}

.bubble-file-badge--video {
    background: rgba(124, 58, 237, 0.12);
    color: #6d28d9;
}

.bubble-file-badge--audio {
    background: rgba(8, 145, 178, 0.12);
    color: #0e7490;
}

.bubble-file-badge--text {
    background: rgba(100, 116, 139, 0.14);
    color: #475569;
}

.bubble-file-badge--image {
    background: rgba(236, 72, 153, 0.12);
    color: #be185d;
}

.bubble-file-badge--generic {
    background: rgba(100, 116, 139, 0.14);
    color: #475569;
}

.composer-attach {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 6px;
    direction: rtl;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.composer-attach-thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.composer-attach-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.composer-attach-name {
    font-size: 13px;
    font-weight: 600;
    color: #1c1c21;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.composer-attach-hint {
    font-size: 12px;
    color: #8c8c94;
}

.composer-attach-close {
    border: none;
    background: transparent;
    color: #8c8c94;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0 4px;
    flex-shrink: 0;
    font-family: inherit;
}

.composer-attach-close:hover {
    color: #1c1c21;
}

.bubble-file-icon {
    font-size: 22px;
    color: #6366f1;
    flex-shrink: 0;
}

.bubble.mine .bubble-file-icon {
    color: #3d9b52;
}

.bubble-file-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bubble-file-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bubble-file-size {
    font-size: 12px;
    color: #8c8c94;
}

.composer-float {
    position: relative;
    flex-shrink: 0;
    width: 100%;
    background: transparent;
    pointer-events: none;
    z-index: 2;
    overflow: visible;
}

.composer-float::after {
    display: none;
}

.composer-area {
    position: relative;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e0e2e8;
    border-radius: 28px;
    margin: 0 20px 16px;
    min-height: 51px;
    pointer-events: auto;
    overflow: visible;
}

.composer-status {
    padding: 6px 16px 0;
    font-size: 12px;
    line-height: 1.35;
    color: #c92a2a;
    direction: rtl;
    flex-shrink: 0;
}

.composer-reply {
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px 6px;
    direction: rtl;
    flex-shrink: 0;
}

.composer-reply-bar {
    width: 3px;
    border-radius: 2px;
    background: #6366f1;
    flex-shrink: 0;
    min-height: 32px;
}

.composer-reply-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.composer-reply-sender {
    font-size: 13px;
    font-weight: 600;
    color: #6366f1;
    line-height: 1.2;
}

.composer-reply-text {
    font-size: 13px;
    color: #8c8c94;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.composer-reply-close {
    border: none;
    background: transparent;
    color: #8c8c94;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0 4px;
    flex-shrink: 0;
    align-self: flex-start;
    font-family: inherit;
}

.composer-reply-close:hover {
    color: #1c1c21;
}

.composer-attach .bubble-file-badge {
    width: 48px;
    height: 48px;
    border-radius: 12px;
}

.composer-attach .bubble-file-badge-icon {
    font-size: 20px;
}

.composer-attach .bubble-file-badge-label {
    font-size: 9px;
}

.bubble-reply {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 6px;
    direction: rtl;
}

.bubble-reply-bar {
    width: 3px;
    border-radius: 2px;
    background: #6366f1;
    flex-shrink: 0;
}

.bubble.mine .bubble-reply-bar {
    background: #3d9b52;
}

.bubble-reply-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bubble-reply-sender {
    font-size: 12px;
    font-weight: 600;
    color: #6366f1;
    line-height: 1.2;
}

.bubble.mine .bubble-reply-sender {
    color: #3d9b52;
}

.bubble-reply-text {
    font-size: 12px;
    color: #8c8c94;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.composer {
    min-height: 51px;
    padding: 4px 12px;
    display: flex;
    flex-direction: row;
    direction: ltr;
    gap: 6px;
    align-items: center;
    box-sizing: border-box;
}

.composer-icon {
    border: none;
    background: transparent;
    color: #8c8c94;
    cursor: pointer;
    padding: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-family: inherit;
}

.composer-icon:hover {
    background: rgba(99, 102, 241, 0.08);
}

.composer-icon .fa-icon {
    font-size: 18px;
    line-height: 1;
}

.composer-plus.active,
.composer-icon.active {
    color: #6366f1;
}

.emoji-picker-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: auto;
}

.emoji-picker-panel {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 8px;
    right: 8px;
    z-index: 10000;
    pointer-events: auto;
    max-height: min(320px, 42vh);
    background: #fff;
    border: 1px solid #e0e2e8;
    border-radius: 16px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    direction: rtl;
}

.emoji-picker-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 10px 4px;
    border-bottom: 1px solid #eef0f6;
    flex-shrink: 0;
}

.emoji-picker-tab {
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #8c8c94;
    cursor: pointer;
}

.emoji-picker-tab.active {
    background: #f0f0fc;
    color: #6366f1;
}

.emoji-picker-cats {
    display: flex;
    gap: 4px;
    padding: 6px 10px;
    overflow-x: auto;
    flex-shrink: 0;
    border-bottom: 1px solid #f3f4f6;
}

.emoji-picker-cat {
    border: none;
    background: transparent;
    padding: 4px 10px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 12px;
    color: #8c8c94;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.emoji-picker-cat.active {
    background: #eef0f6;
    color: #1c1c21;
    font-weight: 600;
}

.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 8px 10px 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.emoji-picker-grid--stickers {
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    padding: 6px 8px 8px;
}

.emoji-picker-cell {
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 24px;
    line-height: 1;
    padding: 6px 2px;
    cursor: pointer;
}

.emoji-picker-cell:hover {
    background: #f3f4f6;
}

.emoji-picker-sticker {
    border: none;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 3px;
    cursor: pointer;
    aspect-ratio: 1;
    max-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.emoji-picker-sticker:hover {
    transform: scale(1.04);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.emoji-picker-sticker-img {
    width: 100%;
    height: 100%;
    max-width: 48px;
    max-height: 48px;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.emoji-picker-sticker-emoji {
    font-size: 30px;
    line-height: 1;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

.sticker-row .sticker-bubble {
    background: transparent;
    box-shadow: none;
    padding: 4px 8px;
}

.bubble-sticker-wrap img {
    width: 128px;
    height: 128px;
    object-fit: contain;
    display: block;
}

.composer-send {
    color: #6366f1;
}

.composer-send .fa-icon {
    font-size: 16px;
}

.composer-input {
    flex: 1;
    height: 38px;
    min-height: 38px;
    max-height: 192px;
    resize: none;
    overflow-y: hidden;
    border: none;
    background: transparent;
    border-radius: 0;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.45;
    direction: rtl;
    text-align: right;
    color: #1c1c21;
    box-sizing: border-box;
}

.composer-input:focus {
    outline: none;
}

.attach-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: auto;
}

.attach-menu-panel {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 34px;
    z-index: 10000;
    pointer-events: auto;
    width: 220px;
    max-height: min(60dvh, 360px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
    background: #fff;
    border: 1px solid #e0e2e8;
    border-radius: 14px;
    box-shadow: 0 -3px 14px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.login-screen {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1ede7;
    padding: 20px;
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}
.login-card h1 {
    margin: 0 0 8px;
    font-size: 22px;
    text-align: center;
}
.login-card p {
    margin: 0 0 20px;
    text-align: center;
    color: #8c8c94;
    font-size: 14px;
}
.field {
    margin-bottom: 12px;
}
.field label {
    display: block;
    font-size: 13px;
    color: #8c8c94;
    margin-bottom: 6px;
}
.field input {
    width: 100%;
    border: 1px solid #e0e2e8;
    border-radius: 10px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 15px;
}
.login-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.auth-loading-screen {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: #f1ede7;
    padding: 20px;
}

.auth-loading-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1c1c21;
}

.auth-loading-text {
    margin: 0;
    font-size: 15px;
    color: #8c8c94;
}

.auth-progress {
    width: min(280px, 72vw);
    height: 7px;
    background: #e0e2e8;
    border-radius: 999px;
    overflow: hidden;
    direction: ltr;
}

.auth-progress-bar {
    width: 100%;
    height: 100%;
    background: #6366f1;
    border-radius: 999px;
    transform: scaleX(0);
    transform-origin: left center;
    animation: auth-progress-fill 2.8s ease-out forwards;
}

.logout-overlay .auth-progress-bar {
    animation-duration: 4s;
}

@keyframes auth-progress-fill {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

.btn {
    flex: 1;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.btn-primary {
    background: #6366f1;
    color: #fff;
}
.btn-secondary {
    background: #f0f0fc;
    color: #6366f1;
}
.btn:disabled {
    opacity: 0.6;
    cursor: wait;
}
.error {
    color: #c0392b;
    font-size: 13px;
    margin-top: 10px;
    text-align: center;
}

.empty-chat {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8c8c94;
    font-size: 15px;
}

.bubble-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.bubble-menu-panel {
    position: fixed;
    z-index: 10000;
    width: 175px;
    padding: 8px;
    background: #fff;
    border: 1px solid #e0e2e8;
    border-radius: 14px;
    box-shadow: 0 -3px 14px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bubble-menu-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    padding: 6px 8px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    color: #1c1c21;
    cursor: pointer;
}

.bubble-menu-item:hover {
    background: rgba(99, 102, 241, 0.1);
}

.bubble-menu-item.destructive {
    color: #d94040;
}

.bubble-menu-item.destructive:hover {
    background: rgba(217, 64, 64, 0.1);
}

.bubble-menu-item.destructive .bubble-menu-icon {
    color: #d94040;
}

.bubble-menu-label {
    flex: 1;
    text-align: start;
}

.bubble-menu-icon {
    font-size: 16px;
    color: #6366f1;
    line-height: 1;
    flex-shrink: 0;
    width: 16px;
    text-align: center;
}

.bubble-menu-sep {
    height: 1px;
    margin: 6px 10px;
    background: #e8ebf0;
}

.hidden-input {
    display: none;
}

/* ── Mobile layout (viewport ≤ 768px) ── */
@media (max-width: 768px) {
    html,
    body,
    #root,
    .app-root {
        height: 100%;
        height: 100dvh;
        min-height: 0;
    }

    .messenger {
        flex-direction: column;
        height: 100%;
        min-height: 0;
    }

    .chat-list-panel {
        width: 100%;
        flex: 1;
        min-height: 0;
        border-left: none;
    }

    .messenger.messenger--detail-open .chat-list-panel {
        display: none;
    }

    .messenger:not(.messenger--detail-open) .chat-panel {
        display: none !important;
    }

    .messenger.messenger--detail-open .chat-panel {
        display: flex;
        flex: 1;
        min-height: 0;
    }

    /* در گفتگو نوار پایین مخفی — فضای کامل برای composer */
    .messenger.messenger--detail-open .nav-rail {
        display: none;
    }

    .nav-rail {
        order: 10;
        width: 100%;
        height: auto;
        flex-direction: row;
        align-items: stretch;
        border-left: none;
        border-top: 1px solid #e0e2e8;
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
        flex-shrink: 0;
    }

    .nav-rail-user {
        display: none;
    }

    .nav-rail-bar {
        flex-direction: row;
        flex: 1;
        justify-content: space-around;
        gap: 0;
        min-height: 0;
    }

    .nav-rail-bar .nav-rail-item:last-child {
        margin-top: 0;
    }

    .nav-rail-item {
        flex: 1;
        max-width: 80px;
        padding: 5px 2px;
        gap: 5px;
    }

    .nav-rail-icon,
    .nav-rail-item .fa-icon {
        font-size: 19px;
    }

    .nav-rail-label {
        font-size: 10px;
        font-weight: 600;
    }

    .chat-header {
        padding-top: env(safe-area-inset-top, 0px);
        height: auto;
        min-height: 56px;
    }

    .settings-panel .settings-header {
        padding-top: env(safe-area-inset-top, 0px);
        height: auto;
        min-height: 56px;
    }

    .settings-panel .settings-body {
        padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
    }

    .chat-header-back {
        flex-shrink: 0;
        margin-inline-end: 6px;
        padding-inline-end: 12px;
    }

    .settings-back-btn {
        margin-inline-end: 6px;
        padding-inline-end: 12px;
    }

    .chat-header-actions {
        display: flex;
        gap: 2px;
    }

    /* روی موبایل فقط دکمهٔ تماس صوتی */
    .chat-header-actions .chat-header-icon:not(.chat-header-call) {
        display: none;
    }

    .call-overlay {
        padding: max(24px, env(safe-area-inset-top, 0px)) 16px
            max(24px, env(safe-area-inset-bottom, 0px));
    }

    .composer-float {
        background: #f1ede7;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .composer-float::after {
        display: none;
    }

    .composer-area {
        margin: 0 10px 10px;
        border-radius: 22px;
        padding-bottom: 0;
    }

    .attach-menu-panel {
        left: 24px;
    }

    .timeline {
        padding: 10px 14px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }

    .bot-keyboard {
        position: relative;
        z-index: 1;
        margin-bottom: 4px;
    }

    .bot-keyboard-btn {
        background: #fff;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    }

    .bubble {
        max-width: 88%;
    }

    .new-chat-overlay {
        padding: 12px;
        align-items: flex-end;
    }

    .new-chat-card {
        max-height: 90dvh;
        overflow-y: auto;
    }

    .login-screen {
        min-height: 100dvh;
        height: auto;
        padding: max(16px, env(safe-area-inset-top, 0px)) 16px
            max(16px, env(safe-area-inset-bottom, 0px));
        align-items: flex-start;
        padding-top: max(24px, env(safe-area-inset-top, 0px));
    }

    .login-card {
        margin: 0;
        max-width: none;
    }
}

/* --- Room list context menu & badges --- */
.room-context-menu {
    min-width: 210px;
    z-index: 10001;
}

.room-row-pin,
.room-row-mute {
    font-size: 11px;
    margin-inline-end: 4px;
    opacity: 0.75;
}

.preview-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.preview-row .preview {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-unread-badge {
    flex-shrink: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #5b5ef0;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}

/* --- Modal (room info) --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-panel {
    width: min(420px, 100%);
    max-height: 85dvh;
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 6px;
    color: #666;
}

.room-info-subtitle {
    margin: 0 0 8px;
    color: #666;
    font-size: 13px;
    word-break: break-all;
}

.room-info-encrypted {
    margin: 0 0 12px;
    font-size: 12px;
    color: #5b5ef0;
}

.room-info-members h3 {
    margin: 0 0 10px;
    font-size: 14px;
}

.room-info-member-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.room-info-member {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f4;
}

.room-info-member-meta {
    flex: 1;
    min-width: 0;
}

.room-info-member-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
}

.room-info-member-id {
    display: block;
    font-size: 11px;
    color: #888;
    word-break: break-all;
}

.avatar-sm {
    width: 36px;
    height: 36px;
    font-size: 14px;
}

/* --- In-chat search --- */
.chat-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #e8e8ee;
    background: #fafafc;
}

.chat-search-icon {
    color: #888;
    font-size: 14px;
}

.chat-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 14px;
    outline: none;
}

.chat-search-close {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 4px;
    color: #666;
}

.composer-bot-keyboard {
    padding: 8px 10px 4px;
    border-bottom: 1px solid #e8e8ee;
    background: #fafafc;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: auto;
    flex-shrink: 0;
}

.composer-bot-keyboard .bot-keyboard-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.composer-bot-keyboard .bot-keyboard-btn {
    flex: 1 1 45%;
    min-width: 0;
    font-family: "Vazirmatn", Tahoma, sans-serif;
    font-size: 13px;
    font-weight: 500;
    padding: 9px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid #d8d8e0;
    border-radius: 10px;
    background: #fff;
    color: #1a1a1e;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.composer-bot-keyboard .bot-keyboard-btn:hover {
    background: #f3f6fb;
    border-color: #b8c8e8;
}

.composer-bot-keyboard .bot-keyboard-btn:active {
    background: #e8eef8;
}

.bot-btn-icon {
    font-family: "Font Awesome 6 Free Solid", sans-serif;
    font-size: 13px;
    font-weight: 900;
    flex-shrink: 0;
    color: #3b6fd9;
}

.bot-btn-label {
    font-family: "Vazirmatn", Tahoma, sans-serif;
    line-height: 1.35;
}

.org-bot-row .preview {
    color: #8c8c94;
    font-size: 12px;
}

/* تم و اندازه فونت از تنظیمات */
html[data-font="small"] {
    font-size: 14px;
}
html[data-font="medium"] {
    font-size: 16px;
}
html[data-font="large"] {
    font-size: 18px;
}

html[data-theme="dark"],
html[data-theme="system"] {
    color-scheme: dark light;
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"] body,
    html[data-theme="system"] .app-root {
        background: #12141a;
        color: #f3f4f6;
    }
    html[data-theme="system"] .nav-rail,
    html[data-theme="system"] .list-panel,
    html[data-theme="system"] .chat-panel,
    html[data-theme="system"] .settings-panel,
    html[data-theme="system"] .settings-group,
    html[data-theme="system"] .settings-item,
    html[data-theme="system"] .settings-device,
    html[data-theme="system"] .settings-input {
        --settings-bg: #0b141a;
        --settings-group-bg: #1f2c34;
        --settings-divider: #2a3942;
        --settings-icon: #8696a0;
        --settings-chevron: #8696a0;
        --settings-label: #e9edef;
        --settings-value: #8696a0;
        --settings-subpanel-bg: #111b21;
    }
}

html[data-theme="dark"] body,
html[data-theme="dark"] .app-root {
    background: #12141a;
    color: #f3f4f6;
}
html[data-theme="dark"] .nav-rail,
html[data-theme="dark"] .list-panel,
html[data-theme="dark"] .chat-panel {
    background: #1a1d26;
    color: #f3f4f6;
    border-color: #2c3140;
}
html[data-theme="dark"] .settings-panel,
html[data-theme="dark"] .settings-group,
html[data-theme="dark"] .settings-item,
html[data-theme="dark"] .settings-device,
html[data-theme="dark"] .settings-input {
    --settings-bg: #0b141a;
    --settings-group-bg: #1f2c34;
    --settings-divider: #2a3942;
    --settings-icon: #8696a0;
    --settings-chevron: #8696a0;
    --settings-label: #e9edef;
    --settings-value: #8696a0;
    --settings-subpanel-bg: #111b21;
}
html[data-theme="dark"] .settings-btn-ghost {
    background: #2a3942;
    color: #e9edef;
}
html[data-theme="dark"] .settings-switch-slider {
    background: #3b4a54;
}
html[data-theme="dark"] .settings-switch-slider::before {
    background: #f0f2f5;
}
html[data-theme="dark"] .settings-badge {
    background: #005c4b;
    color: #d9fdd3;
}
html[data-theme="light"] body,
html[data-theme="light"] .app-root {
    background: #f1ede7;
    color: #1c1c21;
}


