:root {
    --bg: #1f1f1f;
    --bg-soft: #1f1f1f;
    --panel: #1f1f1f;
    --panel-alt: #221f1f1f3041;
    --line: rgba(255, 255, 255, 0.06);
    --text: #ffffff;
    --muted: #90a1b5;
    --accent: #d7dee7;
    --accent-strong: #4a4a4a;
    --danger: #f87171;
    --bubble-sent: #0084f7;
    --bubble-received: #E5E5EA;
    --input: #5c5c5c;
    --reaction-sidecar-gap: 2px;
}

* {
    box-sizing: border-box;
    min-width: 0;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background: #111315;
    color: var(--text);
}

body {
    display: flex;
    justify-content: center;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
select,
textarea {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 0;
    border-radius: 12px;
    padding: 0.82rem 0.95rem;
    background: var(--input);
    color: var(--text);
}

textarea {
    resize: none;
}

label {
    display: grid;
    gap: 0.4rem;
    color: var(--muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    padding: 0.82rem 1.15rem;
    cursor: pointer;
    text-align: center;
}

.btn-primary {
    background: var(--accent-strong);
    color: #fff;
}

.btn-secondary {
    background: #314456;
    color: #d8e6f5;
}

.btn-danger {
    background: rgba(220, 38, 38, 0.18);
    color: #fecaca;
}

.full-width {
    width: 100%;
    text-align: center;
}

.auth-shell {
    min-height: 100vh;
    width: 100%;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: #111315;
}

.auth-card,
.notification-card,
.profile-card-screen,
.screen-panel {
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.3);
}

.auth-card {
    width: min(100%, 420px);
    border-radius: 28px;
    background: #1f1f1f;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 2rem;
}

.login-logo {
    display: block;
    width: min(100%, 320px);
    height: auto;
    margin: 0 auto 1.5rem;
}

.auth-links {
    margin-top: 20px;
}

.auth-copy,
.seed-note,
.conversation-snippet,
.empty-state p {
    color: var(--muted);
}

.stack-form {
    display: grid;
    gap: 0.9rem;
    margin: 0;
}

.stack-form[hidden] {
    display: none !important;
}

.flash {
    border-radius: 14px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.flash-success {
    background: rgba(5, 150, 105, 0.18);
    color: #bbf7d0;
}

.flash-error {
    background: rgba(220, 38, 38, 0.2);
    color: #fecaca;
}

.mobile-app {
    --mobile-topbar-height: 64px;
    --mobile-bottom-nav-height: calc(56px + env(safe-area-inset-bottom));
    --keyboard-offset: 0px;
    --viewport-offset-top: 0px;
    width: 100%;
    max-width: none;
    height: 100vh;
    min-height: 100vh;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    transform: none;
    z-index: 20;
    width: 100%;
    max-width: none;
    height: 64px;
    background: #1f1f1f;
    display: grid;
    grid-template-columns: 60px 1fr 60px;
    align-items: center;
    padding: 0 0.5rem;
    border-bottom: 1px solid var(--line);
}

.mobile-topbar-chat {
    grid-template-columns: 64px minmax(0, 1fr) 92px;
}

.topbar-title {
    text-align: center;
    display: grid;
    justify-items: center;
    gap: 0.2rem;
}

.topbar-title strong {
    display: block;
    font-size: 1.15rem;
    font-weight: 600;
}

.conversation-brand-title {
    font-family: "Lustria", Georgia, serif;
    font-weight: 400;
    letter-spacing: 0.03em;
    text-align: left;
}

.topbar-title .conversation-brand-title {
    font-size: 0.95rem;
    line-height: 1.1;
}

.conversation-list-topbar {
    grid-template-columns: minmax(0, 1fr) 60px;
}

.conversation-list-title {
    justify-items: start;
    text-align: left;
    padding-left: 0.4rem;
}

.topbar-title-with-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    text-align: left;
    min-width: 0;
}

.topbar-title-copy {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
    text-align: left;
}

.topbar-title-copy strong,
.topbar-title-copy small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-title small,
.topbar-title.faint {
    color: var(--muted);
    font-size: 0.82rem;
}

.icon-link,
.topbar-action,
.composer-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    background: transparent;
    border: 0;
    font-size: 1.35rem;
    cursor: pointer;
}

.topbar-action {
    justify-self: start;
    font-size: 1rem;
    padding-left: 0.35rem;
}

.topbar-action-right {
    justify-self: end;
    padding-left: 0;
    padding-right: 0.35rem;
    text-align: right;
}

.icon-link.dark {
    color: #313e53;
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
    color: currentColor;
    font-variation-settings:
        "FILL" 0,
        "wght" 400,
        "GRAD" 0,
        "opsz" 24;
}

.topbar-avatar,
.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #4b4b4b;
    color: #fff;
    font-weight: 700;
    overflow: hidden;
}

.conversation-topbar-avatar {
    flex: 0 0 auto;
}

.avatar-circle img,
.topbar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-button {
    padding: 0;
    border: 0;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.conversation-avatar-button {
    border-radius: 999px;
}

.conversation-avatar-button:focus-visible {
    outline: 2px solid #58a6ff;
    outline-offset: 2px;
}

.screen-panel {
    flex: 1;
    min-height: 0;
    margin-top: var(--mobile-topbar-height);
    margin-bottom: var(--mobile-bottom-nav-height);
    padding: 10px 0 calc(var(--mobile-bottom-nav-height) + 1rem);
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: #1a1a1a;
}

.search-stack,
.compact-form,
.slim-results,
.profile-form {
    padding: 0 0.7rem;
}

.search-field input {
    height: 38px;
    border-radius: 8px;
    background: #555555 !important;
    color: #ffffff !important;
    padding-left: 1rem;
    border: 1px solid #555555;
}

.search-field input::placeholder {
    color: rgba(255, 255, 255, 0.72);
}

.search-field input:-webkit-autofill,
.search-field input:-webkit-autofill:hover,
.search-field input:-webkit-autofill:focus,
.desktop-search-form input:-webkit-autofill,
.desktop-search-form input:-webkit-autofill:hover,
.desktop-search-form input:-webkit-autofill:focus {
    -webkit-text-fill-color: #ffffff;
    -webkit-box-shadow: 0 0 0 1000px #555555 inset;
    box-shadow: 0 0 0 1000px #555555 inset;
    caret-color: #ffffff;
}

.search-submit {
    display: none;
    width: 100%;
    border-radius: 12px;
}

.search-stack:focus-within .search-submit,
.search-stack.active .search-submit {
    display: inline-flex;
    justify-content: center;
}

.chat-list,
.contact-list {
    margin-top: 0.55rem;
    padding-bottom: calc(var(--mobile-bottom-nav-height) + 1rem);
}

.chat-row-shell,
.desktop-chat-row-shell {
    position: relative;
}

.chat-row,
.contact-row {
    display: grid;
    grid-template-columns: 52px 1fr auto;
    gap: 0.8rem;
    align-items: center;
    padding: 0.78rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.chat-row,
.desktop-chat-row {
    -webkit-touch-callout: none;
    padding-right: 3.2rem;
}

.conversation-list-options-toggle {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    width: 34px;
    height: 34px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #f3f6fb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.06em;
    cursor: pointer;
    z-index: 3;
}

.conversation-list-options-toggle:hover,
.conversation-list-options-toggle[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.08);
}

.conversation-list-options-toggle-mobile {
    right: 0.55rem;
}

.chat-copy,
.contact-copy {
    display: grid;
    gap: 0.18rem;
}

.contact-entry-link {
    color: inherit;
    text-decoration: none;
}

.presence-name-line {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.presence-name-line-centered {
    justify-content: center;
}

.presence-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.18);
}

.presence-dot.active {
    background: #22c55e;
}

.presence-dot.away {
    background: #facc15;
}

.presence-dot.offline {
    background: transparent;
    box-shadow: inset 0 0 0 1px #fff;
}

.chat-line,
.chat-snippet-row {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    align-items: center;
}

.chat-snippet-row {
    justify-content: flex-start;
}

.conversation-video-thumb {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    overflow: hidden;
    background: #2a2a2a;
}

.conversation-video-thumb img,
.conversation-video-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.conversation-video-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.28);
}

.chat-line-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex: 0 0 auto;
    color: var(--muted);
}

.chat-muted-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9fb4c9;
}

.chat-muted-indicator .nav-icon {
    font-size: 0.95rem;
}

.chat-time,
.contact-copy small,
.conversation-snippet {
    color: var(--muted);
    font-size: 0.88rem;
}

.badge {
    min-width: 1.5rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #0a84ff;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0 0.35rem;
}

.invite-row {
    display: block;
    padding: 0.85rem 0.9rem 0.55rem;
    color: var(--accent);
}

.mini-action {
    border: 0;
    border-radius: 999px;
    background: #3a3a3a;
    color: #fff;
    padding: 0.45rem 0.8rem;
    cursor: pointer;
}

.mini-action:hover,
.row-option-link:hover {
    background: #4a4a4a;
}

.mini-action.danger {
    background: rgba(220, 38, 38, 0.22);
    color: #fecaca;
}

.mini-action.danger:hover {
    background: rgba(220, 38, 38, 0.32);
}

.admin-list {
    margin-top: 0.75rem;
}

.admin-row {
    grid-template-columns: 52px 1fr auto;
}

.admin-actions-column {
    display: grid;
    gap: 0.4rem;
}

.row-options {
    position: relative;
    justify-self: end;
}

.more-action {
    min-width: 42px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.row-options-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    z-index: 12;
    min-width: 152px;
    display: grid;
    gap: 0.35rem;
    padding: 0.45rem;
    border-radius: 14px;
    background: #2b2b2b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.24);
}

.row-options-menu[hidden] {
    display: none;
}

.row-options-menu .mini-action,
.row-options-menu .row-option-link,
.row-options-menu form {
    width: 100%;
}

.row-options-menu .mini-action,
.row-options-menu .row-option-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.admin-inline-form {
    padding: 0.25rem 0.85rem 0.9rem;
}

.admin-detail-form {
    padding-top: 0.7rem;
}

.collapsible-form[hidden] {
    display: none;
}

.compact-form {
    margin-top: 0.6rem;
}

.inline-recipient-field {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
}

.inline-recipient-field > .chips-picker {
    min-width: 0;
}

.mobile-app.is-group-builder-open[data-current-route="home"] .search-stack,
.mobile-app.is-group-builder-open[data-current-route="home"] .search-results,
.mobile-app.is-group-builder-open[data-current-route="home"] .chat-list {
    display: none;
}

.mobile-app.is-group-builder-open[data-current-route="home"] #group-builder-form {
    display: grid;
}

.chips-picker {
    position: relative;
}

.chips-picker-box {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    min-height: 52px;
    padding: 0.65rem 0.8rem;
    border-radius: 12px;
    background: #111922;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-heading-card {
    display: grid;
    gap: 0.85rem;
}

.conversation-members-card {
    display: grid;
    gap: 0.65rem;
    padding: 0.8rem 0.9rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.conversation-members-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: #e5e7eb;
}

.conversation-members-card-header span {
    color: #a8adb5;
    font-size: 0.88rem;
}

.conversation-members-list {
    display: grid;
    gap: 0.55rem;
}

.conversation-member-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 0.7rem;
    align-items: center;
}

.conversation-member-avatar {
    width: 44px;
    height: 44px;
    overflow: hidden;
}

.conversation-member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.conversation-member-copy {
    min-width: 0;
    display: grid;
    gap: 0.18rem;
}

.conversation-member-copy strong,
.conversation-member-copy small {
    min-width: 0;
}

.conversation-member-copy small {
    color: #9eb7d1;
}

.conversation-title-link {
    color: inherit;
    display: block;
    width: 100%;
}

.conversation-profile-link {
    color: inherit;
    text-decoration: none;
}

.conversation-title-link strong {
    display: block;
}

.conversation-title-trigger {
    border: 0;
    background: transparent;
    padding: 0;
    color: inherit;
    cursor: pointer;
}

.conversation-header-options {
    justify-self: center;
}

.conversation-header-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    justify-self: end;
}

.conversation-header-actions-mobile {
    min-width: 0;
}

.conversation-title-menu {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
}

.conversation-title-menu-mobile {
    left: auto;
    right: 0;
    transform: none;
}

.conversation-header-options-mobile,
.conversation-header-options-desktop {
    justify-self: end;
}

.conversation-header-cog,
.conversation-header-call {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #3a3a3a;
    color: #f0f3f7;
    cursor: pointer;
}

.conversation-header-call {
    text-decoration: none;
}

.profile-viber-call {
    gap: 0.45rem;
    margin-top: 0.45rem;
}

.conversation-header-cog .nav-icon,
.conversation-header-call .nav-icon {
    font-size: 22px;
}

.conversation-list-menu {
    top: 0.65rem;
    right: 0.85rem;
    min-width: 228px;
}

.conversation-list-menu-mobile {
    right: 0.75rem;
}

.chips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.chips-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.38rem 0.65rem;
    border-radius: 999px;
    background: #30465a;
    color: #e6f0fa;
    font-size: 0.82rem;
}

.chips-chip button {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    font-size: 1rem;
}

.chips-input {
    flex: 1 1 160px;
    min-width: 140px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    border-radius: 0;
}

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

.chips-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 0.35rem);
    z-index: 8;
    display: grid;
    gap: 0.2rem;
    padding: 0.35rem;
    border-radius: 14px;
    background: #2b2b2b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.24);
    max-height: 220px;
    overflow: auto;
}

.chips-suggestions[hidden] {
    display: none;
}

.chips-suggestion {
    border: 0;
    background: transparent;
    color: #e7eef7;
    text-align: left;
    padding: 0.7rem 0.8rem;
    border-radius: 10px;
    cursor: pointer;
}

.chips-suggestion:hover {
    background: rgba(255, 255, 255, 0.06);
}

.chips-suggestion small {
    display: block;
    color: var(--muted);
    margin-top: 0.12rem;
}

.conversation-tools {
    padding: 0;
    background: #1a1a1a;
}

.conversation-tools:empty {
    display: none;
}

.conversation-tools-note {
    color: var(--muted);
    font-size: 0.84rem;
    text-align: right;
}

.conversation-inline-form {
    padding: 0;
}

.conversation-flash {
    margin: 0.65rem 0.7rem 0.7rem;
}

.conversation-action-modal {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.56);
}

.conversation-action-modal[hidden] {
    display: none;
}

.conversation-action-card {
    width: min(100%, 430px);
    border-radius: 22px;
    background: #2b2b2b;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
    padding: 1rem;
}

.conversation-modal-form {
    padding: 0;
}

.reaction-details-card {
    display: grid;
    gap: 0.9rem;
}

.reaction-details-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.reaction-details-head h2 {
    margin: 0;
    font-size: 1.2rem;
}

.reaction-details-close {
    padding-inline: 0.9rem;
}

.reaction-details-list {
    display: grid;
    gap: 0.45rem;
    max-height: min(55vh, 360px);
    overflow: auto;
}

.reaction-details-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
}

.reaction-details-name {
    color: #f3f7fc;
    font-weight: 600;
}

.reaction-details-emoji {
    flex: 0 0 auto;
    font-size: 1.35rem;
    line-height: 1;
}

.reaction-details-empty {
    color: var(--muted);
    text-align: center;
    padding: 1rem 0.4rem 0.2rem;
}

.attachment-limit-card {
    display: grid;
    gap: 0.9rem;
    width: min(100%, 390px);
    background: #202020;
    color: #fff;
    text-align: center;
}

.attachment-limit-icon {
    color: #ef4444;
    font-size: 2.2rem;
    line-height: 1;
}

.attachment-limit-card p {
    margin: 0;
    color: #f2f2f2;
    line-height: 1.45;
    white-space: pre-line;
}

.attachment-viewer-card {
    width: min(100%, 860px);
    max-width: 100%;
    display: grid;
    gap: 0.85rem;
    padding: 0.9rem;
}

.attachment-viewer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.attachment-viewer-head strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-viewer-close {
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    font-size: 1.25rem;
    line-height: 1;
}

.attachment-viewer-frame {
    width: 100%;
    height: min(72vh, 720px);
    border: 0;
    border-radius: 16px;
    background: #fff;
}

.attachment-viewer-video {
    width: 100%;
    max-height: min(72vh, 720px);
    border-radius: 16px;
    background: #000;
}

.attachment-viewer-image {
    width: 100%;
    max-height: min(76vh, 760px);
    object-fit: contain;
    border-radius: 16px;
    background: #000;
}

.attachment-viewer-download {
    justify-self: center;
    min-width: 180px;
}

.image-save-card {
    width: min(100%, 320px);
}

.gradient-profile-header {
    position: fixed;
    top: 0;
    left: 0;
    transform: none;
    z-index: 20;
    width: 100%;
    max-width: none;
    min-height: 110px;
    display: grid;
    grid-template-columns: 60px 1fr 60px;
    align-items: start;
    padding-top: 0.65rem;
    background: #2b2b2b;
    border-bottom: 1px solid var(--line);
}

.profile-card-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    margin-top: var(--mobile-topbar-height);
    margin-bottom: var(--mobile-bottom-nav-height);
    padding: 1rem 1.1rem;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: var(--bg);
}

.profile-card-screen {
    position: relative;
    background: var(--bg);
    color: var(--text);
    border-radius: 0;
    min-height: calc(100vh - 130px);
    padding: 1.6rem 1.1rem 1.4rem;
    text-align: center;
}

.admin-profile-screen {
    min-height: auto;
    margin-top: 0;
    padding-top: 1.15rem;
    padding-bottom: 6.4rem;
}

.admin-profile-screen .profile-form {
    margin-top: 1.1rem;
    padding: 0;
}

.admin-profile-screen .btn + .btn {
    margin-top: 0.75rem;
}

.profile-portrait {
    width: 170px;
    height: 170px;
    border-radius: 50%;
    overflow: hidden;
    margin: 1rem auto 0.9rem;
}

.profile-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-card-screen h1 {
    margin: 0.3rem 0 0.2rem;
    font-size: 2rem;
    letter-spacing: 0.02em;
}

.profile-card-screen p {
    margin: 0 0 1.1rem;
    color: var(--muted);
    font-weight: 600;
}

.profile-form label {
    color: var(--muted);
    text-align: left;
}

.profile-form input,
.profile-form textarea,
.profile-form select {
    background: #555555;
    color: #ffffff;
    border: 1px solid #555555;
}

.chat-date-divider {
    align-self: center;
    margin: 0.2rem 0 0.1rem;
    text-align: center;
    padding: 0.45rem 0 0.3rem;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.84rem;
}

.message-list {
    flex: 1;
    min-height: 0;
    height: auto;
    margin-top: var(--mobile-topbar-height);
    overflow: auto;
    padding: 0 0.65rem 20px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    background: #1f1f1f;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.message-row {
    display: flex;
    align-items: flex-end;
    gap: 0.45rem;
    margin: 0;
    scroll-margin-top: 90px;
    scroll-margin-bottom: 90px;
}

.message-row.received + .message-row.sent,
.message-row.sent + .message-row.received {
    margin-top: 10px;
}

.message-row.sent {
    justify-content: flex-end;
}

.message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    width: fit-content;
    max-width: 75%;
    position: relative;
}

.message-row.sent .message-content {
    align-items: flex-end;
}

.message-row.attachment-only .message-content {
    gap: 0;
}

.message-avatar,
.message-avatar-link {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex: 0 0 32px;
}

.message-avatar-link {
    display: inline-flex;
    overflow: hidden;
}

.message-avatar {
    object-fit: cover;
}

.message-bubble {
    display: inline-block;
    width: 100%;
    max-width: none;
    border-radius: 16px;
    padding: 0.62rem 0.78rem 0.34rem;
    background: var(--bubble-received);
    color: #000;
    overflow-wrap: break-word;
    word-break: normal;
    touch-action: manipulation;
    position: relative;
}

.message-row.sent .message-bubble {
    background: var(--bubble-sent);
    color: #fff;
    padding: 0.62rem 0.78rem 0.34rem;
}

.message-bubble-meta-only {
    background: transparent;
    padding: 0;
    min-height: 0;
}

.message-row.sent .message-bubble.message-bubble-meta-only {
    background: transparent;
    padding: 0;
}

.message-body {
    display: block;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    line-height: 1.35;
}

.message-sender-label {
    margin: 0 0 0.08rem 0.1rem;
    font-size: 0.74rem;
    font-weight: 700;
    color: #9bc2ff;
}

.message-reply-context {
    width: auto;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.18rem;
    margin: 0 0 0.55rem;
    padding: 0.52rem 0.7rem;
    border: 0;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.28);
    color: rgba(255, 255, 255, 0.92);
    cursor: pointer;
    text-align: left;
}

.message-reply-context-sender {
    font-size: 0.76rem;
    font-weight: 700;
    color: #b7cdf9;
}

.message-reply-context-text {
    width: auto;
    min-width: 0;
    max-width: 100%;
    font-size: 0.94rem;
    line-height: 1.28;
    color: rgba(255, 255, 255, 0.84);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-row-highlight .message-bubble {
    box-shadow: 0 0 0 2px rgba(121, 211, 255, 0.38);
}

.optimistic-message-row .message-bubble {
    opacity: 0.92;
}

.optimistic-message-row .message-delivery-status.sending {
    color: #dbe7f5;
}

.optimistic-attachment-pill {
    margin-top: 0.6rem;
}

.message-inline-link {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.message-row.received .message-inline-link {
    color: #0084f7;
}

.message-row.sent .message-inline-link {
    color: #e6f1ff;
}

.message-meta-line {
    margin-top: 0.2rem;
    display: inline-flex;
    align-self: flex-end;
    justify-content: flex-end;
    gap: 0.25rem;
    color: #bfd0e2;
    font-size: 0.72rem;
}

.message-row.received .message-meta-line {
    color: rgba(0, 0, 0, 0.56);
}

.message-bubble-meta-only .message-meta-line {
    margin-top: 0;
    padding: 0 0.12rem;
}

.message-row.attachment-only .message-bubble-meta-only {
    order: 2;
}

.message-row.attachment-only .message-bubble-meta-only .message-meta-line {
    margin-top: 0.08rem;
    color: #b8c3d0;
}

.message-bubble-meta-only .message-gesture-reaction-menu {
    top: auto;
    bottom: auto;
}

.message-delivery-status {
    color: #aab9c8;
    white-space: nowrap;
}

.message-delivery-status.seen {
    color: #79d3ff;
}

.message-delivery-status.sending {
    color: #dbe7f5;
}

.message-delivery-status.error {
    color: var(--danger);
}

.mention {
    color: #8fd0ff;
    font-weight: 600;
}

.message-image {
    border-radius: 14px;
    margin-top: 0;
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 280px;
    object-fit: cover;
}

.message-attachment-block {
    width: fit-content;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    margin-top: 0.08rem;
    position: relative;
}

.message-row.attachment-only .message-attachment-block {
    order: 1;
    margin-top: 0;
}

.message-row.sent .message-attachment-block {
    align-items: flex-end;
}

.message-attachment-block-with-sidecar {
    padding-right: calc(2.4rem + var(--reaction-sidecar-gap));
}

.message-actions-attachment {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.message-image-link {
    display: block;
    max-width: 100%;
    position: relative;
}

.message-video-link,
.file-pill {
    position: relative;
}

.message-video-link {
    position: relative;
    display: block;
    width: min(100%, 75vw);
    max-width: 100%;
    padding: 0;
    border: 0;
    border-radius: 18px;
    overflow: hidden;
    background: #111;
    cursor: pointer;
}

.message-video-poster,
.message-video-placeholder {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 160px;
    max-height: 280px;
    object-fit: cover;
}

.message-video-placeholder {
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(180deg, #3a3a3a, #1f1f1f);
}

.message-video-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.58);
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    pointer-events: none;
}

.message-video-meta-line {
    margin-top: 0.3rem;
    padding: 0 0.12rem;
    color: #b8c3d0;
}

.file-pill,
.reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0;
    padding: 0.6rem 0.95rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.96rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-pill {
    font-weight: 700;
    align-items: flex-start;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.file-pill-icon {
    flex: 0 0 auto;
    font-size: 1.18rem;
    line-height: 1;
    margin-top: 0.08rem;
}

.file-pill-label {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.link-preview {
    margin-top: 0.55rem;
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 0.6rem;
    padding: 0.55rem;
    border-radius: 12px;
    background: #fff;
    color: #000;
}

.link-preview strong {
    display: block;
    color: #000;
}

.link-preview small {
    display: block;
    margin-top: 0.18rem;
    color: rgba(0, 0, 0, 0.62);
}

.link-preview img {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    object-fit: cover;
}

.message-actions {
    position: absolute;
    right: calc(-2.4rem - var(--reaction-sidecar-gap));
    top: 50%;
    transform: translateY(-44%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: nowrap;
    margin-top: 0;
    z-index: 2;
}

.message-row.sent .message-actions {
    right: auto;
    left: calc(-1.35rem - var(--reaction-sidecar-gap));
}

.message-action-popover {
    --message-action-popover-shift: 0px;
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(var(--message-action-popover-shift), -50%);
    z-index: 8;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    max-width: calc(100vw - 1.5rem);
}

.message-action-popover[hidden] {
    display: none;
}

.message-options-menu {
    --options-menu-shift: 0px;
    position: static;
    transform: none;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem;
    border-radius: 999px;
    background: #2b2b2b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.24);
    white-space: nowrap;
}

.message-row.menus-open .message-options-menu {
    bottom: auto;
}

.message-options-menu[hidden] {
    display: none;
}

.message-options-menu .mini-action,
.message-options-menu form {
    width: auto;
}

.message-options-menu .mini-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0.48rem 0.82rem;
    border-radius: 999px;
}

.message-gesture-reaction-menu {
    --reaction-menu-shift: 0px;
    position: static;
    top: auto;
    bottom: auto;
    left: auto;
    transform: none;
    white-space: nowrap;
    display: none;
    align-items: center;
    min-height: 42px;
    padding: 0.24rem 0.34rem;
    box-sizing: border-box;
    max-width: calc(100vw - 1.5rem);
}

.reaction-trigger,
.reaction-menu button {
    border: 0;
    border-radius: 999px;
    background: rgba(45, 52, 66, 0.92);
    color: #fff;
    padding: 0.34rem 0.46rem;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.24);
}

.reaction-trigger {
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.reaction-trigger.has-reaction {
    background: rgba(74, 74, 74, 0.96);
    color: #ffffff;
}

.reaction-summary-pill {
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(45, 52, 66, 0.92);
    color: #fff;
    padding: 0.34rem 0.46rem;
    font-size: 0.9rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.24);
}

.reaction-summary-pill.has-reaction {
    background: rgba(74, 74, 74, 0.96);
}

.reaction-total {
    font-size: 0.82rem;
    font-weight: 600;
    color: #dbe7f5;
    line-height: 1;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.reaction-count-badge {
    position: absolute;
    right: -0.25rem;
    bottom: -17px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 0.16rem;
    min-height: 24px;
    padding: 0.12rem 0.42rem;
    border: 2px solid #1f1f1f;
    border-radius: 999px;
    background: rgba(45, 52, 66, 0.96);
    color: #fff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.24);
    cursor: pointer;
}

.reaction-count-badge .reaction-total {
    font-size: 0.78rem;
    line-height: 1;
    color: #fff;
}

.reaction-count-emoji {
    font-size: 0.95rem;
    line-height: 1;
}

.reaction-menu {
    display: none;
    align-items: center;
    gap: 0.16rem;
    padding: 0.22rem 0.28rem;
    border-radius: 999px;
    background: #2d2d2d;
    flex-direction: row;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.reaction-menu.open {
    display: inline-flex;
}

.message-gesture-reaction-menu.open {
    display: flex;
}

.message-gesture-reaction-menu {
    --reaction-menu-shift: 0px;
    position: static;
    top: auto;
    bottom: auto;
    left: auto;
    transform: none;
    white-space: nowrap;
    min-height: 42px;
    padding: 0.24rem 0.34rem;
    box-sizing: border-box;
    max-width: calc(100vw - 1.5rem);
}

.message-row.sent .message-gesture-reaction-menu {
    left: auto;
    right: 0;
}

.message-gesture-reaction-menu button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    font-size: 1.45rem;
    line-height: 1;
}

.message-actions-static {
    opacity: 1;
}

.message-composer {
    position: fixed;
    bottom: var(--keyboard-offset);
    left: 0;
    transform: none;
    width: 100%;
    max-width: none;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    grid-template-areas:
        "reply reply reply"
        "attach input send"
        "status status status";
    gap: 0.55rem;
    align-items: center;
    padding: 0.55rem 0.7rem calc(0.55rem + env(safe-area-inset-bottom));
    background: #1f1f1f;
    border-top: 1px solid var(--line);
}

.mobile-app.keyboard-visible .message-composer {
    padding-bottom: 0.55rem;
}

.reply-preview {
    grid-area: reply;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.55rem 0.7rem;
    border-radius: 14px;
    background: #2b2b2b;
    border-left: 3px solid #7a7a7a;
}

.reply-preview[hidden] {
    display: none;
}

.reply-preview-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.reply-preview-label {
    font-size: 0.76rem;
    font-weight: 700;
    color: #d6d6d6;
}

.reply-preview-text {
    font-size: 0.86rem;
    color: #d7dce2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-preview-clear {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.telegram-composer textarea {
    min-height: 40px;
    max-height: 130px;
    background: #303030;
    border-radius: 22px;
    padding: 0.78rem 1rem;
    min-width: 0;
    width: 100%;
}

.attach-button,
.composer-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #303030;
    color: var(--muted);
}

.attach-button {
    grid-area: attach;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    min-width: 42px;
    max-width: 42px;
    overflow: hidden;
    cursor: pointer;
    color: #fff;
    font-weight: 700;
}

.attach-button-symbol {
    font-size: 1.75rem;
    line-height: 0.9;
    transform: translateY(-1px);
}

.attach-button.has-file {
    background: #4b4b4b;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.attach-button.has-file .attach-button-symbol {
    font-size: 1.15rem;
    transform: none;
}

.attach-button input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    opacity: 0;
    pointer-events: none;
}

.composer-icon {
    grid-area: send;
    min-width: 42px;
    color: var(--accent);
    font-size: 1.05rem;
}

.telegram-composer textarea {
    grid-area: input;
}

.message-composer.has-attachment .telegram-composer textarea {
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.mention-suggestions {
    position: absolute;
    left: 3.85rem;
    right: 3.85rem;
    bottom: calc(100% + 0.45rem);
    display: grid;
    gap: 0.25rem;
    padding: 0.35rem;
    border-radius: 16px;
    background: #1f2b38;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.24);
    max-height: 220px;
    overflow: auto;
    z-index: 8;
}

.mention-suggestions[hidden] {
    display: none;
}

.mention-suggestion {
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #f4f7fb;
    text-align: left;
    padding: 0.65rem 0.8rem;
    font: inherit;
    cursor: pointer;
}

.mention-suggestion small {
    display: block;
    color: #93a4b7;
    font-size: 0.78rem;
    margin-top: 0.12rem;
}

.mention-suggestion.active {
    background: rgba(255, 255, 255, 0.12);
}

.attachment-status {
    grid-area: status;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.8rem;
    border-radius: 14px;
    background: #303030;
    color: #dbe7f5;
    font-size: 0.88rem;
}

.attachment-status[hidden] {
    display: none;
}

.attachment-status-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-status-name::before {
    content: "Attached: ";
    color: #9eb7d1;
}

.attachment-status.attachment-status-error {
    background: #303030;
    color: #dbe7f5;
}

.attachment-status.attachment-status-error .attachment-status-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-status.attachment-status-error .attachment-status-name::before {
    content: "Attached: ";
}

.attachment-status-clear {
    border: 0;
    background: transparent;
    color: #dbe7f5;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.back-button {
    width: auto;
    height: 38px;
    border-radius: 999px;
    background: transparent;
    color: #dcecff;
    font-size: 1rem;
    line-height: 1;
    font-weight: 500;
    padding: 0 0.35rem;
}

.text-back-button {
    width: auto;
    height: 38px;
    border-radius: 999px;
    background: transparent;
    color: #dcecff;
    font-size: 1rem;
    font-weight: 500;
    padding: 0 0.35rem;
}

.bottom-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    transform: none;
    z-index: 20;
    width: 100%;
    max-width: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    background: #1f1f1f;
    border-top: 1px solid var(--line);
}

.bottom-tabs.has-four-tabs {
    grid-template-columns: repeat(4, 1fr);
}

.tab-link {
    display: grid;
    gap: 0.1rem;
    justify-items: center;
    align-content: center;
    min-height: 56px;
    padding: 0.45rem 0.2rem;
    color: var(--muted);
    font-size: 0.78rem;
}

.tab-link.active {
    color: var(--accent);
}

.tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
}

.tab-icon .nav-icon {
    width: 20px;
    height: 20px;
    color: currentColor;
}

.icon-link .nav-icon {
    color: currentColor;
}

.attendance-toggle-form {
    margin: 0;
}

.attendance-mobile-toggle {
    justify-self: end;
}

.attendance-mobile-toggle .mini-action {
    min-width: 92px;
    min-height: 40px;
    padding: 0.55rem 0.95rem;
    font-size: 0.92rem;
    line-height: 1.1;
    white-space: nowrap;
}

.attendance-summary-card {
    display: grid;
    gap: 1rem;
    margin: 0.85rem 0.7rem 1rem;
    padding: 1rem;
    border-radius: 20px;
    background: #2b2b2b;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.attendance-summary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.attendance-summary-head h2 {
    margin: 0;
    font-size: 1.2rem;
}

.attendance-summary-head p {
    margin: 0.2rem 0 0;
    color: #b8c3d0;
}

.attendance-table-card {
    display: grid;
    gap: 0.45rem;
}

.attendance-table-mobile-wrap {
    overflow-x: auto;
}

.attendance-table {
    display: grid;
    grid-template-columns: minmax(110px, 1.15fr) minmax(72px, 0.75fr) minmax(72px, 0.75fr) minmax(96px, 0.9fr);
    gap: 0.75rem;
    align-items: center;
}

.attendance-table-head {
    padding: 0 0.15rem 0.4rem;
    color: #9fb0c4;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.attendance-record-block {
    display: grid;
    gap: 0.55rem;
}

.attendance-table-row {
    padding: 0.8rem 0.9rem;
    border-radius: 16px;
    background: rgba(17, 25, 34, 0.72);
    color: #eef4fb;
}

.attendance-duration-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.attendance-pin-button {
    min-width: 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.attendance-location-card {
    padding: 0.9rem;
    border-radius: 16px;
    background: rgba(17, 25, 34, 0.72);
}

.attendance-location-grid {
    display: grid;
    gap: 0.8rem;
}

.attendance-location-grid strong {
    display: block;
    margin-bottom: 0.25rem;
}

.attendance-location-grid p {
    margin: 0 0 0.55rem;
    color: #b8c3d0;
}

.attendance-empty-state {
    margin: 0.25rem 0 0;
    color: #b8c3d0;
    text-align: center;
}

.location-history-card {
    max-width: min(560px, calc(100vw - 1.5rem));
}

.location-history-list {
    display: grid;
    gap: 0.8rem;
    max-height: min(70vh, 560px);
    overflow: auto;
    padding-right: 0.15rem;
}

.location-history-row {
    display: grid;
    gap: 0.35rem;
    padding: 0.9rem;
    border-radius: 16px;
    background: rgba(17, 25, 34, 0.72);
    color: #eef4fb;
}

.location-history-row span {
    color: #b8c3d0;
    font-size: 0.92rem;
}

.mobile-route-shell .attendance-table {
    grid-template-columns: minmax(78px, 1fr) minmax(54px, 0.72fr) minmax(54px, 0.72fr) minmax(68px, 0.82fr);
    gap: 0.45rem;
    font-size: 0.82rem;
}

.mobile-route-shell .attendance-table-head {
    font-size: 0.74rem;
}

.notification-modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.56);
    z-index: 30;
}

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

@media (max-width: 767px) {
    .mobile-app.has-desktop-layout[data-current-route="contacts"] .desktop-rail,
    .mobile-app.has-desktop-layout[data-current-route="contacts"] .desktop-conversation-pane {
        display: none;
    }

    .mobile-app.has-desktop-layout[data-current-route="contacts"] .desktop-chat-panel {
        display: grid;
        grid-template-rows: auto auto minmax(0, 1fr);
        flex: 1;
        min-height: 0;
        background: var(--bg);
    }

    .mobile-app.has-desktop-layout[data-current-route="contacts"] .desktop-panel-head {
        position: fixed;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        z-index: 20;
        width: min(100vw, 430px);
        height: 64px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 0.75rem;
        background: #2b2b2b;
        border-bottom: 1px solid var(--line);
    }

    .mobile-app.has-desktop-layout[data-current-route="contacts"] .desktop-panel-head h2 {
        margin: 0;
        font-size: 1.15rem;
        font-weight: 600;
    }

    .mobile-app.has-desktop-layout[data-current-route="contacts"] .desktop-search-form {
        padding: 4.9rem 0.7rem 0;
    }

    .mobile-app.has-desktop-layout[data-current-route="contacts"] .desktop-search-form input {
        height: 38px;
        border-radius: 8px;
        background: #555555 !important;
        color: #ffffff !important;
        padding-left: 1rem;
        border: 1px solid #555555;
    }

    .mobile-app.has-desktop-layout[data-current-route="contacts"] .desktop-chat-list {
        margin-top: 0.55rem;
        padding: 0 0 5.6rem;
        overflow: auto;
    }

    .mobile-app.has-desktop-layout[data-current-route="contacts"] .desktop-chat-row {
        display: grid;
        grid-template-columns: 52px 1fr;
        gap: 0.8rem;
        align-items: center;
        padding: 0.78rem 0.85rem;
        border-radius: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    }

    .mobile-app.has-desktop-layout[data-current-route="contacts"] .desktop-chat-row.active,
    .mobile-app.has-desktop-layout[data-current-route="contacts"] .desktop-chat-row:hover {
        background: transparent;
    }

    .mobile-app.has-desktop-layout[data-current-route="contacts"] .desktop-chat-avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .mobile-app.has-desktop-layout[data-current-route="contacts"] .desktop-chat-copy {
        display: grid;
        gap: 0.18rem;
    }

    .mobile-app.has-desktop-layout[data-current-route="contacts"] .desktop-chat-line {
        display: block;
    }

    .mobile-app.has-desktop-layout[data-current-route="contacts"] .desktop-chat-line strong {
        font-size: 1rem;
        line-height: 1.2;
    }

    .mobile-app.has-desktop-layout[data-current-route="contacts"] .desktop-chat-snippet {
        color: var(--muted);
        font-size: 0.88rem;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }
}

.desktop-route-shell {
    display: none;
}

.mobile-route-shell {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
}

/* deploy refresh marker */

.desktop-rail,
.desktop-chat-panel,
.desktop-conversation-header {
    display: none;
}

@media (min-width: 768px) {
    body {
        justify-content: stretch;
        min-height: 100vh;
        padding: 0;
        background: #111315;
    }

    .mobile-app.has-desktop-layout {
        box-sizing: border-box;
        width: 100%;
        height: 100vh;
        min-height: 100vh;
        max-width: none;
        padding: 18px 18px 18px 16px;
        display: grid;
        grid-template-columns: 44px clamp(300px, calc((100% - 44px) / 2), 450px) minmax(0, 1fr);
        gap: 18px;
        background: #1a1a1a;
        overflow: hidden;
    }

    .mobile-app.has-desktop-layout .desktop-route-shell {
        display: contents;
    }

    .mobile-app.has-desktop-layout .mobile-route-shell {
        display: none;
    }

    .mobile-app.has-desktop-layout .desktop-rail {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 18px;
        align-self: stretch;
        width: 44px;
        height: 100%;
        padding: 8px 0;
        background: transparent;
        border: 0;
        border-radius: 0;
        overflow: visible;
    }

    .mobile-app.has-desktop-layout .desktop-rail::after {
        content: "";
        width: 40px;
        height: 1px;
        margin-top: 8px;
        background: rgba(255, 255, 255, 0.14);
    }

    .desktop-rail-button {
        width: 44px;
        height: 44px;
        border-radius: 14px;
        display: grid;
        place-items: center;
        font-size: 1.45rem;
        color: #e9edf2;
        background: transparent;
        transition: background 0.18s ease, transform 0.18s ease;
    }

    .desktop-rail-button:hover,
    .desktop-rail-button.active {
        background: #2a2a2a;
    }

    .desktop-rail-button .nav-icon {
        font-size: 22px;
    }

    .mobile-app.has-desktop-layout .desktop-chat-panel,
    .mobile-app.has-desktop-layout .desktop-conversation-pane {
        display: grid;
        min-width: 0;
        min-height: 0;
        height: 100%;
        border-radius: 28px;
        background: #1f1f1f;
        border: 1px solid rgba(255, 255, 255, 0.05);
        overflow: hidden;
    }

    .mobile-app.has-desktop-layout .desktop-chat-panel {
        grid-template-rows: auto auto minmax(0, 1fr);
        padding: 20px 0 0;
    }

    .mobile-app.has-desktop-layout .desktop-conversation-pane {
        grid-template-rows: auto auto minmax(0, 1fr) auto;
        isolation: isolate;
    }

    .desktop-panel-head,
    .desktop-conversation-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 0 18px 18px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .desktop-panel-head h2 {
        margin: 0;
        font-size: 2.1rem;
        line-height: 1;
        letter-spacing: -0.03em;
    }

    .desktop-panel-head .conversation-brand-title {
        font-size: 1.2rem;
        line-height: 1.18;
        letter-spacing: 0.04em;
        max-width: 240px;
        text-align: left;
    }

    .desktop-panel-actions {
        display: flex;
        gap: 12px;
    }

    .desktop-round-btn {
        width: 52px;
        height: 52px;
        border-radius: 50%;
        display: grid;
        place-items: center;
        background: #4a4a4a;
        color: #fff;
        font-size: 1.45rem;
    }

    .desktop-round-btn .nav-icon {
        font-size: 24px;
    }


    .desktop-search-form {
        padding: 0 18px 18px;
    }

    .desktop-search-form input {
        height: 56px;
        border-radius: 999px;
        background: #555555 !important;
        color: #ffffff !important;
        padding: 0 22px;
        font-size: 1rem;
        border: 1px solid #555555;
    }

    .desktop-search-form input::placeholder {
        color: rgba(255, 255, 255, 0.72);
    }

    .desktop-inline-flash,
    .desktop-inline-form {
        margin: 0 18px 18px;
    }

    .desktop-chat-list {
        flex: 1;
        overflow: auto;
        padding: 0 8px 10px 18px;
    }

    .desktop-chat-row {
        display: grid;
        grid-template-columns: 64px minmax(0, 1fr);
        gap: 14px;
        align-items: center;
        padding: 14px 52px 14px 12px;
        border-radius: 20px;
        color: #f3f6fb;
    }

    .desktop-chat-row-shell {
        position: relative;
    }

    .desktop-chat-row:hover {
        background: rgba(255, 255, 255, 0.04);
    }

    .desktop-chat-row.active {
        background: #2b2b2b;
    }

    .desktop-chat-avatar {
        width: 56px;
        height: 56px;
        font-size: 1.1rem;
    }

    .desktop-chat-copy {
        display: grid;
        gap: 0.3rem;
        min-width: 0;
    }

    .desktop-chat-line {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 1rem;
    }

    .desktop-chat-line strong,
    .desktop-conversation-meta strong {
        font-size: 1.05rem;
        line-height: 1.2;
    }

    .desktop-chat-line span,
    .desktop-conversation-meta small,
    .desktop-chat-snippet {
        color: #b3b8c0;
    }

.desktop-chat-snippet {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.98rem;
}

.desktop-chat-snippet-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.desktop-chat-snippet-row .conversation-video-thumb {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.desktop-chat-snippet-row .desktop-chat-snippet {
    min-width: 0;
    flex: 1 1 auto;
}

.desktop-unread-badge {
    flex: 0 0 auto;
}

    .desktop-entity-list {
        padding-right: 12px;
    }

    .mobile-app.has-desktop-layout .desktop-conversation-header {
        display: flex;
        padding: 18px 22px;
        background: #1f1f1f;
    }

    .desktop-conversation-meta {
        display: flex;
        align-items: center;
        gap: 14px;
    }

    .desktop-conversation-meta > div:last-child {
        display: grid;
        gap: 0.2rem;
    }

    .mobile-app.has-desktop-layout .mobile-topbar {
        display: none;
    }

    .mobile-app.has-desktop-layout .chat-date-divider {
        align-self: center;
        padding: 12px 0 8px;
        background: #1f1f1f;
        position: relative;
        z-index: 1;
    }

    .mobile-app.has-desktop-layout .conversation-tools {
        padding: 14px 22px 0;
        background: #1f1f1f;
    }

    .mobile-app.has-desktop-layout .conversation-inline-form {
        margin-top: 0.75rem;
    }

    .mobile-app.has-desktop-layout .message-list {
        position: relative;
        z-index: 0;
        align-self: stretch;
        width: 100%;
        height: calc(100% - 100px) !important;
        max-height: none;
        margin-top: 0;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        padding: 0 26px 20px !important;
        background: #1f1f1f;
    }

    .mobile-app.has-desktop-layout .message-content {
        width: auto;
        max-width: 75%;
    }

    .mobile-app.has-desktop-layout .message-bubble {
        width: auto;
        max-width: 100%;
    }

    .mobile-app.has-desktop-layout .message-body {
        display: inline-block;
        width: max-content;
        max-width: 100%;
    }

    .mobile-app.has-desktop-layout .message-composer {
        position: relative;
        z-index: 4;
        left: auto;
        transform: none;
        align-self: end;
        box-sizing: border-box;
        width: 100%;
        max-width: none;
        padding: 14px 20px 18px;
        background: #1f1f1f;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .mobile-app.has-desktop-layout .telegram-composer textarea {
        min-height: 48px;
        padding-top: 0.9rem;
        padding-bottom: 0.9rem;
        background: #303030;
        border-radius: 22px;
    }

    .mobile-app.has-desktop-layout .attach-button,
    .mobile-app.has-desktop-layout .composer-icon {
        background: #303030;
    }

    .mobile-app.has-desktop-layout .attachment-status {
        background: #303030;
    }

    .mobile-app.has-desktop-layout .mention-suggestions {
        left: 78px;
        right: 78px;
    }

    .mobile-app.has-desktop-layout .bottom-tabs {
        display: none;
    }

    .desktop-detail-pane {
        grid-template-rows: auto minmax(0, 1fr);
    }

    .desktop-detail-scroll {
        min-height: 0;
        overflow: auto;
        padding: 28px;
    }

    .desktop-profile-card {
        max-width: 420px;
        margin: 0 auto;
        padding: 28px;
        border-radius: 28px;
        background: #2b2b2b;
        text-align: center;
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
    }

    .desktop-profile-photo {
        width: 180px;
        height: 180px;
        margin: 0 auto 18px;
        border-radius: 50%;
        overflow: hidden;
        background: #3a3a3a;
    }

    .desktop-profile-photo img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .desktop-profile-card h2 {
        margin: 0 0 10px;
        font-size: 2rem;
    }

.desktop-profile-card p {
    margin: 0 0 8px;
    color: #b8c3d0;
}

.desktop-detail-scroll .attendance-summary-card {
    margin: 0;
}

.desktop-detail-scroll .attendance-table-head {
    padding-left: 0.2rem;
    padding-right: 0.2rem;
}

.desktop-detail-scroll .attendance-location-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.desktop-profile-card.conversation-detail-card {
    max-width: 560px;
    text-align: left;
}

.desktop-settings-card {
    max-width: 560px;
}

.desktop-settings-portrait {
    width: 180px;
    height: 180px;
    margin-top: 0;
}

.desktop-profile-form {
    margin-top: 1.4rem;
    text-align: left;
}

.desktop-profile-form .btn {
    text-align: center;
}

.desktop-detail-actions {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.2rem;
}

.admin-map-card {
    display: grid;
    gap: 0.8rem;
    margin-top: 1rem;
    text-align: left;
}

.admin-map-frame-link {
    display: block;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #2b2b2b;
}

.admin-map-frame {
    display: block;
    width: 100%;
    height: 220px;
    border: 0;
    margin-bottom: 15px !important;
}

.admin-map-meta {
    margin: 0;
    color: #b8c3d0;
    font-size: 0.9rem;
    line-height: 1.45;
}
}

@media (min-width: 1200px) {
    .mobile-app.has-desktop-layout {
        grid-template-columns: 44px clamp(300px, calc((100% - 44px) / 2), 450px) minmax(0, 1fr);
    }

    .mobile-app.has-desktop-layout .message-list {
        padding-left: 34px;
        padding-right: 34px;
    }

    .mobile-app.has-desktop-layout .message-content {
        max-width: 75%;
    }
}

.notification-card {
    width: min(100%, 380px);
    border-radius: 22px;
    background: #2b2b2b;
    padding: 1.25rem;
}

.empty-state {
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--muted);
}

@media (min-width: 768px) {
    body {
        padding: 0;
        background: #111315;
    }

    .mobile-app:not(.has-desktop-layout) {
        min-height: 100vh;
        border-radius: 28px;
        box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
    }

    .mobile-app:not(.has-desktop-layout) .mobile-topbar,
    .mobile-app:not(.has-desktop-layout) .gradient-profile-header,
    .mobile-app:not(.has-desktop-layout) .message-composer,
    .mobile-app:not(.has-desktop-layout) .bottom-tabs {
        width: 100vw;
        left: 0;
        transform: none;
    }
}
