html {
    font-size: 120%;
    scroll-behavior: smooth;
}

@font-face {
    font-family: 'ParastooLocalized';
    src:
        local('Parastoo'),
        url('../font_file.php?name=Parastoo.woff2') format('woff2'),
        url('../font_file.php?name=Parastoo.woff') format('woff'),
        url('../font_file.php?name=Parastoo.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range:
        U+0600-06FF,
        U+0750-077F,
        U+08A0-08FF,
        U+FB50-FDFF,
        U+FE70-FEFF,
        U+200C,
        U+200D,
        U+061C;
}

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

.app-page-loader {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: linear-gradient(180deg, rgba(244, 244, 244, 0.98), rgba(238, 242, 247, 0.96));
    color: #17324f;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.login-page .app-page-loader {
    background: linear-gradient(135deg, rgba(107, 33, 168, 0.96), rgba(147, 51, 234, 0.94), rgba(168, 85, 247, 0.92));
    color: #fff;
}

.home-page .app-page-loader,
.chat-page .app-page-loader {
    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, rgba(13, 23, 34, 0.98) 0%, rgba(19, 32, 45, 0.97) 50%, rgba(23, 38, 53, 0.96) 100%);
    color: #f7f1e6;
}

.app-page-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.app-page-loader-spinner {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border: 3px solid rgba(23, 50, 79, 0.14);
    border-top-color: #2563eb;
    animation: app-page-loader-spin 0.85s linear infinite;
}

.login-page .app-page-loader-spinner,
.home-page .app-page-loader-spinner,
.chat-page .app-page-loader-spinner {
    border-color: rgba(255, 255, 255, 0.18);
    border-top-color: #ffffff;
}

.app-page-loader-text {
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.6;
}

@keyframes app-page-loader-spin {
    to {
        transform: rotate(360deg);
    }
}

/* =========================
   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 .auth-login-box {
    max-width: 440px;
}

.login-page-shell {
    position: relative;
    z-index: 1;
    width: min(92vw, 1100px);
    margin: 64px auto 32px;
    display: grid;
    grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
    align-items: start;
    gap: 24px;
    box-sizing: border-box;
}

.auth-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.auth-brand-logo {
    width: 5rem;
    height: 5rem;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.28)) drop-shadow(0 3px 6px rgba(15, 23, 42, 0.16));
}

.auth-mode-toggle {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
    padding: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    overflow: hidden;
}

.auth-mode-toggle::before {
    content: "";
    position: absolute;
    top: 6px;
    right: 6px;
    bottom: 6px;
    width: calc(50% - 4px);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.12));
    border: 1px solid rgba(255, 255, 255, 0.24);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(12px);
    transform: translateX(0);
    transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.auth-mode-toggle[data-auth-mode="register"]::before {
    transform: translateX(calc(-100% - 8px));
}

.auth-mode-button {
    position: relative;
    z-index: 1;
    width: auto !important;
    margin: 0 !important;
    border: none;
    border-radius: 999px;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.72);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 10px 14px;
    cursor: pointer;
    box-shadow: none !important;
    transition: color 0.22s ease, font-weight 0.22s ease, transform 0.22s ease, opacity 0.22s ease;
}

.auth-mode-button.is-active {
    color: #fff;
    font-weight: 800;
}

.auth-mode-button:not(.is-active):hover {
    color: rgba(255, 255, 255, 0.92);
}

.auth-form-shell {
    margin-bottom: 12px;
}

.auth-form-stage {
    position: relative;
    perspective: 1600px;
    transition: height 0.3s ease;
}

.auth-form-card {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.72s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-form-shell[data-auth-mode="register"] .auth-form-card {
    transform: rotateY(180deg);
}

.auth-form-face {
    position: absolute;
    inset: 0;
    width: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.auth-form-face-inner {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.auth-form-face-register {
    transform: rotateY(180deg);
}

.auth-form-title {
    margin: 0 0 6px;
    text-align: center;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
}

.auth-form-note {
    margin: 0 0 14px;
    text-align: center;
    line-height: 1.75;
    font-size: 0.86rem;
    color: rgba(255, 255, 255, 0.86);
}

.auth-stay-toggle {
    margin-top: 2px;
}

.auth-submit-button-register {
    background: linear-gradient(90deg, #22c55e, #16a34a, #4ade80) !important;
}

.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 .login-stay-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.8rem;
    margin: 0.1rem 0 1rem;
    cursor: pointer;
    user-select: none;
    color: rgba(255, 255, 255, 0.96);
}

.login-page .login-box .login-stay-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: auto;
    margin: 0;
}

.login-page .login-box .login-stay-toggle-track {
    position: relative;
    width: 3.15rem;
    height: 1.78rem;
    flex: 0 0 auto;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-page .login-box .login-stay-toggle-thumb {
    position: absolute;
    top: 50%;
    right: 0.2rem;
    width: 1.34rem;
    height: 1.34rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.28);
    transform: translateY(-50%);
    transition: right 0.22s ease, background-color 0.22s ease, transform 0.22s ease;
}

.login-page .login-box .login-stay-toggle input:checked + .login-stay-toggle-track {
    background: linear-gradient(135deg, #22d3ee, #38bdf8);
    border-color: rgba(255, 255, 255, 0.42);
    box-shadow: 0 8px 18px rgba(34, 211, 238, 0.28);
}

.login-page .login-box .login-stay-toggle input:checked + .login-stay-toggle-track .login-stay-toggle-thumb {
    right: calc(100% - 1.54rem);
    background: #ecfeff;
}

.login-page .login-box .login-stay-toggle input:focus-visible + .login-stay-toggle-track {
    outline: 2px solid rgba(186, 230, 253, 0.95);
    outline-offset: 2px;
}

.login-page .login-box .login-stay-toggle-text {
    font-size: 0.94rem;
    line-height: 1.5;
}

.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: 10px auto 24px auto;
        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: 1rem;
    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: 'ParastooLocalized', Arial, "Segoe UI", Tahoma, 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: 9rem;
}

.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;
}

.app-guide {
    width: min(92%, 960px);
    margin: 0 auto 18px;
    box-sizing: border-box;
    border-radius: 22px;
    overflow: hidden;
    direction: rtl;
    scroll-margin-top: 132px;
}

.app-guide-login {
    width: 100%;
    margin: 0;
}

.app-guide-summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    text-align: right;
}

.app-guide-summary::-webkit-details-marker {
    display: none;
}

.app-guide-summary-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
    flex: 1 1 auto;
}

.app-guide-summary-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.app-guide-summary-title {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.5;
}

.app-guide-summary-hint {
    font-size: 0.85rem;
    opacity: 0.86;
}

.app-guide-summary-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: transform 0.22s ease, background 0.22s ease;
}

.app-guide-summary-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.app-guide-panel {
    height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0 18px;
    transition: height 0.34s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease, padding 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.app-guide.is-open .app-guide-panel,
.app-guide.is-opening .app-guide-panel,
.app-guide.is-closing .app-guide-panel {
    display: block;
}

.app-guide.is-open .app-guide-panel,
.app-guide.is-opening .app-guide-panel {
    opacity: 1;
    padding-bottom: 18px;
}

.app-guide.is-open .app-guide-summary-icon,
.app-guide.is-opening .app-guide-summary-icon {
    transform: rotate(180deg);
}

.app-guide-home {
    background: rgba(10, 22, 37, 0.6);
    border: 1px solid rgba(214, 186, 130, 0.18);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(12px);
}

.app-guide-home .app-guide-summary {
    background:
        radial-gradient(circle at top right, rgba(214, 186, 130, 0.18), transparent 34%),
        linear-gradient(135deg, rgba(18, 39, 62, 0.94), rgba(26, 55, 85, 0.9));
    color: #f7f1e6;
}

.app-guide-home .app-guide-summary-badge {
    background: rgba(214, 186, 130, 0.16);
    border: 1px solid rgba(214, 186, 130, 0.28);
    color: #f6e6bf;
}

.app-guide-home .app-guide-summary-icon {
    background: rgba(255, 255, 255, 0.1);
    color: #f7f1e6;
}

.app-guide-login {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(10px);
}

.app-guide-login .app-guide-summary {
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.12), transparent 38%),
        linear-gradient(135deg, rgba(122, 54, 191, 0.84), rgba(147, 51, 234, 0.72));
    color: #fff;
}

.app-guide-login .app-guide-summary-badge {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #fff;
}

.app-guide-login .app-guide-summary-icon {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.app-guide-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: start;
    padding: 18px;
    border-radius: 18px;
    margin-top: 18px;
}

.app-guide-home .app-guide-hero {
    background: linear-gradient(145deg, rgba(214, 186, 130, 0.14), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(214, 186, 130, 0.16);
    color: #f8fafc;
}

.app-guide-login .app-guide-hero {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06));
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #fff;
}

.app-guide-hero-label {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    margin-bottom: 10px;
    font-size: 0.84rem;
    font-weight: 800;
}

.app-guide-home .app-guide-hero-label {
    background: rgba(214, 186, 130, 0.16);
    color: #f6e6bf;
}

.app-guide-login .app-guide-hero-label {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.app-guide-hero-title {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.6;
}

.app-guide-hero-text {
    margin: 10px 0 0;
    font-size: 0.96rem;
    line-height: 1.95;
    opacity: 0.94;
}

.app-guide-hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    align-content: flex-start;
    max-width: 220px;
}

.app-guide-hero-tag {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.app-guide-hero-tag:hover {
    transform: translateY(-1px);
}

.app-guide-home .app-guide-hero-tag {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(214, 186, 130, 0.18);
    color: #f7f1e6;
}

.app-guide-home .app-guide-hero-tag:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(214, 186, 130, 0.28);
    box-shadow: 0 10px 20px rgba(8, 14, 24, 0.14);
}

.app-guide-login .app-guide-hero-tag {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #fff;
}

.app-guide-login .app-guide-hero-tag:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.24);
    box-shadow: 0 10px 20px rgba(67, 22, 111, 0.18);
}

.app-guide-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.app-guide-card,
.app-guide-feature-block {
    scroll-margin-top: 152px;
}

.app-guide-card {
    border-radius: 18px;
    padding: 18px;
}

.app-guide-home .app-guide-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(214, 186, 130, 0.14);
    color: #f8fafc;
}

.app-guide-login .app-guide-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #fff;
}

.app-guide-card-eyebrow {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    margin-bottom: 8px;
    opacity: 0.88;
}

.app-guide-card-title {
    margin: 0 0 10px;
    font-size: 1.02rem;
    line-height: 1.75;
}

.app-guide-card-text {
    margin: 0 0 10px;
    line-height: 1.95;
    font-size: 0.95rem;
}

.app-guide-card-list {
    margin: 0;
    padding-right: 18px;
    line-height: 1.95;
}

.app-guide-card-list li + li {
    margin-top: 6px;
}

.app-guide-card-list-numbered {
    list-style: arabic-indic;
}

.app-guide-feature-stack {
    display: grid;
    gap: 14px;
}

.app-guide-feature-block {
    border-radius: 16px;
    padding: 14px 14px 12px;
}

.app-guide-home .app-guide-feature-block {
    background: rgba(10, 22, 37, 0.34);
    border: 1px solid rgba(214, 186, 130, 0.12);
}

.app-guide-login .app-guide-feature-block {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.app-guide-feature-title,
.app-guide-feature-subtitle {
    margin: 0 0 10px;
    font-size: 0.96rem;
    font-weight: 800;
    line-height: 1.75;
}

.app-guide-feature-subtitle {
    margin-top: 12px;
}

.app-guide-note {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    line-height: 1.9;
    font-size: 0.9rem;
}

.app-guide-home .app-guide-note {
    background: rgba(214, 186, 130, 0.12);
    color: #f6e6bf;
}

.app-guide-login .app-guide-note {
    background: rgba(255, 255, 255, 0.1);
    color: #fff6d7;
}

@media (max-width: 980px) {
    .login-page-shell {
        grid-template-columns: minmax(0, 1fr);
        width: min(92vw, 560px);
    }

    .login-page-shell .app-guide-login {
        width: 100%;
        order: -1;
    }

    .login-page-shell .auth-login-box {
        width: 100%;
        max-width: none;
    }

    .app-guide-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .login-page-shell {
        margin-top: 36px;
        gap: 18px;
    }

    .app-guide {
        width: min(94%, 960px);
    }

    .login-page-shell .app-guide-login {
        width: 100%;
    }

    .app-guide-summary {
        padding: 13px 14px;
        align-items: flex-start;
    }

    .app-guide-summary-title {
        font-size: 0.96rem;
    }

    .app-guide-summary-hint {
        font-size: 0.8rem;
    }

    .app-guide-hero {
        grid-template-columns: minmax(0, 1fr);
        padding: 14px;
    }

    .app-guide-hero-tags {
        max-width: none;
        justify-content: flex-start;
    }

    .app-guide-card,
    .app-guide-feature-block {
        padding: 14px;
    }
}

.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;
    direction: rtl;
}

.site-notice-summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 40px;
    padding: 8px 14px;
    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);
    transition: background 0.2s ease, transform 0.2s ease;
    direction: rtl;
    text-align: right;
}

.site-notice-summary:hover {
    background: linear-gradient(180deg, #e33434 0%, #c61f1f 100%);
}

.site-notice-summary-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
    flex-wrap: nowrap;
}

.site-notice-summary-title {
    font-size: 0.96rem;
    line-height: 1.2;
    flex: 0 0 auto;
}

.site-notice-summary-hint {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 232, 232, 0.94);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1 1 auto;
}

.site-notice-summary-date {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 0.9rem;
    color: #fff3f3;
    white-space: nowrap;
    flex: 0 0 auto;
}

.site-notice-summary-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.22s ease, background 0.22s ease;
}

.site-notice-summary-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

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

.site-notice.is-open .site-notice-summary-icon,
.site-notice.is-opening .site-notice-summary-icon {
    transform: rotate(180deg);
    background: rgba(255, 255, 255, 0.22);
}

.site-notice-panel {
    height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: min(58vh, 550px);
    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);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    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-block;
    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;
    flex-wrap: wrap;
    gap: 10px;
}

.site-notice-admin-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: row-reverse;
    gap: 12px;
    min-height: 42px;
    padding: 0 14px 0 0;
    overflow: hidden;
    background: rgba(214, 186, 130, 0.16);
    border-color: rgba(214, 186, 130, 0.34);
    color: #fff8e8;
}

.site-notice-telegram-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 16px;
    background: rgba(102, 192, 255, 0.16);
    border-color: rgba(102, 192, 255, 0.34);
    color: #eef9ff;
}

.site-notice-admin-avatar {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin: 0;
}

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

.site-notice-telegram-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.site-notice-telegram-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.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);
}

@media (max-width: 600px) {
    .site-notice-summary {
        gap: 8px;
        padding: 8px 12px;
    }

    .site-notice-summary-main {
        gap: 6px;
    }

    .site-notice-summary-title {
        font-size: 0.92rem;
    }

    .site-notice-summary-hint {
        font-size: 0.74rem;
    }

    .site-notice-summary-date {
        max-width: 42vw;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.72rem;
        padding: 0 8px;
    }
}

.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-launcher {
    position: absolute;
    top: 50%;
    left: 18px;
    transform: translateY(-50%);
    z-index: 30;
}

.chat-call-button {
    position: relative;
    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(-1px);
}

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

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

.chat-top-avatar-static {
    right: 18px;
}

.chat-top-profile-trigger {
    cursor: pointer;
}

.chat-top-avatar.chat-top-profile-trigger,
.chat-top-title-button {
    border: none;
    background: transparent;
    padding: 0;
    font: inherit;
    color: inherit;
}

.chat-top-title-button {
    cursor: pointer;
}

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

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

.chat-call-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 170px;
    padding: 8px;
    border-radius: 18px;
    background: rgba(27, 35, 58, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28);
    display: grid;
    gap: 6px;
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

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

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

.chat-call-panel-item {
    border: none;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: #f7f1e6;
    min-height: 44px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
    font: inherit;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.chat-call-panel-item:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.chat-call-panel-item:disabled {
    opacity: 0.45;
    cursor: default;
    transform: none;
}

.chat-call-panel-item-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.chat-call-panel-item-icon svg {
    width: 18px;
    height: 18px;
    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-video-overlay {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    box-sizing: border-box;
}

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

.chat-video-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 10, 20, 0.82);
    backdrop-filter: blur(8px);
}

.chat-video-dialog {
    position: relative;
    z-index: 1;
    width: min(96vw, 960px);
    max-height: min(calc(100vh - 36px), 760px);
    display: flex;
    flex-direction: column;
    padding: 18px 18px 16px;
    border-radius: 26px;
    background: linear-gradient(160deg, rgba(10, 18, 30, 0.98), rgba(21, 37, 58, 0.96));
    border: 1px solid rgba(214, 186, 130, 0.18);
    box-shadow: 0 28px 64px rgba(0, 0, 0, 0.4);
    color: #f8fafc;
    text-align: center;
    box-sizing: border-box;
    overflow: hidden;
}

.chat-video-title {
    margin-top: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.45;
    color: #fff;
}

.chat-video-status {
    margin-top: 6px;
    font-size: 0.96rem;
    line-height: 1.7;
    color: rgba(241, 245, 249, 0.92);
}

.chat-video-status:empty {
    display: none;
}

.chat-video-note {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.78rem;
    line-height: 1.8;
    color: rgba(226, 232, 240, 0.9);
}

.chat-video-stage {
    position: relative;
    margin-top: 12px;
    flex: 1 1 auto;
    aspect-ratio: 4 / 5;
    min-height: clamp(320px, 58vh, 560px);
    max-height: min(62vh, 640px);
    border-radius: 22px;
    overflow: hidden;
    background: linear-gradient(160deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.9));
}

.chat-video-remote,
.chat-video-local {
    display: block;
    object-fit: cover;
    background: #0f172a;
}

.chat-video-remote {
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.chat-video-remote-freeze {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    background: #0f172a;
    pointer-events: none;
    z-index: 1;
}

.chat-video-remote-freeze[hidden] {
    display: none;
}

.chat-video-remote-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    text-align: center;
    color: rgba(226, 232, 240, 0.88);
    font-size: 0.95rem;
    line-height: 1.8;
    pointer-events: none;
    background: linear-gradient(160deg, rgba(15, 23, 42, 0.18), rgba(30, 41, 59, 0.12));
    z-index: 2;
}

.chat-video-local {
    position: absolute;
    left: 14px;
    top: 14px;
    width: min(22%, 144px);
    aspect-ratio: 3 / 4;
    border-radius: 18px;
    border: 2px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.28);
    z-index: 3;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.chat-video-local.is-dragging {
    cursor: grabbing;
}

.chat-video-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    flex: 0 0 auto;
}

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

.chat-voice-modal[hidden] {
    display: none;
}

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

.chat-voice-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(92vw, 360px);
    margin: 0;
    padding: 24px 20px 18px;
    border-radius: 24px;
    background: linear-gradient(165deg, rgba(127, 29, 29, 0.98), rgba(153, 27, 27, 0.96));
    border: 1px solid rgba(254, 202, 202, 0.2);
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.34);
    color: #fff7f7;
    text-align: center;
}

.chat-voice-modal-eyebrow {
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    opacity: 0.84;
}

.chat-voice-modal-status {
    margin-top: 10px;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.7;
}

.chat-voice-modal-timer {
    margin-top: 12px;
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
    color: #fff;
}

.chat-voice-modal-note {
    margin-top: 14px;
    padding: 11px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.84rem;
    line-height: 1.8;
    color: rgba(255, 245, 245, 0.94);
}

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

.chat-voice-modal-button {
    min-width: 118px;
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    font-family: inherit;
    font-size: 0.96rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.chat-voice-modal-button:hover {
    transform: translateY(-1px);
}

.chat-voice-modal-button.is-send {
    background: #fff8f8;
    color: #991b1b;
}

.chat-voice-modal-button.is-cancel {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.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-launcher {
        left: 12px;
    }

    .chat-call-panel {
        min-width: 158px;
    }

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

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

    .chat-video-dialog {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        padding: 12px 12px 14px;
        margin-top: 10px;
        border-radius: 22px;
    }

    .chat-video-stage {
        height: min(56vh, 460px);
        min-height: min(56vh, 460px);
        max-height: min(56vh, 460px);
        aspect-ratio: 4 / 5;
    }

    .chat-video-local {
        width: 28%;
        max-width: 104px;
        left: 10px;
        top: 10px;
        border-radius: 14px;
    }

    .chat-voice-modal-dialog {
        width: min(94vw, 360px);
        margin-top: 12vh;
        padding: 22px 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(380px, 78vw);
    max-height: 420px;
    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-group {
    background-color: rgba(232, 193, 112, 0.1);
    border-color: rgba(232, 193, 112, 0.34);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(232, 193, 112, 0.08);
}

.recent-chat-thread-unread {
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.38), rgba(220, 38, 38, 0.28));
    border-color: rgba(254, 202, 202, 0.56);
    box-shadow: 0 10px 30px rgba(127, 29, 29, 0.28), inset 0 0 0 1px rgba(254, 202, 202, 0.12);
}

.recent-chat-thread-unread:hover {
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.46), rgba(220, 38, 38, 0.34));
    box-shadow: 0 12px 32px rgba(127, 29, 29, 0.32), inset 0 0 0 1px rgba(254, 202, 202, 0.16);
}

.recent-chat-thread-reacted {
    background: linear-gradient(135deg, rgba(95, 33, 76, 0.32), rgba(190, 24, 93, 0.2));
    border-color: rgba(253, 164, 175, 0.42);
    box-shadow: 0 10px 30px rgba(136, 19, 55, 0.2), inset 0 0 0 1px rgba(253, 164, 175, 0.08);
}

.recent-chat-thread-reacted:hover {
    background: linear-gradient(135deg, rgba(95, 33, 76, 0.4), rgba(190, 24, 93, 0.26));
    box-shadow: 0 12px 32px rgba(136, 19, 55, 0.24), inset 0 0 0 1px rgba(253, 164, 175, 0.12);
}

.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;
}

.recent-chat-thread-kind {
    flex: 0 0 auto;
    margin-right: 10px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(232, 193, 112, 0.18);
    border: 1px solid rgba(232, 193, 112, 0.3);
    color: #f6e6bf;
    font-size: 0.78rem;
    line-height: 1;
}

.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 {
    position: relative;
    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.7rem;
    font-weight: bold;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.13);
    border: 2px solid #fff;
}

.reaction-badge {
    position: absolute;
    top: -15px;
    left: 2px;
    background: linear-gradient(135deg, #be185d, #e11d48);
    color: #fff;
    border-radius: 999px;
    min-width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    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-security-banner {
    position: fixed;
    top: 216px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 139;
    width: min(680px, calc(100vw - 24px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 248, 220, 0.98);
    color: #713f12;
    border: 2px solid rgba(217, 119, 6, 0.92);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
    line-height: 1.8;
}

.chat-page .chat-security-banner[hidden] {
    display: none !important;
}

.chat-page .chat-security-banner-body {
    flex: 1 1 auto;
}

.chat-page .chat-security-banner-action {
    flex: 0 0 auto;
    border: none;
    border-radius: 999px;
    padding: 9px 14px;
    background: #b45309;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.chat-page .chat-date-float {
    position: fixed;
    /* top-bar (4.5rem) + site-notice-summary (~54px) + 6px gap */
    top: calc(5.5rem + 60px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 130;
    padding: 5px 14px;
    border-radius: 999px;
    background: rgba(15, 31, 51, 0.82);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: opacity 0.25s ease;
}

.chat-page .chat-date-float[hidden] {
    display: none !important;
}


.chat-page .chat-image-modal {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    box-sizing: border-box;
}

.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: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: min(920px, 100%);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 14px 14px 12px;
    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);
    overflow: hidden;
    box-sizing: border-box;
}

.chat-page .chat-image-modal-image {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    width: auto;
    max-width: 100%;
    max-height: 100%;
    border-radius: 18px;
    object-fit: contain;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
    transition: transform 0.18s ease, opacity 0.18s ease;
    will-change: transform, opacity;
}

.chat-page .chat-image-modal-image.is-dragging {
    transition: none;
    cursor: grabbing;
}

.chat-page .chat-image-modal-close {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 4;
    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%;
    flex-shrink: 0;
}

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

/* ── Video Modal (Telegram-style overlay player) ── */
.chat-page .chat-video-modal {
    position: fixed;
    inset: 0;
    z-index: 1450;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

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

.chat-page .chat-video-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 10, 20, 0.92);
    backdrop-filter: blur(8px);
}

.chat-page .chat-video-modal-dialog {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: min(96vw, 860px);
    max-height: calc(100vh - 36px);
    border-radius: 22px;
    background: rgba(10, 20, 38, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 28px 64px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    padding: 0;
}

.chat-page .chat-video-modal-close {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 4;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(220, 38, 38, 0.88);
    color: #fff;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.chat-page .chat-video-modal-video {
    display: block;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    object-fit: contain;
    background: #000;
    border-radius: 22px 22px 0 0;
}

.chat-page .chat-video-modal-controls {
    flex: 0 0 auto;
    width: 100%;
    padding: 10px 16px 4px;
    background: rgba(10, 20, 38, 0.97);
    box-sizing: border-box;
}

.chat-page .chat-video-modal-progress-wrap {
    width: 100%;
    padding: 4px 0;
}

.chat-page .chat-video-modal-progress {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.18);
    outline: none;
    cursor: pointer;
    accent-color: #e11d48;
    direction: ltr;
    writing-mode: horizontal-tb;
}

.chat-page .chat-video-modal-progress::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e11d48;
    cursor: pointer;
    box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.35);
}

.chat-page .chat-video-modal-progress::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e11d48;
    cursor: pointer;
    border: none;
}

.chat-page .chat-video-modal-ctrl-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 0 8px;
}

.chat-page .chat-video-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: background 0.15s;
}

.chat-page .chat-video-modal-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-page .chat-video-modal-play-btn {
    width: 48px;
    height: 48px;
    background: rgba(225, 29, 72, 0.18);
    border: 2px solid rgba(225, 29, 72, 0.5);
    margin: 0 6px;
}

.chat-page .chat-video-modal-play-btn svg {
    display: block;
}

.chat-page .chat-video-modal-play-btn svg[hidden] {
    display: none !important;
}

.chat-page .chat-video-modal-play-btn:hover {
    background: rgba(225, 29, 72, 0.32);
}

.chat-page .chat-video-modal-time {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.6);
    font-variant-numeric: tabular-nums;
    margin-right: auto;
    padding-right: 4px;
}

.chat-page .chat-video-modal-actions {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 8px 16px 14px;
    background: rgba(10, 20, 38, 0.97);
    box-sizing: border-box;
}

.chat-page .chat-video-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;
}

/* ── Video thumbnail in chat bubble (replaces inline player) ── */
.chat-page .chat-video-thumb {
    position: relative;
    display: inline-block;
    width: min(100%, 380px);
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    background: #000;
    margin-top: 4px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.chat-page .chat-bubble.has-visual-media .chat-image,
.chat-page .chat-bubble.has-visual-media .chat-video-thumb {
    margin-top: 0;
}

.chat-page .chat-video-thumb-el {
    display: block;
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    pointer-events: none;
}

.chat-page .chat-video-thumb-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.28);
    transition: background 0.18s;
}

.chat-page .chat-video-thumb:hover .chat-video-thumb-overlay {
    background: rgba(0, 0, 0, 0.42);
}

.chat-page .chat-video-thumb-play-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(225, 29, 72, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s, background 0.15s;
}

.chat-page .chat-video-thumb:hover .chat-video-thumb-play-icon {
    transform: scale(1.08);
    background: rgba(225, 29, 72, 1);
}

.chat-page .chat-video-thumb-play-icon svg {
    margin-left: 3px;
}

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

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

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

.chat-page .chat-profile-modal-dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: min(420px, calc(100vw - 36px));
    padding: 28px 22px 22px;
    border-radius: 24px;
    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-profile-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-profile-modal-avatar-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.chat-page .chat-profile-modal-avatar-image,
.chat-page .chat-profile-modal-avatar-placeholder {
    width: 168px;
    height: 168px;
    border-radius: 50%;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

.chat-page .chat-profile-modal-avatar-image {
    object-fit: cover;
    display: block;
}

.chat-page .chat-profile-modal-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 3.4rem;
}

.chat-page .chat-profile-modal-name {
    color: #f7f1e6;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
}

.chat-page .chat-profile-modal-email {
    color: rgba(247, 241, 230, 0.82);
    font-size: 0.98rem;
    direction: ltr;
    text-align: center;
    word-break: break-word;
}

.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-video {
    background: rgba(15, 31, 51, 0.24);
}

.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-video-overlay[hidden],
.chat-page .chat-voice-modal[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-info-disclosure {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chat-page.group-info-open {
    overflow: hidden;
}

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

.chat-page .group-member-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-page .group-avatar-preview {
    display: flex;
    justify-content: center;
    flex: 0 0 auto;
}

.chat-page .group-avatar-preview-image {
    width: 5.75rem;
    height: 5.75rem;
    font-size: 2rem;
}

.chat-page .group-member-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(241, 245, 249, 0.9);
    color: #10233f;
    border: 1px solid rgba(173, 184, 201, 0.28);
}

.chat-page .group-member-item-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    width: 100%;
}

.chat-page .group-member-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.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 {
    display: none;
}

.chat-page .group-info-trigger {
    position: absolute;
    top: 50%;
    left: 18px;
    transform: translateY(-50%);
    z-index: 30;
    width: 3rem;
    height: 3rem;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.18s ease;
}

.chat-page .group-info-trigger:hover {
    background: rgba(255, 255, 255, 0.24);
}

.chat-page .group-info-trigger svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.chat-page .group-info-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
    z-index: 2500;
}

.chat-page .group-info-disclosure[open] .group-info-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.chat-page .group-info-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.chat-page .group-info-body {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: min(780px, calc(100vw - 24px));
    max-height: min(96vh, 1440px);
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 26px 18px 18px;
    transition: min-height 0.34s ease;
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 247, 251, 0.98) 100%);
    border: 1px solid rgba(173, 184, 201, 0.24);
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.26);
}

.chat-page .group-info-body.has-open-section {
    min-height: 30rem;
}

.chat-page .group-info-header {
    display: grid;
    grid-template-columns: minmax(0, max-content) auto;
    align-items: center;
    justify-content: center;
    column-gap: 10px;
    padding-inline: 38px;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    direction: ltr;
}

.chat-page .group-info-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 0 1 auto;
    min-width: 0;
    align-items: flex-start;
    text-align: right;
    direction: rtl;
}

.chat-page .group-info-title {
    font-size: 1.18rem;
    font-weight: 800;
    color: #10233f;
    word-break: break-word;
}

.chat-page .group-info-subtitle {
    font-size: 0.92rem;
    color: #64748b;
}

.chat-page .group-leave-form {
    display: block;
}

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

.chat-page .group-remove-button,
.chat-page .group-danger-button,
.chat-page .group-manage-submit {
    border: none;
    border-radius: 16px;
    padding: 14px 16px;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.chat-page .group-remove-button:hover,
.chat-page .group-danger-button:hover,
.chat-page .group-manage-submit:hover,
.chat-page .group-modal-section-summary:hover,
.chat-page .group-member-add-button:hover {
    transform: translateY(-1px);
    filter: brightness(1.01);
}

.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: 10px;
}

.chat-page .group-manage-form .group-member-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.chat-page .group-manage-form .group-member-add-button {
    width: 100%;
}

.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-avatar-form input[type="file"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(142, 156, 183, 0.35);
    background: rgba(255, 255, 255, 0.86);
    color: #10233f;
    font-family: inherit;
    box-sizing: border-box;
}

.chat-page .group-avatar-note {
    color: #334155;
    margin-bottom: 0;
}

.chat-page .group-manage-form input[type="text"],
.chat-page .group-manage-form input[type="email"] {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(142, 156, 183, 0.35);
    background: rgba(255, 255, 255, 0.92);
    padding: 12px 14px;
    font-family: inherit;
    box-sizing: border-box;
}

.chat-page .group-rename-form input[type="text"] {
    direction: rtl;
    text-align: right;
}

.chat-page .group-manage-submit {
    background: linear-gradient(135deg, #10233f 0%, #27567c 100%);
    color: #fff;
    font-weight: 700;
}

.chat-page .group-settings-danger {
    margin-top: 4px;
}

.chat-page .group-modal-section {
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(173, 184, 201, 0.26);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.chat-page .group-modal-section + .group-modal-section,
.chat-page .group-modal-section + .group-inline-form,
.chat-page .group-info-header + .group-modal-section {
    margin-top: 0;
}

.chat-page .group-modal-section-summary {
    list-style: none;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 18px;
    cursor: pointer;
    font-weight: 800;
    color: #10233f;
    background: rgba(248, 250, 252, 0.96);
    text-align: center;
    max-height: 120px;
    overflow: hidden;
    transition: max-height 0.32s ease, opacity 0.24s ease, padding 0.32s ease;
}

.chat-page .group-modal-section.is-sibling-hidden > .group-modal-section-summary {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
}

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

.chat-page .group-modal-section-content {
    height: 0;
    overflow: hidden;
    transition: height 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.chat-page .group-modal-section.is-open .group-modal-section-content,
.chat-page .group-modal-section.is-opening .group-modal-section-content,
.chat-page .group-modal-section.is-closing .group-modal-section-content {
    display: block;
}

.chat-page .group-modal-section.is-open .group-modal-section-content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.chat-page .group-modal-section-inner {
    padding: 0 18px 0;
    opacity: 0;
    transform: translateY(-10px);
    transition: padding 0.34s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease, transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.chat-page .group-modal-section.is-open .group-modal-section-inner,
.chat-page .group-modal-section.is-opening .group-modal-section-inner {
    padding-top: 0;
    padding-bottom: 18px;
    opacity: 1;
    transform: translateY(0);
}

.chat-page .group-member-email {
    color: #64748b;
    font-size: 0.88rem;
    word-break: break-all;
}

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

.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-message-loader {
    position: absolute;
    top: 7.6rem;
    right: 18px;
    left: 18px;
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: clamp(180px, 34vh, 320px);
    padding: 24px 18px;
    border-radius: 24px;
    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, rgba(13, 23, 34, 0.94) 0%, rgba(19, 32, 45, 0.93) 50%, rgba(23, 38, 53, 0.92) 100%);
    color: #f7f1e6;
    border: 1px solid rgba(214, 186, 130, 0.14);
    box-shadow: 0 20px 46px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(10px);
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.chat-page .chat-message-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

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

.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-group .chat-message {
    align-items: flex-start;
    gap: 10px;
}

.chat-page.chat-group .chat-message.system {
    gap: 0;
}

.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-group .chat-message .chat-bubble {
    max-width: min(calc(100% - 3.5rem), 34rem);
}

.chat-page.chat-group .chat-message-avatar {
    width: 2.35rem;
    height: 2.35rem;
    margin-top: 4px;
    align-self: flex-start;
    border-color: rgba(141, 156, 183, 0.26);
    background: linear-gradient(135deg, #3b5b85 0%, #7f99be 100%);
    box-shadow: 0 10px 22px rgba(25, 41, 70, 0.2);
}

.chat-page.chat-group .chat-message-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #f8fbff;
    font-size: 0.84rem;
}

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

.chat-page.chat-group .chat-message.theirs .chat-message-label {
    align-self: flex-start;
}

.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-group .chat-message.theirs .chat-bubble {
    background: var(--group-bubble-bg, rgba(233, 237, 244, 0.78));
    border-color: var(--group-bubble-border, rgba(255, 255, 255, 0.55));
}

.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-bubble.has-visual-media,
.chat-page .chat-message.theirs .chat-bubble.has-visual-media {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none;
    padding: 0;
}

.chat-page .chat-bubble.has-visual-media .chat-message-text {
    display: block;
    max-width: min(100%, 32rem);
    padding: 10px 14px;
    border-radius: 18px;
    box-shadow: 0 10px 26px rgba(46, 64, 97, 0.12);
}

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

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

.chat-page .chat-bubble.is-media-only .chat-message-meta {
    padding-inline: 4px;
}

.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-group .chat-message.theirs .chat-message-label {
    color: var(--group-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-video-expired {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(15, 31, 51, 0.08);
    color: #4b5563;
    font-size: 0.88rem;
}

.chat-page .chat-pdf-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(15, 31, 51, 0.06);
    border: 1px solid rgba(15, 31, 51, 0.12);
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.16s ease;
    max-width: 260px;
    margin-top: 4px;
}

.chat-page .chat-pdf-card:hover {
    background: rgba(15, 31, 51, 0.12);
}

.chat-page .chat-pdf-icon {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

.chat-page .chat-pdf-icon svg {
    width: 22px;
    height: 22px;
}

.chat-page .chat-pdf-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.chat-page .chat-pdf-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.chat-page .chat-pdf-meta {
    font-size: 0.75rem;
    opacity: 0.6;
}

.chat-page .chat-pdf-download-badge {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(15, 31, 51, 0.1);
    font-size: 0.72rem;
    font-weight: 700;
    color: #0f172a;
}

.chat-page .chat-audio-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(100%, 320px);
    margin-top: 4px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(15, 31, 51, 0.08);
    border: 1px solid rgba(15, 31, 51, 0.12);
}

.chat-page .chat-message.mine .chat-audio-card {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.2);
}

.chat-page .chat-audio-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-page .chat-audio-element {
    display: block;
    width: 100%;
}

.chat-page .chat-audio-actions {
    display: flex;
    justify-content: flex-end;
}

.chat-page .chat-audio-download-button {
    border: none;
    border-radius: 999px;
    padding: 8px 14px;
    background: rgba(15, 31, 51, 0.12);
    color: inherit;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}

.chat-page .chat-pdf-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: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: min(100%, 320px);
    max-width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border-radius: 18px;
    direction: ltr;
    text-align: left;
    background: linear-gradient(180deg, rgba(15, 31, 51, 0.08), rgba(15, 31, 51, 0.12));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.chat-page .chat-message.mine .chat-voice-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.1));
}

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

.chat-page .chat-voice-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.chat-page .chat-voice-title {
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

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

.chat-page .chat-voice-audio-element {
    display: block;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

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

.chat-page .chat-voice-timeline {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    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 {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.1));
    color: inherit;
    font-size: 0.92rem;
    line-height: 1;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
    overflow: hidden;
}

.chat-page .chat-message.theirs .chat-voice-play {
    background: linear-gradient(180deg, rgba(16, 35, 63, 0.12), rgba(16, 35, 63, 0.05));
}

.chat-page .chat-voice-play-icon {
    position: absolute;
    inset: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}

.chat-page .chat-voice-play-icon svg {
    display: block;
    width: 16px;
    height: 16px;
}

.chat-page .chat-voice-play-icon-play {
    opacity: 1;
    transform: scale(1);
}

.chat-page .chat-voice-play-icon-pause {
    opacity: 0;
    transform: scale(0.8);
}

.chat-page .chat-voice-play.is-playing .chat-voice-play-icon-play {
    opacity: 0;
    transform: scale(0.8);
}

.chat-page .chat-voice-play.is-playing .chat-voice-play-icon-pause {
    opacity: 1;
    transform: scale(1);
}

.chat-page .chat-voice-speed {
    min-width: 48px;
    padding: 8px 10px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
    color: inherit;
    font-size: 0.8rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.chat-page .chat-message.theirs .chat-voice-speed {
    background: linear-gradient(180deg, rgba(16, 35, 63, 0.12), rgba(16, 35, 63, 0.05));
}

.chat-page .chat-voice-progress {
    width: 100%;
    min-width: 0;
    position: relative;
    height: 24px;
}

.chat-page .chat-voice-progress-visual {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    overflow: visible;
    pointer-events: none;
}

.chat-page .chat-voice-progress-input {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    opacity: 0;
    touch-action: pan-x;
}

.chat-page .chat-voice-progress-input::-webkit-slider-runnable-track {
    height: 24px;
    background: transparent;
}

.chat-page .chat-voice-progress-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
}

.chat-page .chat-voice-progress-input::-moz-range-track {
    height: 24px;
    background: transparent;
    border: none;
}

.chat-page .chat-voice-progress-input::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    border-radius: 0;
}

.chat-page .chat-voice-waveform {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(28, minmax(0, 1fr));
    align-items: end;
    gap: 2px;
    pointer-events: none;
}

.chat-page .chat-voice-waveform.is-base {
    opacity: 0.45;
}

.chat-page .chat-voice-waveform.is-active {
    width: 0%;
    overflow: hidden;
    opacity: 1;
}

.chat-page .chat-voice-waveform-bar {
    display: block;
    width: 100%;
    min-height: 4px;
    height: var(--voice-bar-height, 50%);
    align-self: end;
    border-radius: 999px;
    background: currentColor;
}

.chat-page .chat-message.mine .chat-voice-waveform.is-base .chat-voice-waveform-bar {
    background: rgba(255, 255, 255, 0.35);
}

.chat-page .chat-message.mine .chat-voice-waveform.is-active .chat-voice-waveform-bar {
    background: rgba(255, 255, 255, 0.95);
}

.chat-page .chat-message.theirs .chat-voice-waveform.is-base .chat-voice-waveform-bar {
    background: rgba(16, 35, 63, 0.22);
}

.chat-page .chat-message.theirs .chat-voice-waveform.is-active .chat-voice-waveform-bar {
    background: #1f6feb;
}

.chat-page .chat-voice-progress-handle {
    position: absolute;
    top: 50%;
    left: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
    border: 2px solid rgba(255, 255, 255, 0.88);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

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

.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-reactions {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.chat-page .chat-message-reaction {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.96);
    font-size: 0.78rem;
    line-height: 1;
}

.chat-page .chat-message-reaction.is-reacted {
    background: rgba(255, 255, 255, 0.28);
}

.chat-page .chat-message-reaction-emoji {
    font-size: 0.92rem;
}

.chat-page .chat-message-reaction-count {
    font-weight: 700;
}

.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;
    max-height: min(76vh, 520px);
    overflow-y: auto;
    opacity: 0;
    transform: translateY(16px) scale(0.98);
    transition: opacity 1s ease, transform 1s ease;
}

.chat-action-sheet-reactions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 4px 4px 10px;
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(248, 250, 252, 0.98);
}

.chat-action-sheet-reaction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 8px;
    padding: 0 4px 10px;
    max-height: min(180px, 32vh);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.chat-action-sheet-reaction-grid[hidden] {
    display: none !important;
}

.chat-action-sheet-reaction-summary {
    display: grid;
    gap: 8px;
    padding: 0 4px 10px;
}

.chat-action-sheet-reaction-summary-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(16, 35, 63, 0.04);
    color: #10233f;
    line-height: 1.6;
}

.chat-action-sheet-reaction-summary-emoji {
    flex: 0 0 auto;
    font-size: 1.1rem;
}

.chat-action-sheet-reaction-summary-text {
    font-size: 0.92rem;
}

.chat-action-sheet-reaction-button {
    min-width: 42px;
    height: 42px;
    border: none;
    border-radius: 14px;
    background: rgba(16, 35, 63, 0.06);
    color: #10233f;
    font-size: 1.25rem;
    cursor: pointer;
}

.chat-action-sheet-reaction-button.is-active {
    background: rgba(14, 165, 233, 0.14);
    box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.4);
}

.chat-action-sheet-reaction-button.is-expand {
    font-size: 1.1rem;
    font-weight: 700;
    flex: 0 0 auto;
}

.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-password-modal {
    position: fixed;
    inset: 0;
    z-index: 360;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    box-sizing: border-box;
}

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

.chat-password-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 13, 23, 0.72);
    backdrop-filter: blur(8px);
}

.chat-password-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(430px, calc(100vw - 28px));
    padding: 22px 18px 18px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(239, 244, 251, 0.98));
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
    text-align: right;
    direction: rtl;
}

.chat-password-modal-eyebrow {
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: #64748b;
}

.chat-password-modal-title {
    margin: 8px 0 0;
    color: #10233f;
    font-size: 1.12rem;
    line-height: 1.6;
}

.chat-password-modal-message {
    margin-top: 10px;
    color: #334155;
    font-size: 0.94rem;
    line-height: 1.8;
}

.chat-password-modal-input {
    width: 100%;
    margin-top: 16px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    color: #0f172a;
    padding: 13px 14px;
    font: inherit;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.chat-password-modal-input:focus {
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.chat-password-modal-error {
    margin-top: 10px;
    color: #b91c1c;
    font-size: 0.88rem;
    line-height: 1.7;
}

.chat-password-modal-actions {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.chat-password-modal-button {
    min-width: 116px;
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.chat-password-modal-button:hover {
    transform: translateY(-1px);
}

.chat-password-modal-button.is-cancel {
    background: #dbe4ef;
    color: #17324f;
}

.chat-password-modal-button.is-confirm {
    background: #2563eb;
    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-call-launcher {
        left: 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-info-overlay {
        padding: 12px 10px;
        align-items: center;
    }

    .chat-page .group-info-body {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 10px);
        height: auto;
        border-radius: 24px;
        padding: max(22px, calc(12px + env(safe-area-inset-top))) 14px calc(16px + env(safe-area-inset-bottom));
    }

    .chat-page .group-info-header {
        padding-inline: 0;
    }

    .chat-page .group-info-meta {
        align-items: flex-start;
        text-align: right;
    }

    .chat-page .group-member-item {
        align-items: flex-start;
    }

    .chat-page .group-role-badge {
        align-self: auto;
    }

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

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

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

    .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) 44px;
        gap: 6px;
    }

    .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;
    }

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

    .chat-page .chat-video-modal {
        padding: 0;
        align-items: flex-end;
    }

    .chat-page .chat-video-modal-dialog {
        width: 100vw;
        max-height: 96vh;
        border-radius: 22px 22px 0 0;
    }

    .chat-page .chat-video-modal-video {
        border-radius: 22px 22px 0 0;
    }

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

    .chat-page .chat-profile-modal-dialog {
        width: calc(100vw - 20px);
        padding: 22px 16px 18px;
        margin-top: 75px;
    }

    .chat-page .chat-profile-modal-avatar-image,
    .chat-page .chat-profile-modal-avatar-placeholder {
        width: 142px;
        height: 142px;
    }

    .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-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(90deg, #06b6d4, #0ea5e9, #38bdf8);
    color: #fff;
    font-weight: bold;
    text-decoration: none;
    box-sizing: border-box;
}

.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 + .settings-admin-stat {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

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

.settings-admin-directory {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.settings-admin-preview-actions {
    width: min(100%, 32rem);
    margin: 0;
}

.settings-admin-preview-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.settings-admin-preview-links .settings-link-button {
    flex: 1 1 14rem;
}

.settings-admin-inline-form {
    margin: 0;
}

.settings-admin-inline-row {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
}

.settings-admin-inline-row input {
    flex: 1 1 auto;
}

.settings-admin-inline-row button {
    flex: 0 0 auto;
    white-space: nowrap;
    height: 46px;
    padding-top: 0;
    padding-bottom: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.settings-admin-storage-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.8rem;
}

.settings-admin-storage-status {
    width: 100%;
    text-align: center;
    margin-bottom: 0;
}

.settings-admin-storage-label {
    width: 100%;
    text-align: center;
    margin-bottom: 0;
}

.settings-admin-storage-select-wrap {
    width: min(100%, 280px);
}

.settings-admin-storage-select {
    width: 100%;
    padding: 12px 42px 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08)),
        rgba(8, 15, 24, 0.22);
    color: #fff;
    font-family: inherit;
    font-size: 0.98rem;
    text-align: center;
    text-align-last: center;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    cursor: pointer;
    background-image:
        linear-gradient(45deg, transparent 50%, rgba(255, 248, 232, 0.9) 50%),
        linear-gradient(135deg, rgba(255, 248, 232, 0.9) 50%, transparent 50%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08));
    background-position:
        calc(100% - 18px) calc(50% - 3px),
        calc(100% - 12px) calc(50% - 3px),
        0 0;
    background-size: 6px 6px, 6px 6px, 100% 100%;
    background-repeat: no-repeat;
}

.settings-admin-storage-select:focus {
    outline: none;
    border-color: rgba(186, 230, 253, 0.7);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.14);
}

.settings-admin-email-add-form {
    margin-bottom: 1rem;
}

.settings-admin-email-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.settings-admin-email-item {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 3.5rem;
    padding: 0.6rem 4.2rem 0.6rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    background: rgba(8, 15, 24, 0.18);
}

.settings-admin-email-actions {
    position: absolute;
    top: 50%;
    right: 0.65rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.45rem;
    transform: translateY(-50%);
}

.settings-admin-email-value {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    min-height: 100%;
    direction: ltr;
    text-align: left;
    color: #fff;
    font-variant-ligatures: none;
    word-break: break-all;
}

.settings-admin-icon-button {
    width: 1.7rem;
    height: 1.7rem;
    border: none;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.settings-admin-note-button {
    background: rgba(59, 130, 246, 0.92);
}

.settings-admin-note-button.is-empty {
    background: rgba(148, 163, 184, 0.72);
}

.settings-admin-remove-button {
    background: rgba(220, 38, 38, 0.94);
}

.settings-admin-note-button:hover,
.settings-admin-remove-button:hover {
    filter: brightness(1.08);
}

.settings-admin-directory label {
    display: block;
    color: #fff;
    font-size: 0.95rem;
}

.settings-admin-directory input {
    width: 100%;
    padding: 12px 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-admin-directory input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.settings-admin-user-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    background: rgba(8, 15, 24, 0.18);
}

.settings-admin-user-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 420px;
    color: #fff;
}

.settings-admin-user-table th,
.settings-admin-user-table td {
    padding: 12px 14px;
    text-align: right;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-admin-user-table thead th {
    color: rgba(247, 241, 230, 0.84);
    font-size: 0.9rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
}

.settings-admin-user-table tbody tr:last-child td {
    border-bottom: none;
}

.settings-admin-user-avatar-cell {
    width: 72px;
}

.settings-admin-user-avatar {
    width: 42px;
    height: 42px;
}

.settings-admin-user-email {
    direction: ltr;
    text-align: left;
    font-variant-ligatures: none;
}

.settings-admin-user-empty {
    text-align: center !important;
    color: rgba(255, 255, 255, 0.82);
}

.settings-admin-user-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.settings-admin-email-pagination {
    margin-top: 1rem;
}

.settings-admin-page-button {
    min-width: 42px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.settings-admin-page-button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.28);
}

.settings-admin-page-button.is-active {
    background: linear-gradient(90deg, #06b6d4, #0ea5e9, #38bdf8);
    border-color: transparent;
}

.settings-admin-page-button:disabled {
    opacity: 0.55;
    cursor: default;
}

.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;
    }

    .chat-page .chat-security-banner {
        top: 196px;
        width: calc(100vw - 12px);
        flex-direction: column;
        align-items: stretch;
    }

    .chat-page .chat-security-banner-action {
        width: 100%;
    }

    .settings-admin-user-table {
        min-width: 0;
    }

    .settings-admin-inline-row,
    .settings-admin-email-item {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-admin-email-actions {
        top: 50%;
        right: 0.55rem;
        flex-direction: row;
    }

    .settings-admin-remove-button {
        width: 1.7rem;
    }

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

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

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

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

    .chat-top-avatar-static {
        right: 12px;
    }
}
