@font-face {
    font-family: "Vazir";
    src: local("Vazir"), local("Vazir Regular"), local("Vazirmatn Regular"), local("Vazirmatn");
    font-display: swap;
}

:root {
    color-scheme: dark;
    --bg: #0a0c14;
    --panel: rgba(14, 16, 26, 0.92);
    --panel-strong: rgba(11, 13, 22, 0.98);
    --border: rgba(138, 130, 190, 0.11);
    --border-strong: rgba(138, 130, 190, 0.18);
    --text: #edf0f7;
    --muted: #8a90a8;
    --primary: #8b6cf7;
    --primary-strong: #7054e0;
    --telegram-green: #8b6cf7;
    --telegram-green-strong: #a78bfa;
    --telegram-bubble: rgba(30, 37, 51, 0.82);
    --telegram-bubble-self: rgba(58, 69, 99, 0.82);
    --telegram-sidebar: #131721;
    --telegram-chat: #0a0d14;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    --shadow-soft: 0 10px 32px rgba(0, 0, 0, 0.28);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 108, 247, 0.5) rgba(255, 255, 255, 0.03);
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(139, 108, 247, 0.6), rgba(112, 84, 224, 0.5));
    border-radius: 999px;
    border: 2px solid rgba(10, 12, 20, 0.5);
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(167, 139, 250, 0.78), rgba(139, 108, 247, 0.7));
}

[hidden] {
    display: none !important;
}

html {
    font-size: 16px;
    height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    height: 100%;
    font-family: "Vazir", "Segoe UI", Tahoma, sans-serif;
    background:
        radial-gradient(circle at top right, rgba(139, 108, 247, 0.1), transparent 24%),
        radial-gradient(circle at bottom left, rgba(245, 158, 11, 0.06), transparent 28%),
        linear-gradient(180deg, #0c0e16 0%, #08090f 100%);
    color: var(--text);
    direction: rtl;
    /*text-align: right;*/
    overflow: hidden;
}

.security-banner-stack {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    display: grid;
    gap: 8px;
    padding: 14px 14px 0;
    pointer-events: none;
}

.security-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: var(--shadow);
    border: 1px solid transparent;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    pointer-events: auto;
}

.security-banner-warning,
.security-banner-critical {
    background: rgba(127, 29, 29, 0.85);
    border-color: rgba(248, 113, 113, 0.4);
    color: #fee2e2;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.access-shell,
.workspace-shell {
    min-height: 100vh;
    height: 100vh;
    padding: 16px;
}

.access-shell {
    display: grid;
    place-items: center;
}

.access-card,
.sidebar-card,
.workspace-card,
.composer-card {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.access-card {
    width: min(100%, 460px);
    border-radius: 28px;
    padding: 26px;
}

.brand-mark,
.avatar {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
    color: white;
    font-weight: 700;
    box-shadow: 0 12px 30px rgba(139, 108, 247, 0.3);
}

.eyebrow {
    margin: 14px 0 6px;
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #b8a0ff;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    color: #f8fbff;
}

.muted,
.helper-text,
.user-chip span,
.workspace-item span,
.empty-state p,
.security-note li {
    color: var(--muted);
}

.access-form,
.security-note,
.workspace-list,
.composer-grid,
.stacked-actions {
    display: grid;
    gap: 12px;
}

.field {
    display: grid;
    gap: 6px;
}

.field span {
    color: #d4ccf0;
    font-size: 0.92rem;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(10, 12, 22, 0.78);
    color: var(--text);
    border-radius: var(--radius-md);
    padding: 11px 13px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(139, 108, 247, 0.8);
    box-shadow: 0 0 0 4px rgba(139, 108, 247, 0.12);
    background: rgba(12, 14, 24, 0.92);
}

textarea {
    resize: vertical;
}

.password-wrap {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
    border: 0;
    border-radius: 14px;
    transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.primary-button,
.secondary-button,
.ghost-button {
    padding: 10px 14px;
}

.primary-button {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-strong) 100%);
    color: white;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(112, 84, 224, 0.3);
}

.secondary-button,
.ghost-button,
.icon-button {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover {
    transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled,
.icon-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    margin-bottom: 12px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.28);
    color: #fecaca;
}

.alert-success {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.24);
    color: #bbf7d0;
}

.security-note {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.security-note ul {
    margin: 0;
    padding-right: 18px;
}

.workspace-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 14px;
    overflow: hidden;
}

.telegram-shell {
    grid-template-columns: minmax(200px, max-content) minmax(0, 1fr);
    gap: 0;
    padding: 0;
    min-height: 100vh;
    height: 100vh;
    direction: ltr;
}

.sidebar-card,
.workspace-card {
    border-radius: var(--radius-xl);
}

.sidebar-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 32px);
    overflow: hidden;
}

.sidebar-header,
.workspace-header,
.header-row,
.entry-card header,
.user-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.user-chip {
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 10px;
    margin: 12px 0;
    justify-content: flex-start;
}

.user-chip[data-open-profile] {
    cursor: pointer;
}

.workspace-list {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
}

.telegram-sidebar {
    border-radius: 0;
    border: 0;
    min-height: 100vh;
    height: 100vh;
    max-width: 40vw;
    background: linear-gradient(180deg, rgba(13, 15, 25, 0.98), rgba(10, 11, 20, 0.99));
    box-shadow: none;
    padding: 0;
    direction: ltr;
    border-left: 1px solid rgba(139, 108, 247, 0.08);
}

.telegram-sidebar-header {
    min-height: 10px;
    padding: 8px 12px 0;
    justify-content: flex-start;
}

.telegram-user-chip {
    margin: 0 6px 8px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    padding: 8px;
}

.avatar-button {
    border: 0;
    background: transparent;
    padding: 0;
    display: inline-flex;
}

.telegram-avatar-large,
.entry-avatar {
    border-radius: 50%;
    box-shadow: none;
}

.telegram-avatar-large {
    width: 38px;
    height: 38px;
}

.telegram-chat-list {
    display: block;
    padding: 0 4px 8px;
}

.workspace-item {
    display: grid;
    gap: 4px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid transparent;
    background: rgba(148, 163, 184, 0.06);
}

.telegram-chat-item {
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    min-height: 46px;
    border-radius: 11px;
    background: transparent;
    border: 0;
    margin-bottom: 4px;
}

.telegram-chat-item:hover,
.telegram-chat-item.is-active {
    background: linear-gradient(180deg, rgba(139, 108, 247, 0.14), rgba(139, 108, 247, 0.06));
}

.telegram-chat-item .strong,
.telegram-chat-copy strong {
    font-size: 0.92rem;
}

.telegram-chat-copy {
    min-width: 0;
}

.telegram-chat-copy strong {
    display: block;
    white-space: nowrap;
}

.telegram-sidebar-footer {
    padding: 8px 8px 10px;
    background: rgba(0, 0, 0, 0.08);
}

.telegram-sidebar-footer form {
    margin: 0;
}

.workspace-item.is-active {
    background: linear-gradient(180deg, rgba(139, 108, 247, 0.18), rgba(139, 108, 247, 0.08));
    border-color: rgba(139, 108, 247, 0.24);
}

.sidebar-footer {
    margin-top: 12px;
}

.sidebar-action-stack,
.admin-nav-actions {
    display: grid;
    gap: 8px;
}

.sidebar-action-button {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    font-weight: 600;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-action-button:hover {
    transform: translateY(-1px);
}

.sidebar-action-button-primary {
    background: linear-gradient(180deg, rgba(139, 108, 247, 0.22), rgba(139, 108, 247, 0.1));
    border-color: rgba(139, 108, 247, 0.24);
    color: #ede8ff;
    box-shadow: 0 10px 22px rgba(139, 108, 247, 0.14);
}

.sidebar-action-button-muted {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(233, 237, 239, 0.9);
}

.full-width {
    width: 100%;
}

.workspace-card {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: calc(100vh - 32px);
    overflow: hidden;
}

.admin-shell {
    align-items: start;
    height: 100vh;
    overflow: auto;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 14px;
}

.admin-shell .sidebar-card {
    position: sticky;
    top: 16px;
    align-self: start;
    min-height: auto;
    overflow: visible;
}

.admin-shell .workspace-card {
    min-height: auto;
    height: auto;
    overflow: visible;
}

.telegram-chat-shell {
    min-height: 100vh;
    height: 100vh;
    position: relative;
    isolation: isolate;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    background-color: var(--chat-bg-base, var(--telegram-chat));
    background-image: linear-gradient(160deg, var(--chat-tint-a, rgba(148, 163, 184, 0.2)) 0%, var(--chat-tint-b, rgba(148, 163, 184, 0.08)) 100%);
    padding: 0;
    direction: rtl;
    gap: 0;
    overflow: hidden;
}

.telegram-chat-shell::before {
    content: '';
    position: absolute;
    inset: -30%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.125;
    filter: blur(38px);
    background:
        radial-gradient(circle at 30% 30%, var(--chat-halo-a, rgba(139, 108, 247, 0.55)), transparent 40%),
        radial-gradient(circle at 70% 30%, var(--chat-halo-b, rgba(56, 189, 248, 0.5)), transparent 45%),
        radial-gradient(circle at 40% 80%, var(--chat-halo-c, rgba(244, 114, 182, 0.46)), transparent 50%),
        radial-gradient(circle at 75% 70%, var(--chat-halo-d, rgba(52, 211, 153, 0.42)), transparent 45%);
    animation: magicHaloSpin 160s linear infinite;
}

.telegram-chat-shell::after {
    display: none;
}

.telegram-chat-shell > .telegram-mobile-toggle,
.telegram-chat-shell > .alert,
.telegram-chat-shell > .workspace-chat-header,
.telegram-chat-shell > .activity-panel,
.telegram-chat-shell > .composer-card {
    position: relative;
    z-index: 1;
}

.telegram-chat-shell[data-bg-color="midnight"] {
    --chat-bg-base: #161b2e;
    --chat-tint-a: rgba(125, 151, 255, 0.38);
    --chat-tint-b: rgba(92, 226, 255, 0.2);
    --chat-halo-a: rgba(129, 140, 248, 0.72);
    --chat-halo-b: rgba(56, 189, 248, 0.68);
    --chat-halo-c: rgba(244, 114, 182, 0.64);
    --chat-halo-d: rgba(52, 211, 153, 0.58);
}

.telegram-chat-shell[data-bg-color="navy"] {
    --chat-bg-base: #111d35;
    --chat-tint-a: rgba(59, 130, 246, 0.34);
    --chat-tint-b: rgba(96, 165, 250, 0.18);
    --chat-halo-a: rgba(37, 99, 235, 0.76);
    --chat-halo-b: rgba(59, 130, 246, 0.7);
    --chat-halo-c: rgba(56, 189, 248, 0.62);
    --chat-halo-d: rgba(129, 140, 248, 0.54);
}

.telegram-chat-shell[data-bg-color="ember"] {
    --chat-bg-base: #2b1715;
    --chat-tint-a: rgba(251, 146, 60, 0.34);
    --chat-tint-b: rgba(254, 226, 129, 0.2);
    --chat-halo-a: rgba(251, 146, 60, 0.74);
    --chat-halo-b: rgba(248, 113, 113, 0.66);
    --chat-halo-c: rgba(245, 158, 11, 0.68);
    --chat-halo-d: rgba(253, 224, 71, 0.58);
}

.telegram-chat-shell[data-bg-color="ocean"] {
    --chat-bg-base: #12243a;
    --chat-tint-a: rgba(56, 189, 248, 0.36);
    --chat-tint-b: rgba(125, 211, 252, 0.22);
    --chat-halo-a: rgba(14, 165, 233, 0.74);
    --chat-halo-b: rgba(45, 212, 191, 0.64);
    --chat-halo-c: rgba(59, 130, 246, 0.7);
    --chat-halo-d: rgba(125, 211, 252, 0.62);
}

.telegram-chat-shell[data-bg-color="forest"] {
    --chat-bg-base: #13261c;
    --chat-tint-a: rgba(74, 222, 128, 0.32);
    --chat-tint-b: rgba(110, 231, 183, 0.18);
    --chat-halo-a: rgba(34, 197, 94, 0.72);
    --chat-halo-b: rgba(16, 185, 129, 0.66);
    --chat-halo-c: rgba(132, 204, 22, 0.66);
    --chat-halo-d: rgba(45, 212, 191, 0.56);
}

.telegram-chat-shell[data-bg-color="moss"] {
    --chat-bg-base: #1a2412;
    --chat-tint-a: rgba(132, 204, 22, 0.32);
    --chat-tint-b: rgba(190, 242, 100, 0.16);
    --chat-halo-a: rgba(101, 163, 13, 0.74);
    --chat-halo-b: rgba(132, 204, 22, 0.68);
    --chat-halo-c: rgba(163, 230, 53, 0.62);
    --chat-halo-d: rgba(52, 211, 153, 0.5);
}

.telegram-chat-shell[data-bg-color="sand"] {
    --chat-bg-base: #2b2115;
    --chat-tint-a: rgba(252, 211, 77, 0.34);
    --chat-tint-b: rgba(251, 146, 60, 0.2);
    --chat-halo-a: rgba(251, 191, 36, 0.74);
    --chat-halo-b: rgba(249, 115, 22, 0.68);
    --chat-halo-c: rgba(217, 119, 6, 0.64);
    --chat-halo-d: rgba(245, 158, 11, 0.58);
}

.telegram-chat-shell[data-bg-color="crimson"] {
    --chat-bg-base: #2c1420;
    --chat-tint-a: rgba(251, 113, 133, 0.36);
    --chat-tint-b: rgba(244, 114, 182, 0.2);
    --chat-halo-a: rgba(244, 63, 94, 0.76);
    --chat-halo-b: rgba(236, 72, 153, 0.72);
    --chat-halo-c: rgba(251, 113, 133, 0.68);
    --chat-halo-d: rgba(190, 24, 93, 0.56);
}

.telegram-chat-shell[data-bg-color="ruby"] {
    --chat-bg-base: #2a1418;
    --chat-tint-a: rgba(239, 68, 68, 0.34);
    --chat-tint-b: rgba(248, 113, 113, 0.18);
    --chat-halo-a: rgba(220, 38, 38, 0.78);
    --chat-halo-b: rgba(239, 68, 68, 0.72);
    --chat-halo-c: rgba(251, 113, 133, 0.62);
    --chat-halo-d: rgba(190, 18, 60, 0.54);
}

.telegram-chat-shell[data-bg-color="cobalt"] {
    --chat-bg-base: #151f3d;
    --chat-tint-a: rgba(96, 165, 250, 0.36);
    --chat-tint-b: rgba(129, 140, 248, 0.2);
    --chat-halo-a: rgba(59, 130, 246, 0.76);
    --chat-halo-b: rgba(99, 102, 241, 0.72);
    --chat-halo-c: rgba(56, 189, 248, 0.66);
    --chat-halo-d: rgba(147, 197, 253, 0.58);
}

.telegram-chat-shell[data-bg-color="jade"] {
    --chat-bg-base: #122b24;
    --chat-tint-a: rgba(52, 211, 153, 0.34);
    --chat-tint-b: rgba(94, 234, 212, 0.2);
    --chat-halo-a: rgba(16, 185, 129, 0.74);
    --chat-halo-b: rgba(45, 212, 191, 0.7);
    --chat-halo-c: rgba(52, 211, 153, 0.68);
    --chat-halo-d: rgba(110, 231, 183, 0.58);
}

.telegram-chat-shell[data-bg-color="mint"] {
    --chat-bg-base: #142822;
    --chat-tint-a: rgba(110, 231, 183, 0.34);
    --chat-tint-b: rgba(167, 243, 208, 0.18);
    --chat-halo-a: rgba(52, 211, 153, 0.74);
    --chat-halo-b: rgba(94, 234, 212, 0.68);
    --chat-halo-c: rgba(125, 211, 252, 0.56);
    --chat-halo-d: rgba(187, 247, 208, 0.5);
}

.telegram-chat-shell[data-bg-color="orchid"] {
    --chat-bg-base: #231837;
    --chat-tint-a: rgba(192, 132, 252, 0.34);
    --chat-tint-b: rgba(244, 114, 182, 0.2);
    --chat-halo-a: rgba(168, 85, 247, 0.76);
    --chat-halo-b: rgba(192, 132, 252, 0.72);
    --chat-halo-c: rgba(244, 114, 182, 0.66);
    --chat-halo-d: rgba(232, 121, 249, 0.56);
}

.telegram-chat-shell[data-bg-color="plum"] {
    --chat-bg-base: #24142d;
    --chat-tint-a: rgba(139, 92, 246, 0.34);
    --chat-tint-b: rgba(192, 132, 252, 0.18);
    --chat-halo-a: rgba(124, 58, 237, 0.78);
    --chat-halo-b: rgba(168, 85, 247, 0.72);
    --chat-halo-c: rgba(217, 70, 239, 0.62);
    --chat-halo-d: rgba(244, 114, 182, 0.5);
}

.telegram-chat-shell[data-bg-color="arctic"] {
    --chat-bg-base: #1a2b35;
    --chat-tint-a: rgba(125, 211, 252, 0.34);
    --chat-tint-b: rgba(134, 239, 172, 0.16);
    --chat-halo-a: rgba(56, 189, 248, 0.72);
    --chat-halo-b: rgba(125, 211, 252, 0.68);
    --chat-halo-c: rgba(147, 197, 253, 0.64);
    --chat-halo-d: rgba(167, 243, 208, 0.54);
}

.telegram-chat-shell[data-bg-color="glacier"] {
    --chat-bg-base: #1b2733;
    --chat-tint-a: rgba(147, 197, 253, 0.34);
    --chat-tint-b: rgba(191, 219, 254, 0.18);
    --chat-halo-a: rgba(96, 165, 250, 0.72);
    --chat-halo-b: rgba(125, 211, 252, 0.68);
    --chat-halo-c: rgba(186, 230, 253, 0.62);
    --chat-halo-d: rgba(165, 243, 252, 0.52);
}

.telegram-chat-shell[data-bg-color="saffron"] {
    --chat-bg-base: #2e2110;
    --chat-tint-a: rgba(251, 191, 36, 0.38);
    --chat-tint-b: rgba(253, 186, 116, 0.22);
    --chat-halo-a: rgba(245, 158, 11, 0.76);
    --chat-halo-b: rgba(251, 191, 36, 0.72);
    --chat-halo-c: rgba(249, 115, 22, 0.68);
    --chat-halo-d: rgba(253, 224, 71, 0.58);
}

.telegram-chat-shell[data-bg-color="graphite"] {
    --chat-bg-base: #22293a;
    --chat-tint-a: rgba(148, 163, 184, 0.3);
    --chat-tint-b: rgba(125, 211, 252, 0.14);
    --chat-halo-a: rgba(100, 116, 139, 0.66);
    --chat-halo-b: rgba(148, 163, 184, 0.62);
    --chat-halo-c: rgba(147, 197, 253, 0.54);
    --chat-halo-d: rgba(71, 85, 105, 0.5);
}

.telegram-chat-shell[data-bg-color="slate"] {
    --chat-bg-base: #1d2330;
    --chat-tint-a: rgba(100, 116, 139, 0.28);
    --chat-tint-b: rgba(148, 163, 184, 0.14);
    --chat-halo-a: rgba(71, 85, 105, 0.68);
    --chat-halo-b: rgba(100, 116, 139, 0.62);
    --chat-halo-c: rgba(148, 163, 184, 0.52);
    --chat-halo-d: rgba(96, 165, 250, 0.42);
}

.telegram-chat-shell[data-bg-color="ash"] {
    --chat-bg-base: #23211f;
    --chat-tint-a: rgba(148, 163, 184, 0.2);
    --chat-tint-b: rgba(203, 213, 225, 0.12);
    --chat-halo-a: rgba(120, 113, 108, 0.62);
    --chat-halo-b: rgba(161, 161, 170, 0.58);
    --chat-halo-c: rgba(196, 181, 253, 0.46);
    --chat-halo-d: rgba(148, 163, 184, 0.42);
}

.telegram-chat-shell[data-bg-color="mist"] {
    --chat-bg-base: #263241;
    --chat-tint-a: rgba(203, 213, 225, 0.24);
    --chat-tint-b: rgba(148, 163, 184, 0.12);
    --chat-halo-a: rgba(148, 163, 184, 0.64);
    --chat-halo-b: rgba(191, 219, 254, 0.5);
    --chat-halo-c: rgba(226, 232, 240, 0.44);
    --chat-halo-d: rgba(125, 211, 252, 0.4);
}

.telegram-chat-shell[data-bg-color="terracotta"] {
    --chat-bg-base: #2d1915;
    --chat-tint-a: rgba(251, 146, 60, 0.34);
    --chat-tint-b: rgba(251, 113, 133, 0.18);
    --chat-halo-a: rgba(234, 88, 12, 0.76);
    --chat-halo-b: rgba(249, 115, 22, 0.72);
    --chat-halo-c: rgba(251, 146, 60, 0.66);
    --chat-halo-d: rgba(239, 68, 68, 0.56);
}

.telegram-chat-shell[data-bg-color="rosewood"] {
    --chat-bg-base: #2a151e;
    --chat-tint-a: rgba(190, 24, 93, 0.3);
    --chat-tint-b: rgba(159, 54, 85, 0.18);
    --chat-halo-a: rgba(157, 23, 77, 0.76);
    --chat-halo-b: rgba(190, 24, 93, 0.7);
    --chat-halo-c: rgba(244, 114, 182, 0.56);
    --chat-halo-d: rgba(239, 68, 68, 0.46);
}

.telegram-chat-shell[data-bg-color="copper"] {
    --chat-bg-base: #2c1b13;
    --chat-tint-a: rgba(217, 119, 6, 0.32);
    --chat-tint-b: rgba(251, 146, 60, 0.18);
    --chat-halo-a: rgba(180, 83, 9, 0.76);
    --chat-halo-b: rgba(217, 119, 6, 0.72);
    --chat-halo-c: rgba(249, 115, 22, 0.62);
    --chat-halo-d: rgba(245, 158, 11, 0.5);
}

.telegram-chat-shell[data-bg-color="dusk"] {
    --chat-bg-base: #1e1d3a;
    --chat-tint-a: rgba(99, 102, 241, 0.34);
    --chat-tint-b: rgba(129, 140, 248, 0.18);
    --chat-halo-a: rgba(79, 70, 229, 0.76);
    --chat-halo-b: rgba(99, 102, 241, 0.72);
    --chat-halo-c: rgba(168, 85, 247, 0.58);
    --chat-halo-d: rgba(56, 189, 248, 0.46);
}

.telegram-chat-shell[data-bg-color="aurora"] {
    --chat-bg-base: #251a33;
    --chat-tint-a: rgba(232, 121, 249, 0.3);
    --chat-tint-b: rgba(94, 234, 212, 0.14);
    --chat-halo-a: rgba(217, 70, 239, 0.74);
    --chat-halo-b: rgba(232, 121, 249, 0.68);
    --chat-halo-c: rgba(45, 212, 191, 0.54);
    --chat-halo-d: rgba(56, 189, 248, 0.42);
}

/* New theme colors - Neutral */
.telegram-chat-shell[data-bg-color="charcoal"] {
    --chat-bg-base: #0f1115;
    --chat-tint-a: rgba(107, 114, 128, 0.28);
    --chat-tint-b: rgba(148, 163, 184, 0.12);
    --chat-halo-a: rgba(75, 85, 99, 0.68);
    --chat-halo-b: rgba(107, 114, 128, 0.62);
    --chat-halo-c: rgba(148, 163, 184, 0.48);
    --chat-halo-d: rgba(191, 219, 254, 0.36);
}

.telegram-chat-shell[data-bg-color="stone"] {
    --chat-bg-base: #1f2225;
    --chat-tint-a: rgba(148, 163, 184, 0.24);
    --chat-tint-b: rgba(203, 213, 225, 0.12);
    --chat-halo-a: rgba(107, 114, 128, 0.64);
    --chat-halo-b: rgba(148, 163, 184, 0.58);
    --chat-halo-c: rgba(226, 232, 240, 0.48);
    --chat-halo-d: rgba(241, 245, 250, 0.36);
}

.telegram-chat-shell[data-bg-color="dust"] {
    --chat-bg-base: #232528;
    --chat-tint-a: rgba(163, 176, 190, 0.2);
    --chat-tint-b: rgba(203, 213, 225, 0.12);
    --chat-halo-a: rgba(107, 114, 128, 0.62);
    --chat-halo-b: rgba(148, 163, 184, 0.56);
    --chat-halo-c: rgba(191, 219, 254, 0.44);
    --chat-halo-d: rgba(203, 213, 225, 0.36);
}

.telegram-chat-shell[data-bg-color="pearl"] {
    --chat-bg-base: #eef2f5;
    --chat-tint-a: rgba(100, 116, 139, 0.18);
    --chat-tint-b: rgba(148, 163, 184, 0.1);
    --chat-halo-a: rgba(148, 163, 184, 0.54);
    --chat-halo-b: rgba(203, 213, 225, 0.48);
    --chat-halo-c: rgba(241, 245, 250, 0.42);
    --chat-halo-d: rgba(148, 163, 184, 0.3);
}

/* New theme colors - Blue */
.telegram-chat-shell[data-bg-color="indigo"] {
    --chat-bg-base: #1a1e3f;
    --chat-tint-a: rgba(69, 51, 176, 0.3);
    --chat-tint-b: rgba(99, 102, 241, 0.16);
    --chat-halo-a: rgba(59, 130, 246, 0.72);
    --chat-halo-b: rgba(96, 165, 250, 0.66);
    --chat-halo-c: rgba(129, 140, 248, 0.58);
    --chat-halo-d: rgba(168, 85, 247, 0.46);
}

.telegram-chat-shell[data-bg-color="sky"] {
    --chat-bg-base: #0f2c4a;
    --chat-tint-a: rgba(186, 230, 253, 0.24);
    --chat-tint-b: rgba(125, 211, 252, 0.12);
    --chat-halo-a: rgba(125, 211, 252, 0.68);
    --chat-halo-b: rgba(186, 230, 253, 0.62);
    --chat-halo-c: rgba(224, 242, 254, 0.48);
    --chat-halo-d: rgba(56, 189, 248, 0.4);
}

.telegram-chat-shell[data-bg-color="azure"] {
    --chat-bg-base: #0a1f35;
    --chat-tint-a: rgba(224, 242, 254, 0.2);
    --chat-tint-b: rgba(125, 211, 252, 0.12);
    --chat-halo-a: rgba(125, 211, 252, 0.66);
    --chat-halo-b: rgba(224, 242, 254, 0.58);
    --chat-halo-c: rgba(191, 219, 254, 0.48);
    --chat-halo-d: rgba(59, 130, 246, 0.36);
}

.telegram-chat-shell[data-bg-color="cyan"] {
    --chat-bg-base: #051c30;
    --chat-tint-a: rgba(240, 249, 255, 0.18);
    --chat-tint-b: rgba(125, 211, 252, 0.1);
    --chat-halo-a: rgba(125, 211, 252, 0.62);
    --chat-halo-b: rgba(224, 242, 254, 0.54);
    --chat-halo-c: rgba(191, 219, 254, 0.46);
    --chat-halo-d: rgba(96, 165, 250, 0.34);
}

/* New theme colors - Green */
.telegram-chat-shell[data-bg-color="forest-dark"] {
    --chat-bg-base: #0a2218;
    --chat-tint-a: rgba(27, 67, 50, 0.32);
    --chat-tint-b: rgba(74, 222, 128, 0.14);
    --chat-halo-a: rgba(34, 197, 94, 0.72);
    --chat-halo-b: rgba(74, 222, 128, 0.68);
    --chat-halo-c: rgba(132, 204, 22, 0.56);
    --chat-halo-d: rgba(168, 226, 46, 0.48);
}

.telegram-chat-shell[data-bg-color="moss-dark"] {
    --chat-bg-base: #122e20;
    --chat-tint-a: rgba(64, 145, 108, 0.3);
    --chat-tint-b: rgba(132, 204, 22, 0.16);
    --chat-halo-a: rgba(52, 211, 153, 0.7);
    --chat-halo-b: rgba(110, 231, 183, 0.64);
    --chat-halo-c: rgba(132, 204, 22, 0.54);
    --chat-halo-d: rgba(150, 213, 178, 0.46);
}

.telegram-chat-shell[data-bg-color="sage"] {
    --chat-bg-base: #0e3a2e;
    --chat-tint-a: rgba(149, 213, 178, 0.28);
    --chat-tint-b: rgba(110, 231, 183, 0.12);
    --chat-halo-a: rgba(52, 211, 153, 0.66);
    --chat-halo-b: rgba(110, 231, 183, 0.6);
    --chat-halo-c: rgba(132, 204, 22, 0.48);
    --chat-halo-d: rgba(74, 222, 128, 0.4);
}

.telegram-chat-shell[data-bg-color="lime"] {
    --chat-bg-base: #132a1f;
    --chat-tint-a: rgba(216, 243, 220, 0.2);
    --chat-tint-b: rgba(168, 226, 46, 0.1);
    --chat-halo-a: rgba(110, 231, 183, 0.62);
    --chat-halo-b: rgba(132, 204, 22, 0.56);
    --chat-halo-c: rgba(168, 226, 46, 0.48);
    --chat-halo-d: rgba(74, 222, 128, 0.36);
}

/* New theme colors - Red */
.telegram-chat-shell[data-bg-color="maroon"] {
    --chat-bg-base: #210606;
    --chat-tint-a: rgba(92, 10, 10, 0.34);
    --chat-tint-b: rgba(244, 63, 94, 0.16);
    --chat-halo-a: rgba(239, 68, 68, 0.74);
    --chat-halo-b: rgba(244, 63, 94, 0.68);
    --chat-halo-c: rgba(248, 113, 113, 0.58);
    --chat-halo-d: rgba(252, 165, 165, 0.46);
}

.telegram-chat-shell[data-bg-color="scarlet"] {
    --chat-bg-base: #481a1a;
    --chat-tint-a: rgba(220, 38, 38, 0.3);
    --chat-tint-b: rgba(244, 63, 94, 0.16);
    --chat-halo-a: rgba(234, 88, 12, 0.72);
    --chat-halo-b: rgba(239, 68, 68, 0.66);
    --chat-halo-c: rgba(244, 63, 94, 0.54);
    --chat-halo-d: rgba(251, 146, 60, 0.44);
}

.telegram-chat-shell[data-bg-color="rose"] {
    --chat-bg-base: #3d1f27;
    --chat-tint-a: rgba(251, 113, 133, 0.28);
    --chat-tint-b: rgba(244, 63, 94, 0.14);
    --chat-halo-a: rgba(244, 63, 94, 0.7);
    --chat-halo-b: rgba(251, 113, 133, 0.64);
    --chat-halo-c: rgba(252, 165, 165, 0.52);
    --chat-halo-d: rgba(248, 113, 113, 0.4);
}

.telegram-chat-shell[data-bg-color="coral"] {
    --chat-bg-base: #3a1810;
    --chat-tint-a: rgba(249, 115, 22, 0.3);
    --chat-tint-b: rgba(251, 146, 60, 0.14);
    --chat-halo-a: rgba(249, 115, 22, 0.72);
    --chat-halo-b: rgba(251, 146, 60, 0.66);
    --chat-halo-c: rgba(252, 165, 165, 0.52);
    --chat-halo-d: rgba(244, 63, 94, 0.4);
}

.telegram-chat-shell[data-bg-color="salmon"] {
    --chat-bg-base: #4a2424;
    --chat-tint-a: rgba(252, 165, 165, 0.26);
    --chat-tint-b: rgba(244, 63, 94, 0.12);
    --chat-halo-a: rgba(248, 113, 113, 0.68);
    --chat-halo-b: rgba(252, 165, 165, 0.62);
    --chat-halo-c: rgba(251, 113, 133, 0.5);
    --chat-halo-d: rgba(239, 68, 68, 0.38);
}

.telegram-chat-shell[data-bg-color="pink"] {
    --chat-bg-base: #49283a;
    --chat-tint-a: rgba(251, 207, 232, 0.2);
    --chat-tint-b: rgba(244, 63, 94, 0.1);
    --chat-halo-a: rgba(244, 63, 94, 0.64);
    --chat-halo-b: rgba(251, 113, 133, 0.58);
    --chat-halo-c: rgba(251, 207, 232, 0.46);
    --chat-halo-d: rgba(248, 113, 113, 0.36);
}

/* New theme colors - Warm */
.telegram-chat-shell[data-bg-color="burnt-sienna"] {
    --chat-bg-base: #381c0a;
    --chat-tint-a: rgba(180, 83, 9, 0.32);
    --chat-tint-b: rgba(217, 119, 6, 0.14);
    --chat-halo-a: rgba(180, 83, 9, 0.72);
    --chat-halo-b: rgba(217, 119, 6, 0.66);
    --chat-halo-c: rgba(251, 146, 60, 0.54);
    --chat-halo-d: rgba(245, 158, 11, 0.44);
}

.telegram-chat-shell[data-bg-color="rust"] {
    --chat-bg-base: #3f2515;
    --chat-tint-a: rgba(220, 92, 62, 0.3);
    --chat-tint-b: rgba(251, 146, 60, 0.14);
    --chat-halo-a: rgba(217, 119, 6, 0.7);
    --chat-halo-b: rgba(220, 92, 62, 0.64);
    --chat-halo-c: rgba(251, 146, 60, 0.52);
    --chat-halo-d: rgba(245, 158, 11, 0.4);
}

.telegram-chat-shell[data-bg-color="amber"] {
    --chat-bg-base: #3f2a0c;
    --chat-tint-a: rgba(245, 158, 11, 0.28);
    --chat-tint-b: rgba(251, 191, 36, 0.13);
    --chat-halo-a: rgba(245, 158, 11, 0.68);
    --chat-halo-b: rgba(251, 191, 36, 0.62);
    --chat-halo-c: rgba(250, 204, 21, 0.52);
    --chat-halo-d: rgba(254, 240, 138, 0.4);
}

.telegram-chat-shell[data-bg-color="gold"] {
    --chat-bg-base: #443a1a;
    --chat-tint-a: rgba(250, 204, 21, 0.24);
    --chat-tint-b: rgba(253, 211, 77, 0.12);
    --chat-halo-a: rgba(250, 204, 21, 0.64);
    --chat-halo-b: rgba(253, 211, 77, 0.58);
    --chat-halo-c: rgba(254, 240, 138, 0.48);
    --chat-halo-d: rgba(245, 158, 11, 0.36);
}

.telegram-chat-shell[data-bg-color="honey"] {
    --chat-bg-base: #483d23;
    --chat-tint-a: rgba(254, 240, 138, 0.2);
    --chat-tint-b: rgba(253, 211, 77, 0.1);
    --chat-halo-a: rgba(253, 211, 77, 0.6);
    --chat-halo-b: rgba(254, 240, 138, 0.54);
    --chat-halo-c: rgba(250, 204, 21, 0.46);
    --chat-halo-d: rgba(245, 158, 11, 0.34);
}

/* New theme colors - Purple */
.telegram-chat-shell[data-bg-color="indigo-dark"] {
    --chat-bg-base: #191620;
    --chat-tint-a: rgba(49, 46, 129, 0.32);
    --chat-tint-b: rgba(99, 102, 241, 0.14);
    --chat-halo-a: rgba(79, 70, 229, 0.72);
    --chat-halo-b: rgba(99, 102, 241, 0.66);
    --chat-halo-c: rgba(129, 140, 248, 0.54);
    --chat-halo-d: rgba(168, 85, 247, 0.44);
}

.telegram-chat-shell[data-bg-color="plum-dark"] {
    --chat-bg-base: #2a1a3a;
    --chat-tint-a: rgba(109, 40, 217, 0.3);
    --chat-tint-b: rgba(139, 92, 246, 0.14);
    --chat-halo-a: rgba(139, 92, 246, 0.72);
    --chat-halo-b: rgba(168, 85, 247, 0.66);
    --chat-halo-c: rgba(196, 181, 253, 0.54);
    --chat-halo-d: rgba(168, 85, 247, 0.44);
}

.telegram-chat-shell[data-bg-color="lavender"] {
    --chat-bg-base: #2d202f;
    --chat-tint-a: rgba(216, 180, 254, 0.26);
    --chat-tint-b: rgba(196, 181, 253, 0.12);
    --chat-halo-a: rgba(168, 85, 247, 0.68);
    --chat-halo-b: rgba(196, 181, 253, 0.62);
    --chat-halo-c: rgba(216, 180, 254, 0.5);
    --chat-halo-d: rgba(217, 70, 239, 0.38);
}

.telegram-chat-shell[data-bg-color="lilac"] {
    --chat-bg-base: #352f39;
    --chat-tint-a: rgba(237, 233, 254, 0.2);
    --chat-tint-b: rgba(196, 181, 253, 0.1);
    --chat-halo-a: rgba(196, 181, 253, 0.64);
    --chat-halo-b: rgba(217, 70, 239, 0.58);
    --chat-halo-c: rgba(168, 85, 247, 0.46);
    --chat-halo-d: rgba(126, 34, 206, 0.36);
}

.telegram-chat-shell[data-bg-color="mauve"] {
    --chat-bg-base: #3a3441;
    --chat-tint-a: rgba(243, 232, 255, 0.18);
    --chat-tint-b: rgba(216, 180, 254, 0.1);
    --chat-halo-a: rgba(196, 181, 253, 0.62);
    --chat-halo-b: rgba(217, 70, 239, 0.56);
    --chat-halo-c: rgba(139, 92, 246, 0.44);
    --chat-halo-d: rgba(99, 102, 241, 0.34);
}

.telegram-chat-shell[data-bg-color="petal"] {
    --chat-bg-base: #42384d;
    --chat-tint-a: rgba(250, 245, 255, 0.16);
    --chat-tint-b: rgba(196, 181, 253, 0.08);
    --chat-halo-a: rgba(217, 70, 239, 0.58);
    --chat-halo-b: rgba(196, 181, 253, 0.52);
    --chat-halo-c: rgba(168, 85, 247, 0.42);
    --chat-halo-d: rgba(139, 92, 246, 0.32);
}

/* New theme colors - Mixed warm/cool */
.telegram-chat-shell[data-bg-color="tan"] {
    --chat-bg-base: #3a3228;
    --chat-tint-a: rgba(210, 180, 140, 0.22);
    --chat-tint-b: rgba(217, 119, 6, 0.1);
    --chat-halo-a: rgba(217, 119, 6, 0.64);
    --chat-halo-b: rgba(245, 158, 11, 0.58);
    --chat-halo-c: rgba(253, 211, 77, 0.46);
    --chat-halo-d: rgba(250, 204, 21, 0.34);
}

.telegram-chat-shell[data-bg-color="cream"] {
    --chat-bg-base: #4a4830;
    --chat-tint-a: rgba(255, 253, 208, 0.18);
    --chat-tint-b: rgba(253, 211, 77, 0.08);
    --chat-halo-a: rgba(245, 158, 11, 0.6);
    --chat-halo-b: rgba(250, 204, 21, 0.54);
    --chat-halo-c: rgba(254, 240, 138, 0.44);
    --chat-halo-d: rgba(253, 211, 77, 0.32);
}

.telegram-chat-shell[data-bg-color="ivory"] {
    --chat-bg-base: #4a4841;
    --chat-tint-a: rgba(250, 249, 247, 0.16);
    --chat-tint-b: rgba(210, 180, 140, 0.08);
    --chat-halo-a: rgba(203, 213, 225, 0.58);
    --chat-halo-b: rgba(226, 232, 240, 0.52);
    --chat-halo-c: rgba(241, 245, 250, 0.42);
    --chat-halo-d: rgba(148, 163, 184, 0.3);
}

/* Existing colors with sand added */
.telegram-chat-shell[data-bg-color="sand"] {
    --chat-bg-base: #3f3625;
    --chat-tint-a: rgba(253, 211, 77, 0.26);
    --chat-tint-b: rgba(251, 191, 36, 0.12);
    --chat-halo-a: rgba(245, 158, 11, 0.66);
    --chat-halo-b: rgba(250, 204, 21, 0.6);
    --chat-halo-c: rgba(253, 211, 77, 0.48);
    --chat-halo-d: rgba(251, 191, 36, 0.36);
}

.workspace-chat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    direction: ltr;
    gap: 12px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(10, 12, 20, 0.52);
    backdrop-filter: blur(8px);
}

.workspace-chat-header-main {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    gap: 8px;
    text-align: left;
}

.workspace-chat-title {
    font-size: 1rem;
    color: #f4f8ff;
}

.workspace-chat-members {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
}

.workspace-chat-member-tag {
    font-size: 0.7rem;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid rgba(125, 211, 252, 0.24);
    background: rgba(14, 165, 233, 0.12);
    color: #d5efff;
}

.workspace-chat-theme {
    position: relative;
    display: grid;
    gap: 8px;
    justify-items: end;
    flex: 0 0 auto;
}

.workspace-theme-toggle {
    width: 30px;
    height: 30px;
    min-height: 30px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(12, 15, 24, 0.92);
    color: #e8edf7;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
}

.workspace-theme-toggle:hover {
    border-color: rgba(125, 211, 252, 0.45);
    background: rgba(20, 24, 36, 0.98);
}

.workspace-theme-panel {
    width: min(248px, calc(100vw - 24px));
    display: grid;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(12, 15, 24, 0.94);
    box-shadow: 0 14px 32px rgba(2, 6, 23, 0.5);
}

.workspace-theme-panel > strong {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.82);
}

.workspace-theme-groups {
    display: grid;
    gap: 8px;
}

.workspace-theme-group {
    display: grid;
    gap: 5px;
}

.workspace-theme-group-label {
    font-size: 0.66rem;
    color: rgba(255, 255, 255, 0.56);
}

.workspace-theme-palette {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 4px;
}

.workspace-theme-color {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid transparent;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    justify-self: center;
}

.workspace-theme-color:hover {
    transform: translateY(-1px) scale(1.06);
}

.workspace-theme-color.is-active {
    border-color: #f8fafc;
    box-shadow: 0 0 0 2px rgba(248, 250, 252, 0.18);
}

.workspace-theme-color.is-midnight {
    background: #3f4f86;
}

.workspace-theme-color.is-navy {
    background: #264f95;
}

.workspace-theme-color.is-ember {
    background: #fb923c;
}

.workspace-theme-color.is-copper {
    background: #d97745;
}

.workspace-theme-color.is-ocean {
    background: #38bdf8;
}

.workspace-theme-color.is-glacier {
    background: #9dd8ff;
}

.workspace-theme-color.is-forest {
    background: #4ade80;
}

.workspace-theme-color.is-moss {
    background: #84cc16;
}

.workspace-theme-color.is-sand {
    background: #fcd34d;
}

.workspace-theme-color.is-ash {
    background: #7f8a96;
}

.workspace-theme-color.is-crimson {
    background: #f43f5e;
}

.workspace-theme-color.is-ruby {
    background: #ef4444;
}

.workspace-theme-color.is-cobalt {
    background: #60a5fa;
}

.workspace-theme-color.is-jade {
    background: #34d399;
}

.workspace-theme-color.is-mint {
    background: #6ee7b7;
}

.workspace-theme-color.is-orchid {
    background: #c084fc;
}

.workspace-theme-color.is-plum {
    background: #8b5cf6;
}

.workspace-theme-color.is-arctic {
    background: #7dd3fc;
}

.workspace-theme-color.is-saffron {
    background: #fbbf24;
}

.workspace-theme-color.is-graphite {
    background: #94a3b8;
}

.workspace-theme-color.is-slate {
    background: #64748b;
}

.workspace-theme-color.is-mist {
    background: #cbd5e1;
}

.workspace-theme-color.is-terracotta {
    background: #fb923c;
}

.workspace-theme-color.is-rosewood {
    background: #9f3655;
}

.workspace-theme-color.is-dusk {
    background: #6366f1;
}

.workspace-theme-color.is-aurora {
    background: #e879f9;
}

/* Neutral shades - dark to light */
.workspace-theme-color.is-charcoal {
    background: #1a1f2e;
}

.workspace-theme-color.is-stone {
    background: #a3acb9;
}

.workspace-theme-color.is-dust {
    background: #bcc5d0;
}

.workspace-theme-color.is-pearl {
    background: #e5e7eb;
}

/* Blue shades - dark to light */
.workspace-theme-color.is-indigo {
    background: #4533b0;
}

.workspace-theme-color.is-sky {
    background: #bae6fd;
}

.workspace-theme-color.is-azure {
    background: #e0f2fe;
}

.workspace-theme-color.is-cyan {
    background: #f0f9ff;
}

/* Green shades - dark to light */
.workspace-theme-color.is-forest-dark {
    background: #1b4332;
}

.workspace-theme-color.is-moss-dark {
    background: #40916c;
}

.workspace-theme-color.is-sage {
    background: #95d5b2;
}

.workspace-theme-color.is-lime {
    background: #d8f3dc;
}

/* Red shades - dark to light */
.workspace-theme-color.is-maroon {
    background: #5c0a0a;
}

.workspace-theme-color.is-scarlet {
    background: #dc2626;
}

.workspace-theme-color.is-rose {
    background: #fb7185;
}

.workspace-theme-color.is-coral {
    background: #f97316;
}

.workspace-theme-color.is-salmon {
    background: #fca5a5;
}

.workspace-theme-color.is-pink {
    background: #fbcfe8;
}

/* Warm shades - dark to light */
.workspace-theme-color.is-burnt-sienna {
    background: #b45309;
}

.workspace-theme-color.is-rust {
    background: #dc5c3e;
}

.workspace-theme-color.is-amber {
    background: #f59e0b;
}

.workspace-theme-color.is-gold {
    background: #facc15;
}

.workspace-theme-color.is-honey {
    background: #fef08a;
}

/* Purple shades - dark to light */
.workspace-theme-color.is-indigo-dark {
    background: #312e81;
}

.workspace-theme-color.is-plum-dark {
    background: #6d28d9;
}

.workspace-theme-color.is-lavender {
    background: #d8b4fe;
}

.workspace-theme-color.is-lilac {
    background: #ede9fe;
}

.workspace-theme-color.is-mauve {
    background: #f3e8ff;
}

.workspace-theme-color.is-petal {
    background: #faf5ff;
}

/* Additional warm/neutral shades */
.workspace-theme-color.is-tan {
    background: #d2b48c;
}

.workspace-theme-color.is-cream {
    background: #fffdd0;
}

.workspace-theme-color.is-ivory {
    background: #faf9f7;
}

@keyframes magicHaloSpin {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.1);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes telegramFireflyDriftA {
    0% {
        transform: translate3d(0, -2%, 0) scale(1);
    }
    25% {
        transform: translate3d(18px, 4%, 0) scale(1.04);
    }
    50% {
        transform: translate3d(-14px, 11%, 0) scale(0.98);
    }
    75% {
        transform: translate3d(24px, 16%, 0) scale(1.03);
    }
    100% {
        transform: translate3d(-10px, 22%, 0) scale(1);
    }
}

@keyframes telegramFireflyDriftB {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    20% {
        transform: translate3d(-22px, 6%, 0) scale(1.02);
    }
    50% {
        transform: translate3d(16px, 14%, 0) scale(0.97);
    }
    80% {
        transform: translate3d(-10px, 19%, 0) scale(1.03);
    }
    100% {
        transform: translate3d(20px, 26%, 0) scale(1);
    }
}

@keyframes telegramFireflyPulseA {
    0%, 100% {
        opacity: 0.42;
    }
    35% {
        opacity: 0.88;
    }
    65% {
        opacity: 0.56;
    }
}

@keyframes telegramFireflyPulseB {
    0%, 100% {
        opacity: 0.34;
    }
    40% {
        opacity: 0.72;
    }
    70% {
        opacity: 0.48;
    }
}

@media (prefers-reduced-motion: reduce) {
    .telegram-chat-shell::before,
    .telegram-chat-shell::after {
        animation: none;
    }
}

.telegram-mobile-toggle {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 8px);
    left: 8px;
    z-index: 1200;
}

.status-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-shell {
    align-items: start;
}

.admin-card {
    align-content: start;
}

.admin-header {
    align-items: start;
}

.stats-grid,
.admin-grid,
.table-grid {
    display: grid;
    gap: 16px;
}

.stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card,
.panel-card,
.table-card {
    background: rgba(148, 163, 184, 0.06);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
}

.metric-card {
    display: grid;
    gap: 6px;
}

.metric-card strong {
    font-size: 1.45rem;
}

.admin-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel-form {
    display: grid;
    gap: 10px;
}

.table-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.table-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.table-wrap {
    overflow: auto;
}

.workspace-members-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 280px;
}

.workspace-members-compact .pill {
    padding: 4px 8px;
    font-size: 0.72rem;
}

.workspace-member-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.inline-revoke-form {
    display: inline;
    margin: 0;
    padding: 0;
}

.pill-remove-button {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border: 0;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    min-width: 16px;
    font-size: 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: background 0.15s;
}

.pill-remove-button:hover {
    background: rgba(239, 68, 68, 0.4);
}

.table-card-wide {
    grid-column: 1 / -1;
}

.workspace-access-board {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.workspace-access-card {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
    padding: 12px;
    background: rgba(148, 163, 184, 0.03);
    display: grid;
    gap: 10px;
}

.workspace-access-card > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.workspace-access-card > header strong {
    color: #f1f5ff;
}

.workspace-access-card > header small {
    color: rgba(255, 255, 255, 0.56);
}

.workspace-access-members {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.workspace-access-members li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 10px;
    padding: 8px;
    background: rgba(148, 163, 184, 0.02);
}

.workspace-access-members li span {
    color: var(--muted);
    font-size: 0.84rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: right;
    padding: 9px 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    white-space: nowrap;
}

th {
    color: #d0c8f0;
    font-weight: 600;
}

td {
    color: var(--muted);
}

.pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(139, 108, 247, 0.14);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.76rem;
    color: #d0c8f0;
    background: rgba(139, 108, 247, 0.08);
}

.activity-panel {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overflow-anchor: none;
    border-radius: 18px;
    border: 1px solid rgba(139, 108, 247, 0.06);
    padding: 14px;
    background: transparent;
    min-height: 300px;
    display: grid;
    gap: 10px;
    align-content: start;
    scrollbar-gutter: stable;
}

.telegram-feed {
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 14px 16px;
    gap: 8px;
}

.entry-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    max-width: 100%;
    direction: ltr;
    padding: 5px 6px;
    margin: 0 -6px;
    border-radius: 18px;
    transition: background 0.28s ease, box-shadow 0.28s ease, transform 0.28s ease;
}

.entry-row.is-context-active {
    background: transparent;
    box-shadow: none;
}

.entry-row.is-context-fade {
    background: transparent;
    box-shadow: none;
}

.entry-row.is-self {
    justify-content: flex-end;
}

.entry-row.is-self .entry-avatar-wrap {
    order: 2;
}

.entry-row.is-self .entry-avatar {
    background: linear-gradient(135deg, var(--telegram-green-strong), #f0abfc);
}

.entry-row.is-self .entry-card {
    order: 1;
}

.entry-row.is-other {
    justify-content: flex-start;
}

.entry-avatar-wrap {
    width: 34px;
    flex-shrink: 0;
}

.entry-avatar {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    font-size: 0.88rem;
}

.entry-card {
    width: min(100%, 640px);
    background: var(--telegram-bubble);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px 16px 16px 6px;
    padding: 10px 12px 8px;
    position: relative;
    direction: rtl;
    transition: box-shadow 0.28s ease, background-color 0.28s ease, transform 0.28s ease, border-color 0.28s ease;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}

.entry-card.is-context-active {
    box-shadow: 0 0 0 1px rgba(255, 138, 42, 0.78), 0 18px 38px rgba(255, 138, 42, 0.22);
    transform: translateY(-2px) scale(1.01);
}

.entry-card.is-context-fade {
    box-shadow: 0 0 0 0 rgba(255, 138, 42, 0), 0 0 0 rgba(255, 138, 42, 0);
    transform: translateY(0);
}

.entry-card.is-context-active::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 138, 42, 0.16), rgba(255, 138, 42, 0.04));
    pointer-events: none;
}

.entry-row.is-self .entry-card {
    background: var(--telegram-bubble-self);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-radius: 16px 16px 6px 16px;
}

.entry-card::after {
    content: "";
    position: absolute;
    bottom: 0;
    width: 10px;
    height: 12px;
    background: inherit;
}

.entry-row.is-other .entry-card::after {
    left: -4px;
    clip-path: polygon(100% 0, 0 100%, 100% 100%);
}

.entry-row.is-self .entry-card::after {
    right: -4px;
    clip-path: polygon(0 0, 0 100%, 100% 100%);
}

.entry-card header {
    margin-bottom: 6px;
}

.entry-author-line {
    display: flex;
    direction: ltr;
    margin-bottom: 4px;
    justify-content: flex-start;
}

.entry-author-name {
    font-size: 0.78rem;
    text-align: left;
    color: #f0a050;
    opacity: 1;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-shadow: 0 0 14px rgba(240, 160, 80, 0.25);
}

.entry-card strong {
    color: #fff;
    font-size: 0.84rem;
}

.entry-card .entry-author-name {
    color: #f0a050;
    font-size: 0.78rem;
    text-shadow: 0 0 14px rgba(240, 160, 80, 0.25);
}

.entry-card header time {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.7rem;
}

.entry-card p {
    margin: 0;
    line-height: 1.5;
    white-space: pre-wrap;
    font-size: 0.92rem;
}

[data-entry-text],
[data-reply-text] {
    text-align: start;
}

.reply-quote,
.reply-draft,
.edit-draft {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 8px;
    margin-bottom: 6px;
    border-right: 3px solid rgba(255, 255, 255, 0.42);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.08);
}

.reply-quote strong,
.reply-draft strong,
.edit-draft strong {
    display: block;
    margin-bottom: 2px;
    font-size: 0.8rem;
}

.reply-quote span,
.reply-draft span {
    display: block;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.entry-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 6px;
    font-size: 0.68rem;
    direction: ltr;
}

.entry-reactions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.entry-reactions.is-empty {
    display: none;
}

.entry-reaction-chip {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.08);
    color: #eef4f8;
    border-radius: 999px;
    min-height: 28px;
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    line-height: 1;
}

.entry-reaction-chip.is-self-reacted {
    background: rgba(139, 108, 247, 0.18);
    border-color: rgba(139, 108, 247, 0.28);
    box-shadow: 0 6px 18px rgba(139, 108, 247, 0.1);
}

.entry-reaction-chip small {
    color: rgba(255, 255, 255, 0.84);
    font-size: 0.72rem;
}

.entry-reaction-emoji {
    font-size: 1rem;
    line-height: 1;
}

.chat-emoji-glyph {
    display: inline-block;
    line-height: 1;
}

.entry-react-toggle {
    align-self: flex-end;
    margin-bottom: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(139, 108, 247, 0.1);
    background: rgba(14, 16, 26, 0.92);
    color: rgba(255, 255, 255, 0.92);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.entry-row:hover .entry-react-toggle,
.entry-row:focus-within .entry-react-toggle,
.entry-react-toggle:focus-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.entry-react-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
}

.entry-row.is-other .entry-react-toggle {
    margin-left: 6px;
    margin-right: 0;
    order: 3;
}

.entry-row.is-self .entry-react-toggle {
    margin-right: 6px;
    margin-left: 0;
    order: 0;
}

.entry-edited {
    order: 1;
}

.entry-date {
    order: 2;
}

.entry-time {
    order: 3;
}

.entry-time {
    color: rgba(255, 255, 255, 0.88);
}

.entry-date,
.entry-edited {
    color: rgba(255, 255, 255, 0.46);
}

.asset-list,
.upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.asset-list {
    max-width: 100%;
}

.asset-list > * {
    max-width: 100%;
    min-width: 0;
}

.upload-preview {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-left: 2px;
}

.upload-preview-header {
    display: flex;
    justify-content: flex-end;
}

.upload-preview-clear {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    color: #f5f7ff;
    display: inline-grid;
    place-items: center;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0;
}

.upload-preview-clear:hover {
    background: rgba(255, 255, 255, 0.14);
}

.upload-progress {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    display: grid;
    gap: 6px;
}

.upload-progress-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    direction: ltr;
    flex-wrap: wrap;
}

.upload-progress-top [data-upload-progress-label] {
    width: 100%;
    direction: rtl;
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-progress-top strong {
    color: #e8ecff;
    font-size: 0.78rem;
}

.upload-progress-top span {
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.72rem;
}

.upload-cancel-button {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    color: #f5f7ff;
    border-radius: 999px;
    min-height: 24px;
    padding: 3px 10px;
    font-size: 0.7rem;
    line-height: 1;
}

.upload-cancel-button:hover {
    background: rgba(255, 255, 255, 0.14);
}

.upload-cancel-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.upload-progress-track {
    width: 100%;
    height: 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    direction: ltr;
}

.upload-progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(139, 108, 247, 0.95), rgba(168, 85, 247, 0.95));
    transition: width 0.25s ease;
    transform-origin: left center;
}

.asset-chip,
.upload-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.08);
    min-height: 42px;
    max-width: 100%;
}

.upload-chip {
    justify-content: flex-start;
}

.asset-chip {
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    width: min(100%, 320px);
}

.asset-extension-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(255, 179, 107, 0.16);
    color: #ffc78f;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.asset-extension-badge-image {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1;
    background: rgba(15, 25, 35, 0.74);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.asset-chip span,
.upload-chip span {
    color: var(--muted);
    word-break: break-word;
    direction: ltr;
    text-align: left;
    unicode-bidi: plaintext;
}

.asset-chip span {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asset-chip small {
    color: rgba(255, 255, 255, 0.46);
    white-space: nowrap;
}

.upload-chip small {
    display: block;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 3px;
}

.chat-image-card {
    border: 0;
    padding: 0;
    width: min(280px, 54vw);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    position: relative;
}

.chat-image-card img {
    display: block;
    width: 100%;
    max-height: 240px;
    object-fit: cover;
}

.asset-chip img,
.upload-chip img {
    width: 34px;
    height: 34px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.upload-chip.upload-chip-image img {
    width: 56px;
    height: 56px;
    border-radius: 10px;
}

.upload-chip video {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.24);
}

.upload-chip-remove {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border: 0;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    min-width: 22px;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.upload-chip-remove:hover {
    background: rgba(239, 68, 68, 0.36);
}

.telegram-composer-shell.is-drag-over {
    outline: 2px dashed rgba(139, 108, 247, 0.55);
    outline-offset: -2px;
    background: rgba(139, 108, 247, 0.06);
}

.empty-state {
    min-height: 100%;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 22px;
    border: 1px dashed rgba(148, 163, 184, 0.24);
    border-radius: 16px;
}

.empty-state.compact {
    min-height: auto;
    text-align: right;
    place-items: start;
    padding: 14px;
}

.composer-card {
    flex-shrink: 0;
    border-radius: 20px;
    padding: 0;
}

.telegram-composer-shell {
    position: relative;
    border-radius: 0;
    border: 0;
    background: linear-gradient(180deg, rgba(12, 14, 24, 0.96), rgba(10, 11, 20, 0.98));
    box-shadow: none;
    padding: 10px 14px 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
    margin-top: auto;
    border-top: 1px solid rgba(139, 108, 247, 0.08);
}

.composer-grid {
    grid-template-columns: minmax(0, 1fr) 180px;
    align-items: end;
}

.telegram-composer-grid {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
    direction: ltr;
}

.field-grow {
    min-width: 0;
}

.telegram-input-shell {
    gap: 8px;
    padding: 10px 14px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(139, 108, 247, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    min-height: 54px;
    direction: rtl;
}

.telegram-input-shell textarea {
    min-height: 24px;
    max-height: 128px;
    border: 0;
    background: transparent;
    padding: 4px 0;
    box-shadow: none;
    resize: none;
}

.telegram-input-shell .ghost-button {
    padding: 4px 8px;
}

.telegram-picker-button {
    width: auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.05));
    color: rgba(233, 237, 239, 0.92);
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 1.28rem;
    line-height: 1;
    font-weight: 600;
    text-align: center;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
}

.telegram-picker-button span {
    font-size: inherit;
    line-height: 1;
}

.telegram-picker-button input {
    display: none;
}

.telegram-picker-button:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.07));
}

.telegram-picker-button.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.telegram-sound-toggle {
    font-size: 0.86rem;
}

.sidebar-action-button.telegram-sound-toggle {
    justify-content: center;
    letter-spacing: 0;
}

.telegram-sound-toggle.is-muted {
    opacity: 0.72;
}

.telegram-send-column {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    align-self: center;
    width: auto;
    min-width: 0;
}

.telegram-tools-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: end;
}

.telegram-tools-column-right {
    justify-self: end;
}

.emoji-picker {
    margin-top: 12px;
    border-radius: 18px;
    border: 1px solid rgba(139, 108, 247, 0.1);
    background: linear-gradient(180deg, rgba(14, 16, 26, 0.98), rgba(11, 13, 22, 0.99));
    padding: 8px;
    display: grid;
    gap: 6px;
    max-height: 198px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
    overflow: hidden;
}

.emoji-picker-header,
.emoji-picker-tabs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.emoji-picker-header {
    padding: 2px 2px 2px;
}

.emoji-picker-tabs {
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 2px 4px;
}

.emoji-tab-button {
    border: 0;
    border-radius: 999px;
    padding: 7px 12px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(233, 237, 239, 0.9);
    font-size: 0.8rem;
}

.emoji-tab-button.is-active {
    background: rgba(139, 108, 247, 0.2);
    color: #d4ccf0;
}

.emoji-picker-groups {
    overflow: auto;
    display: block;
    padding: 2px;
    max-height: 182px;
    min-height: 0;
    mask-image: linear-gradient(to bottom, transparent 0, black 12px, black calc(100% - 12px), transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, black 12px, black calc(100% - 12px), transparent 100%);
}

.emoji-group {
    display: block;
    margin-bottom: 6px;
}

.emoji-group-frequent {
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    gap: 4px;
}

.emoji-grid-frequent {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
}

.emoji-button {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 1.12rem;
    line-height: 1;
    display: inline-grid;
    place-items: center;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
    position: relative;
}

.emoji-button:hover::after {
    content: none;
}

.emoji-hover-preview {
    position: fixed;
    z-index: 999999;
    font-size: 1rem;
    line-height: 1.2;
    background: rgba(14, 16, 26, 0.98);
    border: 1px solid rgba(139, 108, 247, 0.2);
    border-radius: 12px;
    padding: 7px 8px;
    pointer-events: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.52);
    white-space: normal;
    direction: ltr;
    max-width: min(82vw, 340px);
}

.emoji-hover-preview.is-emoji-only {
    padding: 10px 12px;
    border-radius: 14px;
    max-width: none;
}

.emoji-hover-only-emoji {
    font-size: 3.25rem;
    line-height: 1;
}

.emoji-hover-header {
    font-size: 1.9rem;
    line-height: 1;
    margin-bottom: 4px;
}

.emoji-hover-users {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    min-width: 0;
    max-width: none;
}

.emoji-hover-groups {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
}

.emoji-hover-group {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
}

.emoji-hover-group-title {
    font-size: 0.92rem;
    color: rgba(248, 250, 252, 0.9);
}

.emoji-hover-users li {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    line-height: 1.35;
    padding: 3px 6px;
    border-radius: 7px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(255, 255, 255, 0.04);
}

.emoji-hover-users li span {
    color: #e8edf7;
    max-width: 74px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reaction-picker {
    position: fixed;
    z-index: 85;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    width: 248px;
    max-height: 220px;
    overflow: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
    background: rgba(12, 14, 24, 0.98);
    border: 1px solid rgba(139, 108, 247, 0.1);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4);
}

.reaction-picker button {
    border: 0;
    border-radius: 12px;
    min-height: 38px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 1.12rem;
    line-height: 1;
}

.reaction-picker button:hover {
    background: rgba(255, 255, 255, 0.12);
}

.emoji-button:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.telegram-send-button {
    width: 46px;
    height: 46px;
    min-width: 46px;
    max-width: 46px;
    min-height: 46px;
    max-height: 46px;
    padding: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    box-shadow: 0 12px 28px rgba(139, 108, 247, 0.32);
    flex-shrink: 0;
    margin-bottom: 4px;
}

.telegram-security-note {
    margin: 2px 0 0;
    font-size: 0.72rem;
    line-height: 1.45;
    color: rgba(233, 237, 239, 0.72);
    text-align: right;
}

[data-entry-text].has-emoji .chat-emoji-glyph {
    font-size: 1.35em;
    vertical-align: -0.15em;
}

[data-entry-text].emoji-only .chat-emoji-glyph {
    font-size: 2.2em;
}

.table-action-button {
    border: 0;
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 0.76rem;
    font-weight: 600;
}

.table-action-button-danger {
    background: rgba(239, 68, 68, 0.14);
    color: #fecaca;
}

.table-action-button-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.table-action-button-warning {
    background: rgba(245, 158, 11, 0.14);
    color: #fde68a;
}

.table-action-button-warning:hover {
    background: rgba(245, 158, 11, 0.22);
}

.table-action-button-success {
    background: rgba(34, 197, 94, 0.14);
    color: #86efac;
}

.table-action-button-success:hover {
    background: rgba(34, 197, 94, 0.22);
}

.pill-disabled {
    background: rgba(245, 158, 11, 0.16);
    color: #fde68a;
    font-size: 0.65rem;
}

.is-workspace-disabled {
    opacity: 0.6;
}

.alert-fade-out {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.message-menu {
    position: fixed;
    z-index: 80;
    min-width: 164px;
    display: grid;
    gap: 2px;
    padding: 5px;
    border-radius: 14px;
    background: rgba(14, 16, 26, 0.98);
    border: 1px solid rgba(139, 108, 247, 0.1);
    box-shadow: 0 22px 56px rgba(0, 0, 0, 0.42);
}

.message-menu button {
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    padding: 9px 10px;
    border-radius: 10px;
}

.message-menu button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.remember-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.9rem;
    user-select: none;
}

.remember-row input {
    width: 16px;
    height: 16px;
}

.page-toast-host {
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    gap: 8px;
    z-index: 140;
    width: min(92vw, 520px);
    pointer-events: none;
}

.page-toast {
    pointer-events: auto;
    border-radius: 12px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(6px);
    box-shadow: var(--shadow);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.page-toast.is-error {
    background: rgba(127, 29, 29, 0.9);
    color: #fee2e2;
}

.page-toast.is-success {
    background: rgba(6, 78, 59, 0.88);
    color: #d1fae5;
}

.page-toast.is-leaving {
    opacity: 0;
    transform: translateY(-6px);
}

.page-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 130;
    background: rgba(5, 8, 14, 0.72);
    display: grid;
    place-items: center;
    padding: 16px;
}

.page-dialog-backdrop[hidden] {
    display: none;
}

.page-dialog {
    width: min(100%, 420px);
    display: grid;
    gap: 12px;
    padding: 16px;
    border-radius: 14px;
    background: rgba(13, 16, 24, 0.98);
    border: 1px solid rgba(139, 108, 247, 0.2);
    box-shadow: var(--shadow);
}

.page-dialog.page-dialog-compact {
    width: min(100%, 300px);
    gap: 10px;
    padding: 12px;
}

.page-dialog.page-dialog-compact h3,
.page-dialog.page-dialog-compact p {
    margin: 0;
    font-size: 0.86rem;
    text-align: center;
}

.page-dialog.page-dialog-compact [data-page-dialog-password] {
    min-height: 34px;
    padding: 8px 10px;
    text-align: center;
}

.page-dialog-hidden-username {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.page-dialog h3 {
    margin: 0;
}

.page-dialog p {
    margin: 0;
    color: var(--muted);
}

.page-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.profile-sheet {
    position: fixed;
    inset: 0;
    z-index: 75;
    background: rgba(0, 0, 0, 0.45);
    display: grid;
    place-items: start center;
    padding: 12px;
    overflow: auto;
}

.profile-sheet-inner {
    width: min(100%, 430px);
    display: grid;
    gap: 8px;
    max-height: calc(100vh - 24px);
    overflow: auto;
    padding-right: 2px;
}

.image-viewer {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(7, 10, 14, 0.92);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 14px;
}

.image-viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.image-viewer-actions {
    display: flex;
    gap: 6px;
}

.image-viewer-stage {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    cursor: grab;
}

.image-viewer-stage.is-dragging {
    cursor: grabbing;
}

.image-viewer-stage img {
    position: absolute;
    top: 50%;
    left: 50%;
    max-width: min(80vw, 1100px);
    max-height: 78vh;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    user-select: none;
    -webkit-user-drag: none;
}

.profile-card {
    width: 100%;
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(16, 18, 30, 0.98);
    border: 1px solid rgba(139, 108, 247, 0.1);
    box-shadow: var(--shadow);
}

.profile-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.profile-avatar-picker {
    display: grid;
    justify-items: center;
    gap: 10px;
}

.profile-avatar-picker img,
.profile-avatar-picker .avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-actions {
    display: flex;
    justify-content: flex-end;
}

.profile-password-card {
    margin-top: 2px;
}

.profile-password-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.field-hint {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.45);
    margin: 0;
}

.avatar-cropper-backdrop {
    position: fixed;
    inset: 0;
    z-index: 150;
    background: rgba(6, 9, 13, 0.78);
    display: grid;
    place-items: center;
    padding: 12px;
}

.avatar-cropper-backdrop[hidden] {
    display: none;
}

.avatar-cropper-card {
    width: min(100%, 340px);
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(16, 18, 30, 0.98);
    border: 1px solid rgba(139, 108, 247, 0.18);
    box-shadow: var(--shadow);
}

.avatar-cropper-card header {
    display: flex;
    justify-content: center;
    font-size: 0.92rem;
}

.avatar-cropper-stage {
    width: 220px;
    height: 220px;
    margin: 0 auto;
    position: relative;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    touch-action: none;
    cursor: grab;
}

.avatar-cropper-stage img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    user-select: none;
    -webkit-user-drag: none;
}

.avatar-cropper-mask {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.42);
    box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.14);
    pointer-events: none;
}

.avatar-cropper-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

[data-avatar-cropper-zoom] {
    direction: ltr;
}

.password-status {
    font-size: 0.85rem;
    text-align: center;
    padding: 8px;
    border-radius: 8px;
    margin: 0;
}

.password-status.success {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.password-status.error {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

.table-action-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-password-form {
    display: flex;
    gap: 4px;
    align-items: center;
}

.inline-password-input {
    width: 130px;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(139, 108, 247, 0.25);
    background: rgba(16, 18, 30, 0.6);
    color: #fff;
    font-size: 0.82rem;
    font-family: inherit;
}

.workspace-name-input {
    width: 260px;
    max-width: 100%;
    direction: ltr;
}

.stacked-actions {
    align-self: stretch;
}

.icon-button {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
}

.mobile-only {
    display: none;
}

@media (max-width: 960px) {
    .workspace-shell {
        grid-template-columns: 1fr;
    }

    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-shell .sidebar-card {
        position: relative;
        top: auto;
    }

    .telegram-shell {
        grid-template-columns: 1fr;
    }

    .sidebar-card {
        position: fixed;
        inset: 12px auto 12px 12px;
        width: min(92vw, 420px);
        max-width: none;
        z-index: 30;
        transform: translateX(calc(-100% - 24px));
        transition: transform 0.25s ease;
        min-height: auto;
    }

    .telegram-sidebar {
        max-width: none;
    }

    .sidebar-card.is-open {
        transform: translateX(0);
    }

    .workspace-card {
        min-height: 100dvh;
        height: 100dvh;
    }

    .telegram-chat-shell {
        min-height: 100dvh;
        height: 100dvh;
    }

    .activity-panel {
        padding: 12px;
    }

    .workspace-chat-header {
        padding: 10px 12px 8px;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .workspace-chat-theme {
        width: auto;
        justify-items: end;
    }

    .workspace-theme-panel {
        width: min(228px, calc(100vw - 20px));
    }

    .telegram-composer-shell {
        padding: 10px 12px 12px;
    }

    .composer-grid {
        grid-template-columns: 1fr;
    }

    .telegram-composer-grid {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .telegram-send-column {
        gap: 6px;
    }

    .telegram-tools-column {
        gap: 6px;
    }

    .reply-quote span,
    .reply-draft span {
        max-width: 180px;
    }

    .mobile-only {
        display: inline-grid;
    }

    .stats-grid,
    .admin-grid,
    .table-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .access-shell,
    .workspace-shell {
        padding: 10px;
    }

    .access-card,
    .workspace-card,
    .sidebar-card,
    .composer-card {
        border-radius: 18px;
    }

    .access-card,
    .workspace-card {
        padding: 12px;
    }

    .activity-panel {
        padding: 12px;
    }

    .telegram-chat-shell,
    .telegram-sidebar {
        padding: 0;
    }

    .telegram-chat-shell {
        min-height: 100dvh;
        height: 100dvh;
    }

    .workspace-chat-title {
        font-size: 0.93rem;
    }

    .workspace-chat-member-tag {
        font-size: 0.66rem;
        padding: 2px 8px;
    }

    .entry-row {
        gap: 6px;
        padding: 3px 0;
        margin: 0;
    }

    .entry-card {
        width: auto;
        flex: 1 1 auto;
        max-width: calc(100% - 36px);
        padding: 9px 10px 7px;
    }

    .entry-avatar-wrap,
    .entry-avatar {
        width: 28px;
        height: 28px;
    }

    .entry-react-toggle {
        display: none;
    }

    .chat-image-card {
        width: min(240px, 62vw);
    }

    .asset-chip {
        width: min(100%, 240px);
    }

    .asset-chip span,
    .upload-chip span {
        max-width: 12ch;
    }

    .telegram-feed {
        padding: 10px;
    }

    .telegram-composer-shell {
        position: sticky;
        bottom: 0;
        z-index: 4;
    }

    .telegram-input-shell {
        border-radius: 20px;
        padding: 8px 12px;
        min-height: 48px;
    }

    .telegram-send-column {
        gap: 6px;
        min-width: 68px;
    }

    .telegram-tools-column {
        gap: 6px;
    }

    .telegram-picker-button {
        min-height: 36px;
        font-size: 1.12rem;
        width: 36px;
        min-width: 36px;
    }

    .telegram-send-button {
        width: 40px;
        height: 40px;
        min-width: 40px;
        max-width: 40px;
        min-height: 40px;
        max-height: 40px;
    }

    .emoji-picker {
        max-height: 188px;
    }

    .emoji-picker-groups {
        max-height: 172px;
    }

    .reaction-picker {
        width: 208px;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        max-height: 200px;
    }

    .entry-react-toggle {
        opacity: 1;
        pointer-events: auto;
        transform: none;
    }

    .profile-sheet {
        padding: 8px;
    }

    .profile-sheet-inner {
        max-height: calc(100vh - 16px);
        gap: 6px;
    }

    .profile-card {
        padding: 10px;
        gap: 8px;
        border-radius: 14px;
    }

    .avatar-cropper-stage {
        width: 196px;
        height: 196px;
    }
}

@keyframes unreadNameBlink {
    0%,
    100% {
        background: rgba(250, 204, 21, 0.16);
        box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.2);
    }
    50% {
        background: rgba(250, 204, 21, 0.34);
        box-shadow: 0 0 0 6px rgba(250, 204, 21, 0);
    }
}

.telegram-chat-item.has-unread .workspace-title {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 8px;
    color: #fff7cc;
    animation: unreadNameBlink 1.3s ease-in-out infinite;
}

.telegram-chat-item.is-active .workspace-title {
    animation: none;
}

.telegram-chat-item.is-workspace-disabled {
    opacity: 0.5;
}

.workspace-disabled-label {
    display: inline-block;
    font-size: 0.62rem;
    color: #fde68a;
    background: rgba(245, 158, 11, 0.16);
    padding: 1px 6px;
    border-radius: 6px;
    margin-top: 2px;
}
