body,
html {
    font-family: 'Vazirmatn', Tahoma, Arial, "Segoe UI", sans-serif !important;
    background: #f4f4f4;
    margin: 0;
    padding: 0;
    direction: rtl;
}

/* =========================
   LOGIN PAGE OVERRIDES
   ========================= */
body.login-page, html.login-page {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: linear-gradient(135deg, #6b21a8, #9333ea, #a855f7);
    background-attachment: fixed;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.login-page {
    min-height: 100vh;
}

#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

#particles-js,
#particles-js canvas,
.particles-js-canvas-el {
    pointer-events: none !important;
}

.login-page .login-box {
    position: relative;
    z-index: 1;
    backdrop-filter: blur(3px);
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 1rem;
    padding: 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    color: #fff;
    direction: rtl;
}

.login-page .login-box h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: bold;
    color: #fff;
}

.login-page .login-box input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    outline: none;
    direction: rtl;
    text-align: right;
    font-family: inherit;
}

.login-page .login-box input::placeholder {
    color: rgba(255, 255, 255, 0.7);
    text-align: right;
}

.login-page .login-box button {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 0.5rem;
    background: linear-gradient(90deg, #06b6d4, #0ea5e9, #38bdf8);
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.login-page .login-box button:hover {
    transform: translateY(-1px);
    opacity: 0.95;
}

.login-page .error {
    background: rgba(220, 38, 38, 0.6);
    padding: 0.5rem;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    text-align: center;
    color: #fff;
}

.login-page .helper-text {
    font-size: 0.85rem;
    line-height: 1.7;
    margin-top: 1rem;
    color: rgba(255, 255, 255, 0.95);
    list-style: disc;
    padding-right: 1rem;
    direction: rtl;
    text-align: right;
}


.login-box {
    background: #fff;
    padding: 22px 22px 12px 22px;
    border-radius: 10px;
    margin: 40px auto 24px auto;
    max-width: 380px;
    min-width: 240px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    font-family: inherit;
    direction: rtl;
}

@media (max-width: 600px) {
    .login-box {
        max-width: 97vw;
        /*margin: 18px 2vw 8px 2vw;*/
        padding: 12px 3vw 10px 3vw;
    }
}

.login-box input,
.login-box button {
    width: 100%;
    min-width: 0;
    margin: 0 0 14px 0;
    font-size: 1rem;
    box-sizing: border-box;
}

.login-box input {
    padding: 10px;
    border: 1px solid #bbb;
    border-radius: 5px;
    direction: rtl;
    text-align: right;
    font-family: inherit;
}

.login-box button {
    padding: 12px 0;
    background: #0077bb;
    color: #fff;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 1.05rem;
    font-family: inherit;
    margin-bottom: 6px;
    transition: background 0.2s;
}

.login-box button:active,
.login-box button:focus {
    outline: none;
    background: #005fa3;
}

.login-box .helper-text {
    display: block;
    font-size: 14px;
    color: #fff;
    margin-top: 8px;
    margin-bottom: 2px;
    text-align: right;
    line-height: 1.6;
    font-family: inherit;
}

.top-bar,
.chat-box,
.search-form,
ul.user-list,
h2,
form,
label,
div,
span,
input,
button,
a,
li {
    font-family: 'Vazirmatn', Tahoma, Arial, "Segoe UI", sans-serif !important;
    direction: rtl;
    box-sizing: border-box;
}

h2{
    font-size: 1.2rem;
}

/* =========================
   HOME PAGE OVERRIDES
   ========================= */
html.home-page {
    margin: 0;
    padding: 0;
    background-color: #10243b;
    min-height: 100%;
}

body.home-page {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(135deg, #10243b, #17314d, #1f3f63);
    background-repeat: no-repeat;
    background-size: cover;
    overflow-x: hidden;
    padding-bottom: max(28px, env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
}

/* particles background same as login */
body.home-page #particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* top bar with cyan gradient */
.home-page .top-bar {
    color: #f7f1e6;
    z-index: 2;
}

/* glass button same as login box */
.home-page .glass-btn {
    display: block;
    margin: 30px auto 0 auto;
    padding: 15px 0;
    width: 92%;
    max-width: 350px;
    text-align: center;

    backdrop-filter: blur(6px);
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);

    color: #fff;
    font-size: 1.15rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.home-page .glass-btn:hover {
    transform: translateY(-1px);
    opacity: 0.95;
}

.app-download-button {
    display: none;
    width: min(92%, 350px);
    margin: 0 auto 18px;
    padding: 14px 18px;
    border-radius: 12px;
    background: linear-gradient(135deg, #b08a46 0%, #d5bb7a 100%);
    color: #1c2430;
    text-align: center;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 10px 26px rgba(129, 101, 45, 0.24);
}

.home-download-button {
    margin-top: 126px;
}

.home-page .search-form {
    margin-top: 110px;
}

.home-page.app-embedded .search-form {
    margin-top: 132px;
}

.login-download-button {
    width: 100%;
    max-width: none;
    margin-bottom: 14px;
    box-sizing: border-box;
}

.login-page .login-box .login-download-button {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 0 14px 0;
}

.group-create-panel {
    width: min(92%, 620px);
    margin: 0 auto 18px auto;
    box-sizing: border-box;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(214, 186, 130, 0.18);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(10px);
    overflow: hidden;
    transition: width 0.32s ease, box-shadow 0.24s ease, background-color 0.24s ease;
}

.group-create-panel:not([open]) {
    width: min(88vw, 440px);
}

.group-create-toggle {
    list-style: none;
    display: block;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    color: #f7f1e6;
    font-weight: 700;
    padding: 16px 18px;
    text-align: center;
}

.group-create-toggle::-webkit-details-marker {
    display: none;
}

.group-create-form {
    height: 0;
    padding: 0 18px 0 18px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: height 0.32s ease, padding 0.32s ease, opacity 0.22s ease, transform 0.32s ease;
}

.group-create-panel.is-open .group-create-form,
.group-create-panel.is-opening .group-create-form {
    padding: 0 18px 18px 18px;
    opacity: 1;
    transform: translateY(0);
}

.group-create-panel.is-closing .group-create-form {
    padding: 0 18px 18px 18px;
    opacity: 0;
    transform: translateY(-10px);
}

.group-create-form input,
.group-create-form textarea {
    width: 100%;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.86);
    color: #0f1f33;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 1rem;
}

.group-create-form input[name="group_name"] {
    direction: rtl;
    text-align: right;
}

.group-create-form textarea {
    resize: vertical;
    min-height: 110px;
    direction: ltr;
    text-align: left;
}

.group-member-picker {
    margin-bottom: 12px;
}

.group-member-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.group-member-row input {
    margin-bottom: 0;
    direction: ltr;
    text-align: left;
    flex: 1 1 auto;
    font-size: 1.05rem;
    padding: 12px 10px;
    border: 1px solid #bbb;
    border-radius: 8px;
    outline: none;
    transition: border 0.2s;
    background: #fafbfc;
}

.group-member-row input::placeholder {
    direction: rtl;
    text-align: right;
}

.group-member-row input:focus {
    border: 1.5px solid #0077bb;
    background: #fff;
}

.group-member-add-button {
    flex: 0 0 auto;
    border: none;
    border-radius: 8px;
    background: #0077bb;
    color: #fff;
    padding: 12px 18px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
}

.group-create-feedback {
    margin-top: 10px;
    border-radius: 10px;
    padding: 10px 12px;
    background: rgba(22, 163, 74, 0.16);
    color: #ecfdf5;
}

.group-create-feedback.is-error {
    background: rgba(220, 38, 38, 0.18);
    color: #fee2e2;
}

.group-selected-members {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.group-selected-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: #f7f1e6;
    border: 1px solid rgba(214, 186, 130, 0.18);
}

.group-chip-remove {
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fce7e7;
    padding: 4px 10px;
    font-family: inherit;
    cursor: pointer;
}

.group-selected-empty {
    color: rgba(247, 241, 230, 0.72);
    font-size: 0.95rem;
}

.group-hidden-members {
    display: none;
}

.group-create-submit {
    width: 100%;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #b08a46 0%, #d5bb7a 100%);
    color: #1c2430;
    padding: 12px 16px;
    font-weight: 700;
    cursor: pointer;
}


.top-bar {
    background: linear-gradient(135deg, #0f1f33 0%, #1b2f47 56%, #29415d 100%);
    color: #f7f1e6;
    /*border-radius: 7px;*/
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100vw;
    z-index: 999;
    height: 4.5rem;
    min-height: 4.5rem;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(214, 186, 130, 0.2);
    box-shadow: 0 10px 28px rgba(8, 14, 24, 0.34);
    overflow: visible;
}

.site-notice {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 25;
}

.site-notice-summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 16px;
    background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(127, 29, 29, 0.24);
}

.site-notice-summary::-webkit-details-marker {
    display: none;
}

.site-notice-panel {
    height: 0;
    overflow: hidden;
    padding: 0 18px;
    background: rgba(127, 29, 29, 0.96);
    color: #fff6f6;
    text-align: center;
    line-height: 1.9;
    box-shadow: 0 18px 30px rgba(15, 23, 42, 0.22);
    opacity: 0;
    transform: translateY(-10px);
    transition: height 0.3s ease, padding 0.3s ease, opacity 0.22s ease, transform 0.3s ease;
}

.site-notice-text {
    margin: 0;
}

.site-notice-inline-update {
    display: inline;
    margin-right: 8px;
    font-weight: 700;
    color: #ffe5e5;
}

.site-notice-update {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.site-notice-update-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.site-notice-update-label {
    font-weight: 700;
}

.site-notice-update-date,
.site-notice-update-time {
    font-size: 0.94rem;
    color: #ffe5e5;
}

.site-notice-update-time {
    direction: ltr;
}

.site-notice-download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 132px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.24);
    color: #fff;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 700;
}

.site-notice-action-row {
    display: flex;
    justify-content: center;
}

.site-notice-admin-button {
    background: rgba(214, 186, 130, 0.16);
    border-color: rgba(214, 186, 130, 0.34);
    color: #fff8e8;
}

.site-notice-list {
    margin: 10px 0 0;
    padding-right: 20px;
    text-align: right;
    list-style: disc;
}

.site-notice-list li + li {
    margin-top: 6px;
}

.site-notice.is-open .site-notice-panel,
.site-notice.is-opening .site-notice-panel {
    padding: 14px 18px 16px;
    opacity: 1;
    transform: translateY(0);
}

.site-notice.is-closing .site-notice-panel {
    opacity: 0;
    transform: translateY(-10px);
}

.top-bar a {
    text-decoration: none !important;
}

.top-bar-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-avatar {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(214, 186, 130, 0.3);
    box-shadow: 0 8px 20px rgba(5, 10, 18, 0.22);
}

.app-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.app-avatar-placeholder {
    color: #f7f1e6;
    font-weight: 800;
    font-size: 1rem;
}

.app-avatar-large {
    width: 5.5rem;
    height: 5.5rem;
    font-size: 1.9rem;
}

.app-avatar-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.top-bar-account {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.top-bar-account-label {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 0;
    line-height: 1.2;
}

.top-bar-account-name,
.top-bar-account-email {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-bar-account-name {
    font-weight: 700;
}

.top-bar-account-email {
    font-size: 0.8rem;
    opacity: 0.78;
}

.home-top-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    min-height: 5.5rem;
    height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
    direction: ltr;
}

.home-top-bar-meta {
    flex: 0 1 auto;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
    margin-right: auto;
    direction: rtl;
}

.home-top-bar-status {
    font-size: 0.9rem;
    opacity: 0.95;
    text-align: left;
}

.home-top-bar-actions {
    gap: 10px;
    justify-content: flex-start;
    direction: rtl;
}

.home-top-bar .top-bar-account {
    flex: 0 0 auto;
    margin-left: auto;
    justify-content: flex-end;
    direction: rtl;
}

.top-link,
.top-link-button {
    color: #f7f1e6;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(214, 186, 130, 0.28);
    border-radius: 999px;
    padding: 8px 14px;
    line-height: 1;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.top-link:hover,
.top-link-button:hover {
    background: rgba(214, 186, 130, 0.14);
    border-color: rgba(214, 186, 130, 0.45);
    transform: translateY(-1px);
}

.top-link-button {
    font-family: inherit;
    appearance: none;
}

.chat-top-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.chat-top-link {
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    margin-bottom: 5px;
}

.chat-top-title {
    font-size: 1.1rem;
    line-height: 1.25;
}

.chat-top-status {
    font-size: 0.9rem;
    margin-top: 6px;
    opacity: 0.95;
    line-height: 1.2;
}

.chat-header-menu {
    position: absolute;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    z-index: 30;
}

.chat-call-button {
    position: absolute;
    top: 50%;
    left: 18px;
    transform: translateY(-50%);
    z-index: 30;
    width: 3rem;
    height: 3rem;
    border: none;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.16);
    color: #f7f1e6;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.chat-call-button:hover {
    background: rgba(255, 255, 255, 0.24);
    transform: translateY(calc(-50% - 1px));
}

.chat-call-button:disabled {
    opacity: 0.45;
    cursor: default;
    transform: translateY(-50%);
}

.chat-top-avatar {
    position: absolute;
    top: 50%;
    right: 68px;
    transform: translateY(-50%);
    z-index: 30;
}

.chat-page .chat-header-menu {
    right: 18px;
}

.chat-call-button svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.chat-header-menu-toggle {
    border: none;
    background: transparent;
    color: #f7f1e6;
    width: auto;
    height: auto;
    padding: 8px 10px;
    border-radius: 0;
    font-family: inherit;
    font-size: 1.9rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
}

.chat-header-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 40;
    min-width: 190px;
    padding: 8px;
    border-radius: 14px;
    background: rgba(15, 31, 51, 0.96);
    border: 1px solid rgba(214, 186, 130, 0.18);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.24);
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.chat-header-menu-panel.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chat-header-menu-panel.is-closing {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    pointer-events: none;
}

.chat-header-menu-item {
    width: 100%;
    border: none;
    background: transparent;
    color: #f7f1e6;
    text-align: right;
    font-family: inherit;
    font-size: 0.92rem;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
}

.chat-header-menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.chat-call-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    box-sizing: border-box;
}

.chat-call-overlay[hidden] {
    display: none;
}

.chat-call-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 16, 30, 0.56);
    backdrop-filter: blur(4px);
}

.chat-call-dialog {
    position: relative;
    z-index: 1;
    width: min(92vw, 360px);
    margin: 0;
    padding: 22px 20px 18px;
    border-radius: 22px;
    background: linear-gradient(160deg, rgba(15, 31, 51, 0.98), rgba(23, 49, 77, 0.96));
    border: 1px solid rgba(214, 186, 130, 0.18);
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.32);
    color: #f7f1e6;
    text-align: center;
}

.chat-call-eyebrow {
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    opacity: 0.78;
    margin-bottom: 10px;
}

.chat-call-title {
    margin: 0;
    font-size: 1.2rem;
    color: #fff9ef;
}

.chat-call-status {
    margin-top: 10px;
    font-size: 0.98rem;
    line-height: 1.7;
}

.chat-call-note {
    margin-top: 14px;
    padding: 11px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.82rem;
    line-height: 1.8;
    color: rgba(247, 241, 230, 0.92);
}

.chat-call-live {
    margin-top: 16px;
}

.chat-call-ptt-button {
    width: 100%;
    border: none;
    border-radius: 22px;
    padding: 18px 16px;
    background: linear-gradient(135deg, #1ea672, #177b56);
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 16px 36px rgba(30, 166, 114, 0.22);
    transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

.chat-call-ptt-button:hover {
    transform: translateY(-1px);
}

.chat-call-ptt-button.is-recording {
    background: linear-gradient(135deg, #d84d4d, #a63838);
    box-shadow: 0 18px 40px rgba(216, 77, 77, 0.28);
}

.chat-call-ptt-button:disabled {
    opacity: 0.6;
    cursor: default;
    transform: none;
}

.chat-call-live-status {
    margin-top: 10px;
    font-size: 0.88rem;
    line-height: 1.7;
    color: rgba(247, 241, 230, 0.88);
}

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

.chat-call-action {
    min-width: 108px;
    border: none;
    border-radius: 999px;
    padding: 11px 16px;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.chat-call-action:hover {
    transform: translateY(-1px);
}

.chat-call-action.is-answer {
    background: #1ea672;
    color: #fff;
}

.chat-call-action.is-decline,
.chat-call-action.is-hangup {
    background: #d84d4d;
    color: #fff;
}


@media (max-width: 600px) {
    .top-bar {
        max-width: 100vw;
        padding: 10px 3vw;
        margin-bottom: 8px;
        gap: 8px;
        flex-wrap: wrap;
        height: auto;
        min-height: 4.5rem;
    }

    .chat-top-bar {
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .chat-top-link {
        margin-bottom: 2px;
        font-size: 0.95rem;
    }

    .chat-top-title {
        font-size: 1rem;
    }

    .chat-top-status {
        margin-top: 2px;
        font-size: 0.8rem;
    }

    .chat-call-button {
        top: 50%;
        left: 12px;
    }

    .chat-header-menu {
        top: 50%;
        right: 12px;
    }

    .chat-call-dialog {
        width: min(94vw, 360px);
        margin-top: 12vh;
        padding: 20px 16px 16px;
    }
}

.user-list {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: right;
    direction: rtl;
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

.user-list li {
    padding: 8px 0;
    direction: rtl;
}

.user-list a {
    color: #ffffff;
    text-decoration: none;
    font-size: 1rem;
    word-break: break-all;
    direction: rtl;
    font-family: inherit;
}

.mine,
.theirs {
    text-align: right;
    margin: 5px;
    border-radius: 5px;
    padding: 5px 12px 5px 5px;
    direction: rtl;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-line;
    max-width: 98%;
    box-sizing: border-box;
}

.mine {
    background: #dcf8c6;
}

.theirs {
    background: #eee;
}

.chat-message-label {
    display: block;
    margin-bottom: 6px;
}

.chat-image {
    display: block;
    max-width: min(320px, 72vw);
    max-height: 360px;
    border-radius: 12px;
    margin-top: 4px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
    object-fit: cover;
}

.chat-message-pending {
    opacity: 0.72;
}

.t {
    font-size: 11px;
    color: #666;
    margin-left: 8px;
    margin-right: 0;
    direction: rtl;
}

.error {
    color: red;
    margin: 10px 0;
    text-align: center;
    direction: rtl;
}

h2 {
    text-align: center !important;
    direction: rtl;
    font-family: inherit;
    margin-bottom: 18px;
    margin-top: 0;
}

label {
    font-family: inherit;
    direction: rtl;
}

form {
    direction: rtl;
    text-align: right;
    font-family: inherit;
}

.search-form {
    max-width: 400px;
    margin: 0 auto 18px auto;
    text-align: right;
}

.search-form {
    max-width: 440px;
    margin: 16px auto 10px auto;
    display: flex;
    flex-direction: row;
    gap: 0;
    justify-content: center;
    align-items: center;
    /*background: #fff;*/
    border-radius: 10px;
    padding: 16px 14px 16px 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    font-family: inherit;
}

.search-form input[type="text"] {
    flex: 1 1 auto;
    font-size: 1.05rem;
    padding: 12px 10px;
    border: 1px solid #bbb;
    border-radius: 8px;
    margin: 0;
    font-family: inherit;
    direction: rtl;
    text-align: right;
    outline: none;
    transition: border 0.2s;
    background: #fafbfc;
}

.search-form input[type="text"]:focus {
    border: 1.5px solid #0077bb;
    background: #fff;
}

.search-form button {
    padding: 12px 0;
    width: 110px;
    border-radius: 8px;
    border: none;
    background: #0077bb;
    color: #fff;
    font-size: 1.1rem;
    font-family: inherit;
    cursor: pointer;
    margin: 0;
    transition: background 0.2s;
}

.search-form button:active,
.search-form button:focus {
    outline: none;
    background: #005fa3;
}

.home-search-error {
    max-width: 440px;
    margin: 4px auto 10px;
}

@media (max-width: 600px) {
    .home-page .app-download-button {
        display: block;
        width: 89vw;
        margin-bottom: 14px;
    }

    .home-download-button {
        margin-top: 130px;
    }

    .home-page .search-form {
        margin-top: 130px;
    }

    .home-page.app-embedded .search-form {
        margin-top: 152px;
    }

    .home-download-button + .search-form {
        margin-top: 15px;
    }

    .login-page .login-box .login-download-button {
        display: block;
        width: 100%;
        max-width: 100%;
        margin: 0 0 12px 0;
    }

    .search-form {
        flex-direction: column;
        padding: 12px 4vw 12px 4vw;
        gap: 8px;
        max-width: 97vw;
    }
    .search-form input[type="text"],
    .search-form button {
        border-radius: 8px !important;
        width: 100% !important;
    }

    .home-search-error {
        margin-top: 0;
        max-width: 97vw;
    }
}

.start-chat-btn {
    /*display: block;
    margin: 30px auto 0 auto;
    padding: 15px 0;
    width: 92%;
    max-width: 350px;
    background: #22c55e;
    color: #fff;
    border-radius: 10px;
    border: none;
    font-size: 1.15rem;
    font-family: inherit;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(34,197,94,0.07);
    text-decoration: none;
    transition: background 0.18s, box-shadow 0.18s;*/
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    z-index: 1;
    backdrop-filter: blur(6px);
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0.5rem;
    padding: 2rem;
    width: 92%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    color: #fff;
    direction: ltr;
    text-decoration: none;
    margin: 30px auto 0 auto;
    padding: 15px 0;
    max-width: 350px;
    font-size: 1.15rem;
    cursor: pointer;
    transition: background 0.18s, box-shadow 0.18s;
}

.recent-chat-thread {
    width: min(80%, 350px);
    margin-top: 8px;
    padding: 12px 16px;
}

.recent-chat-thread-content {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

.recent-chat-thread-avatar {
    width: 3rem;
    height: 3rem;
    font-size: 1.05rem;
}

.recent-chat-thread-label {
    flex: 1 1 auto;
    min-width: 0;
    direction: rtl;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 6px;
}
.start-chat-btn:active,
.start-chat-btn:focus {
    background: #0077bb;
    outline: none;
}

.recent-chats {
    color: #fff;    
    font-size: 1.5rem;
}

#chat-bar {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    max-width: 400px;
    margin: 10px auto 10px auto;
    background: #fff;
    border-radius: 10px;
    padding: 12px 10px 8px 10px;
    box-sizing: border-box;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

#chat-bar textarea {
    flex: 1 1 auto;
    min-height: 50px;
    max-height: 120px;
    resize: none;
    font-size: 1.08rem;
    padding: 10px 8px 10px 8px;
    border: 1px solid #bbb;
    border-radius: 8px;
    direction: rtl;
    text-align: right;
    font-family: inherit;
    margin-left: 8px;
    margin-right: 0;
    outline: none;
    transition: border 0.17s;
    background: #fafbfc;
    box-sizing: border-box;
}

#chat-bar textarea:focus {
    border: 1.5px solid #0077bb;
    background: #fff;
}

#chat-bar button {
    background: #0077bb;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.55rem;
    margin-right: 0;
    margin-left: 4px;
    transition: background 0.18s;
    padding: 0;
    margin-bottom: 4px;
}

#chat-bar button:active,
#chat-bar button:focus {
    background: #005fa3;
    outline: none;
}

#chat-bar button svg {
    width: 27px;
    height: 27px;
    fill: #fff;
    display: block;
}

@media (max-width: 600px) {
    #chat-bar {
        max-width: 97vw;
        padding: 9px 2vw 7px 2vw;
    }
    #chat-bar textarea {
        font-size: 1rem;
    }
    #chat-bar button {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
    }
    #chat-bar button svg {
        width: 22px;
        height: 22px;
    }
}

.chat-container {
    display: flex;
    flex-direction: column;
    min-height: 95vh;
    height: 95vh;
    background: #f4f4f4;
    box-sizing: border-box;
}

#chat-bar {
    position: fixed;
    right: 0;
    left: 0;
    bottom: 0;
    z-index: 99;
    max-width: 100vw;
    width: 100vw;
    border-radius: 0;
    box-shadow: 0 -3px 12px rgba(0,0,0,0.09);
    margin: 0;
}

/*@media (max-width: 600px) {
    #chat-bar {
        padding: 9px 2vw 7px 2vw;
    }
}*/

.chat-box {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    font-size: 1rem;
    direction: rtl;
    margin: 0;
    max-width: 100vw;
    width: 100%;
    background: linear-gradient(135deg, #6b21a8, #9333ea, #a855f7);
    border-radius: 7px;
    padding-top: 88px;
    padding-bottom: 88px;
}
@media (max-width: 600px) {
    .chat-box {
        padding-top: 6rem;
        padding-bottom: 3.5rem;
        max-width: 100vw;
        max-height: none;
        min-height: 0;
        margin-bottom: 0 !important;
    }
}

@media (max-width: 600px) {
    .chat-container {
        min-height: 100vh;
        height: 100vh;
        max-height: 100vh;
        padding-bottom: 8px;
    }
}

.better-list {
    list-style-type: disc;
    list-style-position: outside;
    padding-right: 28px;
    font-size: 15px;
    line-height: 2;
    margin-top: 18px;
    margin-bottom: 0;
    direction: rtl;
}

.better-list li {
    text-align: justify;
    direction: rtl;
    padding-right: 0;
    margin-bottom: 6px;
}

.unread-badge {
    position: absolute;
    top: -15px;
    left: 2px;
    background: #ee2345;
    color: #fff;
    border-radius: 50%;
    min-width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.93rem;
    font-weight: bold;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.13);
    border: 2px solid #fff;
}

.settings-page {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 156px auto 32px auto;
    padding: 18px 16px 0;
}

.settings-card {
    backdrop-filter: blur(6px);
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    color: #fff;
    padding: 22px 20px;
    margin-bottom: 18px;
}

.settings-page > .settings-card:first-of-type {
    margin-top: 1rem;
}

.settings-card h2 {
    color: #fff;
    margin-bottom: 14px;
}

.settings-form label {
    display: block;
    margin-bottom: 8px;
    color: #fff;
    font-size: 0.95rem;
}

/* =========================
   CHAT PAGE REDESIGN
   ========================= */
html.chat-page,
body.chat-page {
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(71, 111, 156, 0.22), transparent 28%),
        radial-gradient(circle at top right, rgba(48, 85, 128, 0.16), transparent 30%),
        linear-gradient(180deg, #0d1722 0%, #13202d 50%, #172635 100%);
    background-attachment: fixed;
}

body.chat-page::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(111, 168, 220, 0.08) 0, rgba(111, 168, 220, 0.08) 2px, transparent 2px),
        radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.04) 0, rgba(255, 255, 255, 0.04) 1.5px, transparent 1.5px),
        linear-gradient(135deg, rgba(255, 255, 255, 0.03), transparent 38%);
    background-size: 120px 120px, 160px 160px, 100% 100%;
    opacity: 0.95;
    pointer-events: none;
}

.chat-page .chat-container {
    position: relative;
    min-height: 100vh;
    height: 100vh;
    background: transparent;
    isolation: isolate;
}

.chat-page .chat-top-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100vw;
    z-index: 999;
    height: auto;
    min-height: 0;
    padding: 14px 24px 12px;
    gap: 3px;
    background: linear-gradient(135deg, #0f1f33 0%, #1b2f47 56%, #29415d 100%);
    border-bottom: 1px solid rgba(214, 186, 130, 0.2);
    box-shadow: 0 10px 28px rgba(8, 14, 24, 0.34);
    box-sizing: border-box;
    overflow: visible;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.chat-page .chat-top-link {
    display: block;
    width: 100%;
    text-align: center;
    color: #f7f1e6;
    font-weight: 700;
}

.chat-page .chat-top-title {
    display: block;
    width: 100%;
    text-align: center;
    color: #f7f1e6;
    font-size: 1.05rem;
    font-weight: 700;
}

.chat-page .chat-top-status {
    display: block;
    width: 100%;
    text-align: center;
    color: rgba(247, 241, 230, 0.78);
}

.chat-page .chat-form {
    margin-bottom: 0;
    text-align: right;
}

.chat-page .chat-page-toast {
    position: fixed;
    top: 146px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 140;
    width: min(680px, calc(100vw - 24px));
    padding: 12px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    color: #9f1239;
    border: 2px solid #dc2626;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
    text-align: center;
    line-height: 1.7;
}

.chat-page .chat-image-modal {
    position: fixed;
    inset: 0;
    z-index: 320;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.chat-page .chat-image-modal[hidden] {
    display: none !important;
}

.chat-page .chat-image-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 13, 23, 0.86);
    backdrop-filter: blur(6px);
}

.chat-page .chat-image-modal-dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: min(920px, calc(100vw - 36px));
    max-height: calc(100vh - 36px);
    padding: 18px 18px 16px;
    border-radius: 22px;
    background: rgba(15, 31, 51, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 24px 54px rgba(0, 0, 0, 0.34);
}

.chat-page .chat-image-modal-image {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: calc(100vh - 144px);
    border-radius: 18px;
    object-fit: contain;
}

.chat-page .chat-image-modal-close {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.94);
    color: #fff;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.chat-page .chat-image-modal-actions {
    display: flex;
    justify-content: center;
    width: 100%;
}

.chat-page .chat-image-modal-save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 148px;
    padding: 12px 18px;
    border-radius: 999px;
    background: #ffffff;
    color: #9f1239;
    border: 2px solid #dc2626;
    text-decoration: none;
    font-weight: 700;
}

.chat-page .chat-attachment-preview {
    position: fixed;
    right: 0;
    left: 0;
    bottom: 92px;
    z-index: 98;
    display: flex;
    align-items: center;
    gap: 12px;
    width: min(960px, calc(100vw - 24px));
    max-width: min(960px, calc(100vw - 24px));
    margin: 0 auto;
    padding: 10px 14px;
    border-radius: 18px;
    background: rgba(15, 31, 51, 0.92);
    color: #f7f1e6;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
}

.chat-page .chat-attachment-thumb {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: cover;
    flex: 0 0 auto;
}

.chat-page .chat-attachment-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.chat-page .chat-attachment-name {
    font-size: 0.92rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: visible;
    text-overflow: ellipsis;
}

.chat-page .chat-attachment-note {
    font-size: 0.78rem;
    color: rgba(247, 241, 230, 0.78);
}

.chat-page .chat-attachment-remove {
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #f7f1e6;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 auto;
}

.chat-page .chat-edit-bar {
    position: fixed;
    right: 0;
    left: 0;
    bottom: 92px;
    z-index: 98;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: min(960px, calc(100vw - 24px));
    max-width: min(960px, calc(100vw - 24px));
    margin: 0 auto;
    padding: 10px 14px;
    border-radius: 18px;
    background: rgba(15, 31, 51, 0.92);
    color: #f7f1e6;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
}

.chat-page .chat-reply-bar {
    position: fixed;
    right: 0;
    left: 0;
    bottom: 92px;
    z-index: 98;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: min(960px, calc(100vw - 24px));
    max-width: min(960px, calc(100vw - 24px));
    margin: 0 auto;
    padding: 10px 14px;
    border-radius: 18px;
    background: rgba(15, 31, 51, 0.92);
    color: #f7f1e6;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
}

.chat-page .chat-reply-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.chat-page .chat-reply-label {
    font-size: 0.82rem;
    color: rgba(247, 241, 230, 0.82);
}

.chat-page .chat-reply-text {
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-page .chat-reply-cancel {
    border: none;
    background: transparent;
    color: #f7f1e6;
    font-family: inherit;
    cursor: pointer;
}

.chat-page .chat-record-bar {
    position: fixed;
    right: 0;
    left: 0;
    bottom: 92px;
    z-index: 98;
    display: flex;
    align-items: center;
    gap: 12px;
    width: min(960px, calc(100vw - 24px));
    max-width: min(960px, calc(100vw - 24px));
    margin: 0 auto;
    padding: 10px 14px;
    border-radius: 18px;
    background: rgba(127, 29, 29, 0.94);
    color: #fff7f7;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
}

.chat-page .chat-record-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fecaca;
    box-shadow: 0 0 0 6px rgba(254, 202, 202, 0.2);
    animation: chat-record-pulse 1.2s ease-in-out infinite;
    flex: 0 0 auto;
}

.chat-page .chat-record-label {
    font-size: 0.9rem;
    line-height: 1.7;
}

.chat-page .chat-sticker-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: linear-gradient(180deg, rgba(7, 13, 23, 0.02), rgba(7, 13, 23, 0.28));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.chat-page .chat-sticker-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.chat-page .chat-sticker-backdrop.is-closing {
    opacity: 0;
    pointer-events: none;
}

.chat-page .chat-sticker-picker {
    position: fixed;
    left: 50%;
    bottom: 92px;
    z-index: 101;
    width: min(960px, calc(100vw - 24px));
    max-width: min(960px, calc(100vw - 24px));
    padding: 8px 12px 14px;
    border-radius: 24px 24px 18px 18px;
    background: rgba(248, 250, 252, 0.98);
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 26px 54px rgba(15, 23, 42, 0.24);
    backdrop-filter: blur(18px);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 14px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.chat-page .chat-form.has-composer-overlay .chat-sticker-picker {
    bottom: 156px;
}

.chat-page .chat-sticker-picker.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.chat-page .chat-sticker-picker.is-closing {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 14px);
}

.chat-page .chat-sticker-picker-handle {
    width: 54px;
    height: 5px;
    margin: 0 auto 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.58);
}

.chat-page .chat-sticker-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 4px 10px;
}

.chat-page .chat-sticker-picker-title {
    color: #10233f;
    font-weight: 700;
    font-size: 0.96rem;
}

.chat-page .chat-sticker-picker-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(15, 31, 51, 0.08);
    color: #173a63;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.chat-page .chat-sticker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 4px;
    max-height: min(46vh, 360px);
    overflow-y: auto;
    padding: 2px 0 4px;
}

.chat-page .chat-sticker-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 2px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #10233f;
    cursor: pointer;
    transition: transform 0.14s ease, background 0.14s ease;
    box-shadow: none;
}

.chat-page .chat-sticker-item:hover {
    transform: scale(1.06);
    background: rgba(37, 99, 235, 0.06);
}

.chat-page .chat-sticker-item-glyph {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 1.65rem;
    line-height: 1;
    pointer-events: none;
}

.chat-page .chat-edit-bar[hidden],
.chat-page .chat-reply-bar[hidden],
.chat-page .chat-record-bar[hidden],
.chat-page .chat-attachment-preview[hidden],
.chat-page .chat-sticker-backdrop[hidden],
.chat-page .chat-sticker-picker[hidden],
.chat-header-menu-panel[hidden],
.chat-action-sheet-overlay[hidden],
.chat-action-sheet-item[hidden] {
    display: none !important;
}

.chat-page .chat-edit-label {
    font-size: 0.92rem;
}

.chat-page .chat-edit-cancel {
    border: none;
    background: transparent;
    color: #f7f1e6;
    font-family: inherit;
    cursor: pointer;
}

.chat-page .chat-reply-reference {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 4px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(15, 31, 51, 0.1);
    border-inline-start: 3px solid rgba(16, 35, 63, 0.3);
    cursor: pointer;
}

.chat-page .chat-message.mine .chat-reply-reference {
    background: rgba(255, 255, 255, 0.16);
    border-inline-start-color: rgba(255, 255, 255, 0.45);
}

.chat-page .chat-reply-reference-author {
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0.9;
}

.chat-page .chat-reply-reference-text {
    font-size: 0.83rem;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.92;
}

.chat-page .group-panel {
    position: fixed;
    top: 10.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: min(960px, calc(100vw - 24px));
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
    z-index: 120;
}

.chat-page .group-panel + .chat-box {
    padding-top: 242px;
}

.chat-page .group-info-disclosure {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chat-page .group-panel-message {
    margin-bottom: 12px;
    width: min(720px, calc(100vw - 24px));
}

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

.chat-page .group-panel-muted {
    font-size: 0.88rem;
    color: #475569;
    margin-top: 4px;
}

.chat-page .group-member-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.chat-page .group-member-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(231, 238, 247, 0.88);
    color: #10233f;
    border: 1px solid rgba(173, 184, 201, 0.32);
}

.chat-page .group-role-badge {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(176, 138, 70, 0.18);
    color: #78571f;
}

.chat-page .group-inline-form {
    margin: 0;
}

.chat-page .group-info-summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 10px;
    padding: 8px 12px;
    background: #0077bb;
    color: #fff;
    font-weight: 700;
    min-width: 164px;
    box-shadow: 0 10px 24px rgba(0, 63, 118, 0.22);
}

.chat-page .group-info-summary::-webkit-details-marker {
    display: none;
}

.chat-page .group-info-body {
    position: relative;
    margin-top: 12px;
    width: min(720px, calc(100vw - 24px));
    padding: 18px 14px 14px;
    border-radius: 18px;
    background: rgba(248, 250, 252, 0.82);
    border: 1px solid rgba(173, 184, 201, 0.28);
}

.chat-page .group-leave-form {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 12px;
}

.chat-page .group-info-close {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(15, 31, 51, 0.1);
    color: #10233f;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.chat-page .group-panel-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-page .group-remove-button,
.chat-page .group-danger-button,
.chat-page .group-manage-submit {
    border: none;
    border-radius: 10px;
    padding: 8px 12px;
    font-family: inherit;
    cursor: pointer;
}

.chat-page .group-remove-button {
    background: rgba(220, 38, 38, 0.12);
    color: #9f1239;
}

.chat-page .group-danger-button {
    background: #dc2626;
    color: #fff;
}

.chat-page .group-manage-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-page .group-rename-disclosure {
    margin-bottom: 14px;
}

.chat-page .group-rename-toggle {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 10px;
    padding: 8px 12px;
    background: rgba(176, 138, 70, 0.14);
    color: #6d4b0f;
    border: 1px solid rgba(176, 138, 70, 0.3);
    font-weight: 700;
}

.chat-page .group-rename-toggle::-webkit-details-marker {
    display: none;
}

.chat-page .group-rename-form {
    margin-top: 10px;
}

.chat-page .group-manage-form label {
    color: #10233f;
    font-weight: 700;
}

.chat-page .group-manage-form textarea {
    width: 100%;
    min-height: 84px;
    resize: vertical;
    border-radius: 14px;
    border: 1px solid rgba(142, 156, 183, 0.35);
    background: rgba(255, 255, 255, 0.86);
    padding: 12px 14px;
    font-family: inherit;
    direction: ltr;
    text-align: left;
}

.chat-page .group-rename-form .group-member-row input {
    direction: rtl;
    text-align: right;
}

.chat-page .group-rename-form .group-member-row input::placeholder {
    direction: rtl;
    text-align: right;
}

.chat-page .group-manage-submit {
    background: linear-gradient(135deg, #b08a46 0%, #d5bb7a 100%);
    color: #1c2430;
    font-weight: 700;
    white-space: nowrap;
}

.chat-page .group-admin-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(173, 184, 201, 0.28);
}

.chat-page .group-member-link {
    color: inherit;
    text-decoration: none;
    font-weight: 700;
}

.chat-page a.group-member-link:hover {
    text-decoration: underline;
}

.chat-page .chat-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 150px 18px 108px;
    background: transparent;
    border-radius: 0;
}

.chat-page.chat-group .chat-box {
    padding-top: 13rem;
}

.chat-page.chat-direct .chat-box {
    padding-top: 11.25rem;
}

.chat-page .chat-message {
    display: flex;
    width: 100%;
    margin: 0;
    padding: 0;
    direction: ltr;
    text-align: initial;
    background: transparent;
    border-radius: 0;
    max-width: none;
    box-shadow: none;
}

.chat-page .chat-message.mine {
    justify-content: flex-end;
}

.chat-page .chat-message.theirs,
.chat-page .chat-message.system {
    justify-content: flex-start;
}

.chat-page .chat-message.system {
    justify-content: center;
}

.chat-page .chat-bubble {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    gap: 6px;
    width: fit-content;
    max-width: min(78%, 34rem);
    padding: 10px 14px;
    border-radius: 20px;
    line-height: 1.65;
    direction: rtl;
    text-align: right;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    box-shadow: 0 10px 26px rgba(46, 64, 97, 0.12);
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.chat-page .chat-message-label {
    align-self: flex-end;
    font-size: 0.74rem;
    line-height: 1.2;
    opacity: 0.88;
}

.chat-page .chat-message.mine .chat-bubble {
    color: #fff;
    background: linear-gradient(135deg, #2f80ff 0%, #5a6ff6 48%, #8a5ff1 100%);
    border-bottom-right-radius: 7px;
}

.chat-page .chat-message.theirs .chat-bubble {
    color: #213047;
    background: rgba(233, 237, 244, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(16px);
    border-bottom-left-radius: 7px;
}

.chat-page .chat-message.system .chat-bubble {
    color: #31445f;
    background: rgba(255, 255, 255, 0.52);
    border: 1px dashed rgba(86, 105, 134, 0.28);
    backdrop-filter: blur(12px);
    font-size: 0.92rem;
}

.chat-page .chat-message.mine .chat-message-label {
    color: rgba(255, 255, 255, 0.78);
}

.chat-page .chat-message.theirs .chat-message-label {
    color: #53657f;
}

.chat-page .chat-message-text {
    font-size: 0.98rem;
}

.chat-page .chat-message-text.is-emoji-only {
    font-size: 2.4rem;
    line-height: 1.2;
}

.chat-page .chat-sticker-message {
    display: flex;
    justify-content: center;
    margin-top: 2px;
}

.chat-page .chat-sticker-image {
    display: block;
    width: min(148px, 42vw);
    max-width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.14));
}

.chat-page .chat-message-image-link {
    display: block;
    text-decoration: none;
    cursor: zoom-in;
}

.chat-page .chat-image {
    margin-top: 0;
}

.chat-page .chat-image-expired {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(15, 31, 51, 0.08);
    color: #4b5563;
    font-size: 0.88rem;
}

.chat-page .chat-voice-card {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: center;
    column-gap: 10px;
    width: min(100%, 320px);
    max-width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(15, 31, 51, 0.08);
}

.chat-page .chat-message.mine .chat-voice-card {
    background: rgba(255, 255, 255, 0.14);
}

.chat-page .chat-voice-card.is-pending {
    position: relative;
    overflow: hidden;
}

.chat-page .chat-voice-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.18);
    color: currentColor;
}

.chat-page .chat-message.theirs .chat-voice-icon {
    background: rgba(16, 35, 63, 0.08);
}

.chat-page .chat-voice-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.chat-page .chat-voice-player {
    width: 100%;
    min-width: 0;
}

.chat-page .chat-voice-audio-element {
    display: none;
}

.chat-page .chat-voice-controls {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto 48px;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.chat-page .chat-voice-play,
.chat-page .chat-voice-speed {
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    flex: 0 0 auto;
}

.chat-page .chat-voice-play {
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.18);
    color: inherit;
    font-size: 0.92rem;
}

.chat-page .chat-message.theirs .chat-voice-play {
    background: rgba(16, 35, 63, 0.08);
}

.chat-page .chat-voice-speed {
    min-width: 48px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.16);
    color: inherit;
    font-size: 0.8rem;
}

.chat-page .chat-message.theirs .chat-voice-speed {
    background: rgba(16, 35, 63, 0.08);
}

.chat-page .chat-voice-progress {
    width: 100%;
    min-width: 0;
    margin: 0;
}

.chat-page .chat-voice-time {
    font-size: 0.76rem;
    opacity: 0.86;
    white-space: nowrap;
}

.chat-page .chat-voice-expired {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(15, 31, 51, 0.08);
    color: #4b5563;
    font-size: 0.88rem;
}

.chat-page .chat-message.is-pending {
    opacity: 0.96;
}

.chat-page .chat-message.is-highlighted .chat-bubble {
    box-shadow: 0 0 0 2px rgba(176, 138, 70, 0.45), 0 10px 26px rgba(46, 64, 97, 0.12);
}

.chat-page .chat-message.is-deleting {
    pointer-events: none;
}

.chat-page .chat-message.is-deleting .chat-bubble {
    animation: chat-delete-powder 0.42s ease-out forwards;
    transform-origin: center right;
}

.chat-page .chat-message.theirs.is-deleting .chat-bubble,
.chat-page .chat-message.system.is-deleting .chat-bubble {
    transform-origin: center left;
}

.chat-page .chat-message.is-pending .chat-bubble {
    overflow: hidden;
}

.chat-page .chat-message-upload-frame {
    position: relative;
    display: block;
}

.chat-page .chat-message-upload-progress {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.chat-page .chat-message-upload-ring {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(8, 15, 26, 0.42);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}

.chat-page .chat-message-upload-ring svg {
    width: 64px;
    height: 64px;
    transform: rotate(-90deg);
}

.chat-page .chat-message-upload-ring-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.22);
    stroke-width: 3;
}

.chat-page .chat-message-upload-ring-fill {
    fill: none;
    stroke: #ffffff;
    stroke-width: 3.5;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.16s linear;
}

.chat-page .chat-message-upload-percent {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.chat-page .chat-message-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    direction: ltr;
}

.chat-page .chat-message-receipt {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: 18px;
    height: 12px;
    flex: 0 0 18px;
    color: rgba(255, 255, 255, 0.9);
}

.chat-page .chat-message-tick {
    position: absolute;
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.chat-page .chat-message-receipt .tick-primary {
    left: 0;
}

.chat-page .chat-message-receipt .tick-secondary {
    left: 5px;
    opacity: 0;
}

.chat-page .chat-message-receipt.is-seen .tick-secondary {
    opacity: 1;
}

.chat-page .chat-message.mine .chat-message-receipt.is-seen {
    color: #dff6ff;
}

.chat-page .chat-message-time {
    margin-left: auto;
    margin-top: 2px;
    font-size: 0.72rem;
    line-height: 1;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.24);
}

.chat-action-sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(9, 17, 27, 0.44);
    opacity: 0;
    transition: opacity 1s ease;
}

.chat-action-sheet {
    position: absolute;
    right: 16px;
    left: 16px;
    bottom: 16px;
    padding: 8px;
    border-radius: 18px;
    background: rgba(248, 250, 252, 0.98);
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.22);
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    opacity: 0;
    transform: translateY(16px) scale(0.98);
    transition: opacity 1s ease, transform 1s ease;
}

.chat-action-sheet-overlay.is-open {
    opacity: 1;
}

.chat-action-sheet-overlay.is-open .chat-action-sheet {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.chat-action-sheet-overlay.is-closing {
    opacity: 0;
}

.chat-action-sheet-overlay.is-closing .chat-action-sheet {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
}

.chat-action-sheet-item {
    display: block;
    width: 100%;
    border: none;
    background: transparent;
    color: #10233f;
    font-family: inherit;
    font-size: 1rem;
    text-align: right;
    padding: 14px 12px;
    border-radius: 12px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.chat-action-sheet-item.is-cancel {
    color: #9f1239;
}

.chat-action-sheet-item:hover {
    background: rgba(16, 35, 63, 0.06);
}

.chat-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 340;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(7, 13, 23, 0.68);
    backdrop-filter: blur(6px);
}

.chat-confirm-overlay[hidden] {
    display: none !important;
}

.chat-confirm-dialog {
    width: min(420px, calc(100vw - 24px));
    padding: 20px 18px 16px;
    border-radius: 18px;
    background: rgba(248, 250, 252, 0.98);
    box-shadow: 0 24px 54px rgba(0, 0, 0, 0.34);
    text-align: right;
    direction: rtl;
}

.chat-confirm-message {
    color: #10233f;
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 16px;
}

.chat-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.chat-confirm-button {
    min-width: 112px;
    border: none;
    border-radius: 12px;
    padding: 11px 16px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
}

.chat-confirm-cancel {
    background: #dbe4ef;
    color: #17324f;
}

.chat-confirm-approve {
    background: #dc2626;
    color: #fff;
}

.chat-page #chat-bar {
    position: fixed;
    right: 0;
    left: 0;
    bottom: 0;
    z-index: 99;
    display: flex;
    align-items: flex-end;
    direction: ltr;
    gap: 10px;
    width: min(960px, calc(100vw - 24px));
    max-width: min(960px, calc(100vw - 24px));
    margin: 0 auto 14px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.52);
    border-radius: 26px;
    box-shadow: 0 18px 42px rgba(51, 65, 95, 0.16);
    backdrop-filter: blur(18px);
}

.chat-page #chat-bar textarea {
    min-height: 48px;
    max-height: 120px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid rgba(142, 156, 183, 0.32);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    color: #10233f;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
    margin-left: 0;
    margin-right: 0;
}

.chat-page #chat-bar #chat-sticker-button {
    order: 1;
}

.chat-page #chat-bar textarea {
    order: 2;
}

.chat-page #chat-bar #attach-image-button {
    order: 3;
}

.chat-page #chat-bar #send-btn {
    order: 4;
}

.chat-page #chat-bar textarea:focus {
    border: 1px solid rgba(84, 111, 235, 0.55);
    background: rgba(255, 255, 255, 0.92);
}

.chat-page #chat-bar button {
    flex: 0 0 auto;
    margin: 0;
    background: linear-gradient(135deg, #2b5f98 0%, #173a63 100%);
    box-shadow: 0 10px 24px rgba(18, 38, 65, 0.35);
}

.chat-page #chat-bar #send-btn {
    position: relative;
    overflow: hidden;
}

.chat-page #chat-bar #send-btn.is-mic-mode {
    background: linear-gradient(135deg, #1f4b78 0%, #12365c 100%);
}

.chat-page #chat-bar #send-btn.is-recording {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
}

.chat-page #chat-bar .chat-send-icon,
.chat-page #chat-bar .chat-mic-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: none;
}

.chat-page #chat-bar .chat-send-icon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.chat-page #chat-bar .chat-mic-icon {
    opacity: 0;
    transform: scale(0.72) rotate(-10deg);
}

.chat-page #chat-bar #send-btn.is-mic-mode .chat-send-icon {
    opacity: 0;
    transform: scale(0.72) rotate(10deg);
}

.chat-page #chat-bar #send-btn.is-mic-mode .chat-mic-icon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.chat-page #chat-bar .chat-attach-button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    padding: 0;
    background: rgba(16, 35, 63, 0.08);
    color: #173a63;
    box-shadow: none;
    border: 1px solid rgba(142, 156, 183, 0.28);
}

.chat-page #chat-bar .chat-attach-button svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.chat-page #chat-bar .chat-attach-button:active,
.chat-page #chat-bar .chat-attach-button:focus {
    background: rgba(16, 35, 63, 0.14);
}

.chat-page #chat-bar .chat-attach-button:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.chat-page #chat-bar .chat-sticker-button {
    background: rgba(16, 35, 63, 0.08);
}

.chat-page #chat-bar .chat-sticker-button.is-active {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.24);
}

.chat-page #chat-bar button:active,
.chat-page #chat-bar button:focus {
    background: linear-gradient(135deg, #234f7d 0%, #102b4a 100%);
}

.chat-page #chat-bar button:disabled,
.chat-page #chat-bar textarea:disabled {
    cursor: not-allowed;
    opacity: 0.72;
}

@keyframes chat-record-pulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.75;
    }
}

@keyframes chat-delete-powder {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
        filter: blur(0) saturate(1);
    }
    45% {
        opacity: 0.8;
        transform: translateY(-2px) scale(0.97) rotate(-1deg);
        filter: blur(1.2px) saturate(0.95);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px) scale(0.82) rotate(-5deg);
        filter: blur(14px) saturate(0.55);
    }
}

@media (max-width: 600px) {
    .chat-page .chat-top-bar {
        height: 92px;
        min-height: 92px;
        max-height: 92px;
        padding: 10px 52px 8px;
        gap: 2px;
        flex-wrap: nowrap;
        overflow: visible;
    }

    .chat-header-menu {
        top: 50%;
        right: 10px;
    }

    .chat-header-menu-toggle {
        padding: 6px 8px;
        font-size: 1.75rem;
    }

    .group-create-panel {
        width: 88vw;
        max-width: 88vw;
    }

    .group-create-panel:not([open]) {
        width: 88vw;
        max-width: 88vw;
    }

    .group-member-row {
        flex-direction: column;
        align-items: stretch;
    }

    .group-member-add-button {
        width: 100%;
    }

    .chat-page .group-panel {
        top: 9.5rem;
        width: calc(100vw - 12px);
    }

    .chat-page .group-panel-message,
    .chat-page .group-info-body {
        width: 100%;
    }

    .chat-page .group-panel-header {
        flex-direction: column;
        align-items: stretch;
    }

    .chat-page .group-panel-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .chat-page .chat-box {
        /*padding: 144px 10px 98px;*/
        gap: 8px;
    }

    .chat-page.chat-group .chat-box {
        padding-top: 13rem;
    }

    .chat-page.chat-direct .chat-box {
        padding-top: 9.8rem;
    }

    .chat-page .group-panel + .chat-box {
        padding-top: 202px;
    }

    .chat-page .chat-bubble {
        max-width: 86%;
        padding: 9px 12px;
    }

    .chat-page .chat-voice-card {
        width: min(100%, 270px);
        padding: 9px 10px;
    }

    .chat-page .chat-voice-controls {
        grid-template-columns: 32px minmax(0, 1fr) auto 44px;
        gap: 5px;
    }

    .chat-page .chat-voice-time {
        font-size: 0.72rem;
    }

    .chat-page .chat-message-text.is-emoji-only {
        font-size: 2rem;
    }

    .chat-page #chat-bar {
        width: calc(100vw - 12px);
        max-width: calc(100vw - 12px);
        margin-bottom: 6px;
        padding: 10px;
        border-radius: 22px;
        gap: 8px;
    }

    .chat-page #chat-bar textarea {
        min-height: 44px;
        font-size: 0.98rem;
        border-radius: 16px;
    }

    .chat-page #chat-bar button {
        width: 44px;
        height: 44px;
        border-radius: 50%;
    }

    .chat-page .chat-edit-bar {
        width: calc(100vw - 12px);
        max-width: calc(100vw - 12px);
        bottom: 82px;
    }

    .chat-page .chat-reply-bar {
        width: calc(100vw - 12px);
        max-width: calc(100vw - 12px);
        bottom: 82px;
    }

    .chat-page .chat-record-bar {
        width: calc(100vw - 12px);
        max-width: calc(100vw - 12px);
        bottom: 82px;
        padding: 10px 12px;
    }

    .chat-page .chat-sticker-picker {
        width: calc(100vw - 12px);
        max-width: calc(100vw - 12px);
        bottom: 82px;
        padding: 8px 10px 12px;
    }

    .chat-page .chat-form.has-composer-overlay .chat-sticker-picker {
        bottom: 140px;
    }

    .chat-page .chat-sticker-grid {
        grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
        gap: 3px;
        max-height: min(44vh, 320px);
    }

    .chat-page .chat-sticker-item {
        min-height: 46px;
        padding: 1px;
        border-radius: 10px;
    }

    .chat-page .chat-sticker-item-glyph {
        width: 34px;
        height: 34px;
        font-size: 1.38rem;
    }

    .chat-page .chat-page-toast {
        top: 136px;
        width: calc(100vw - 12px);
    }

    .chat-page .chat-image-modal {
        padding: 10px;
    }

    .chat-page .chat-image-modal-dialog {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        padding: 14px;
        margin-top: 75px;
    }

    .chat-page .chat-image-modal-image {
        max-height: calc(100vh - 132px);
    }

    .chat-page .chat-attachment-preview {
        width: calc(100vw - 12px);
        max-width: calc(100vw - 12px);
        bottom: 82px;
        padding: 10px 12px;
    }

    .chat-page .chat-sticker-image {
        width: min(132px, 46vw);
    }

    .chat-page .chat-top-link,
    .chat-page .chat-top-title,
    .chat-page .chat-top-status {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.settings-form input {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    outline: none;
}

.settings-form input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.settings-form input[type="file"] {
    padding: 10px 12px;
    cursor: pointer;
}

.settings-profile-preview-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.settings-form button {
    padding: 12px 18px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(90deg, #06b6d4, #0ea5e9, #38bdf8);
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}

.settings-form button:disabled {
    opacity: 0.7;
    cursor: wait;
}

.settings-form .settings-danger-button {
    background: linear-gradient(90deg, #dc2626, #b91c1c);
    color: #fff;
}

.settings-form .settings-danger-button:disabled {
    opacity: 0.7;
}

.settings-muted {
    color: rgba(255, 255, 255, 0.92);
    margin-bottom: 14px;
    line-height: 1.8;
}

.settings-admin-stat-label {
    color: rgba(247, 241, 230, 0.8);
    text-align: center;
    margin-bottom: 10px;
}

.settings-admin-stat-value {
    text-align: center;
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1;
    color: #fff8e8;
}

.settings-message {
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
}

.success-message {
    background: rgba(22, 163, 74, 0.75);
    color: #fff;
}

.error-message {
    background: rgba(220, 38, 38, 0.72);
    color: #fff;
}

@media (max-width: 600px) {
    .home-top-bar {
        min-height: 0;
        flex-wrap: nowrap;
        align-items: center;
    }

    .home-top-bar-meta {
        width: auto;
        align-items: flex-start;
    }

    .home-top-bar-actions {
        width: auto;
        flex-wrap: wrap;
    }

    .settings-page {
        margin-top: 156px;
        padding: 18px 10px 20px 10px;
    }

    .settings-page > .settings-card:first-of-type {
        margin-top: 1rem;
    }

    .top-bar-account-email {
        display: none;
    }

    .recent-chat-thread {
        width: 92%;
    }

    .chat-top-avatar {
        right: 2.5rem;
    }

    .chat-page .chat-header-menu {
        right: 12px;
    }
}
