:root {
    --bg: #17212b;
    --bg-soft: #1f2c3a;
    --panel: #1f2b38;
    --panel-alt: #223041;
    --line: rgba(255, 255, 255, 0.06);
    --text: #ffffff;
    --muted: #90a1b5;
    --accent: #58a6ff;
    --accent-strong: #4c8ed9;
    --danger: #f87171;
    --bubble-sent: #4d6f96;
    --bubble-received: #2a3543;
    --input: #111922;
}

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

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background: #0f1720;
    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 {
    border: 0;
    border-radius: 999px;
    padding: 0.82rem 1.15rem;
    cursor: pointer;
}

.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: #17212b;
}

.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: rgba(20, 28, 39, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 2rem;
}

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

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

.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 {
    width: min(100vw, 430px);
    height: 100vh;
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.mobile-topbar {
    position: fixed;
    top: 0;
    z-index: 20;
    width: min(100vw, 430px);
    height: 64px;
    background: #202b38;
    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: 44px 1fr 44px;
}

.topbar-title {
    text-align: center;
}

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

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

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

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

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

.screen-panel {
    flex: 1;
    padding: 4.9rem 0 5.6rem;
    overflow: auto;
    background: var(--bg);
}

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

.search-field input {
    height: 38px;
    border-radius: 8px;
    background: #131b24;
    color: #d8e4f0;
    padding-left: 1rem;
}

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

.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-copy,
.contact-copy {
    display: grid;
    gap: 0.18rem;
}

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

.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: var(--accent-strong);
    color: white;
    font-size: 0.75rem;
    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: #30465a;
    color: #fff;
    padding: 0.45rem 0.8rem;
    cursor: pointer;
}

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

.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: #1f2b38;
    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;
}

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

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

.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.65rem 0.7rem 0;
    background: var(--bg);
}

.conversation-tools-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

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

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

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

.gradient-profile-header {
    position: fixed;
    top: 0;
    z-index: 20;
    width: min(100vw, 430px);
    min-height: 110px;
    display: grid;
    grid-template-columns: 60px 1fr 60px;
    align-items: start;
    padding-top: 0.65rem;
    background: #202b38;
    border-bottom: 1px solid var(--line);
}

.profile-card-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 6.9rem 1.1rem 6rem;
    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;
}

.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-chat-fab {
    position: absolute;
    right: 2rem;
    top: 220px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #2a3543;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
    display: grid;
    place-items: center;
    font-size: 1.8rem;
}

.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: #111922;
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-date-divider {
    margin-top: 64px;
    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: calc(100vh - 64px - 34px - 74px - env(safe-area-inset-bottom));
    overflow: auto;
    padding: 0 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    background: #17212b;
}

.message-row {
    display: flex;
    align-items: flex-end;
    gap: 0.45rem;
    margin: 0;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.message-bubble {
    max-width: 78%;
    border-radius: 16px;
    padding: 0.62rem 2.4rem 0.34rem 0.72rem;
    background: var(--bubble-received);
    color: #fff;
    overflow-wrap: anywhere;
    position: relative;
}

.message-row.sent .message-bubble {
    background: var(--bubble-sent);
    padding: 0.62rem 0.72rem 0.34rem 2.4rem;
}

.message-body {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.35;
}

.message-inline-link {
    color: #8fd0ff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

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

.tick-mark {
    color: #aab9c8;
}

.tick-mark.read {
    color: #79d3ff;
}

.tick-mark.pending {
    color: #aab9c8;
}

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

.message-image {
    border-radius: 14px;
    margin-top: 0.6rem;
    max-height: 280px;
    object-fit: cover;
}

.file-pill,
.reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.55rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.82rem;
}

.link-preview {
    margin-top: 0.55rem;
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 0.6rem;
    padding: 0.55rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
}

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

.message-actions {
    position: absolute;
    right: -1.35rem;
    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: -1.35rem;
}

.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(86, 64, 180, 0.96);
    color: #ffffff;
}

.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-menu {
    display: none;
    gap: 0.25rem;
    padding: 0.25rem;
    border-radius: 999px;
    background: #243344;
    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-composer {
    position: fixed;
    bottom: 0;
    width: min(100vw, 430px);
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
        "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: #17212b;
    border-top: 1px solid var(--line);
}

.telegram-composer textarea {
    min-height: 40px;
    max-height: 130px;
    background: #0f1720;
    border-radius: 999px;
    padding: 0.78rem 1rem;
}

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

.attach-button {
    grid-area: attach;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    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: #4c8ed9;
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.22);
}

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

.attach-button input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

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

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

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

.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: #223141;
    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-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;
    z-index: 20;
    width: min(100vw, 430px);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: #202b38;
    border-top: 1px solid var(--line);
}

.tab-link {
    display: grid;
    gap: 0.1rem;
    justify-items: center;
    padding: 0.45rem 0.2rem 0.6rem;
    color: var(--muted);
    font-size: 0.78rem;
}

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

.tab-icon {
    font-size: 1.15rem;
}

.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;
        z-index: 20;
        width: min(100vw, 430px);
        height: 64px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 0.75rem;
        background: #202b38;
        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: #131b24;
        color: #d8e4f0;
        padding-left: 1rem;
    }

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

/* deploy refresh marker */

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

@media (min-width: 768px) {
    body {
        justify-content: stretch;
        min-height: 100vh;
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
            #111315;
    }

    .mobile-app.has-desktop-layout {
        width: 100%;
        height: 100vh;
        min-height: 100vh;
        max-width: none;
        padding: 18px 18px 18px 16px;
        display: grid;
        grid-template-columns: 72px minmax(320px, 420px) 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;
        height: 100%;
        padding: 10px 0;
        border-radius: 24px;
        background: #1f1f1f;
        border: 1px solid rgba(255, 255, 255, 0.05);
        overflow: hidden;
    }

    .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: 54px;
        height: 54px;
        border-radius: 18px;
        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-flat-icon {
        position: relative;
        display: block;
        width: 24px;
        height: 24px;
        color: #dfe6ee;
    }

    .desktop-flat-icon::before,
    .desktop-flat-icon::after {
        content: "";
        position: absolute;
        box-sizing: border-box;
    }

    .icon-chat::before {
        inset: 3px 2px 5px;
        border: 2px solid currentColor;
        border-radius: 9px;
    }

    .icon-chat::after {
        left: 5px;
        bottom: 2px;
        width: 8px;
        height: 8px;
        border-left: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: skewX(-20deg) rotate(-6deg);
        border-bottom-left-radius: 2px;
        background: transparent;
    }

    .icon-user::before {
        left: 7px;
        top: 2px;
        width: 10px;
        height: 10px;
        border: 2px solid currentColor;
        border-radius: 50%;
    }

    .icon-user::after {
        left: 4px;
        bottom: 3px;
        width: 16px;
        height: 10px;
        border: 2px solid currentColor;
        border-top-left-radius: 10px;
        border-top-right-radius: 10px;
        border-bottom: 0;
    }

    .icon-settings::before {
        inset: 2px;
        border-radius: 50%;
        background:
            radial-gradient(circle, transparent 0 5px, currentColor 5px 7px, transparent 7px),
            conic-gradient(from 0deg, currentColor 0deg 18deg, transparent 18deg 45deg, currentColor 45deg 63deg, transparent 63deg 90deg, currentColor 90deg 108deg, transparent 108deg 135deg, currentColor 135deg 153deg, transparent 153deg 180deg, currentColor 180deg 198deg, transparent 198deg 225deg, currentColor 225deg 243deg, transparent 243deg 270deg, currentColor 270deg 288deg, transparent 288deg 315deg, currentColor 315deg 333deg, transparent 333deg 360deg);
    }

    .icon-settings::after {
        left: 8px;
        top: 8px;
        width: 8px;
        height: 8px;
        border: 2px solid currentColor;
        border-radius: 50%;
        background: #2a2a2a;
    }

    .icon-admin::before {
        left: 3px;
        top: 8px;
        width: 18px;
        height: 8px;
        border: 2px solid currentColor;
        border-radius: 3px;
        transform: rotate(-28deg);
    }

    .icon-admin::after {
        right: 1px;
        top: 2px;
        width: 8px;
        height: 8px;
        border-top: 2px solid currentColor;
        border-right: 2px solid currentColor;
        transform: rotate(17deg);
    }

    .mobile-app.has-desktop-layout .desktop-chat-panel,
    .mobile-app.has-desktop-layout .desktop-conversation-pane {
        display: grid;
        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;
    }

    .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-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-search-form {
        padding: 0 18px 18px;
    }

    .desktop-search-form input {
        height: 56px;
        border-radius: 999px;
        background: #373737;
        color: #f5f5f5;
        padding: 0 22px;
        font-size: 1rem;
    }

    .desktop-search-form input::placeholder {
        color: #b8b8b8;
    }

    .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 16px 14px 12px;
        border-radius: 20px;
        color: #f3f6fb;
    }

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

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

    .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-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 {
        margin-top: 0;
        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 {
        height: auto;
        min-height: 0;
        overflow: auto;
        padding: 0 26px 20px;
        background: #1f1f1f;
    }

    .mobile-app.has-desktop-layout .message-bubble {
        max-width: min(74%, 700px);
    }

    .mobile-app.has-desktop-layout .message-composer {
        position: static;
        width: 100%;
        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;
    }

    .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 .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: #243042;
        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: #32465d;
    }

    .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-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: #1b2633;
}

.admin-map-frame {
    display: block;
    width: 100%;
    height: 220px;
    border: 0;
}

.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: 78px minmax(360px, 460px) minmax(0, 1fr);
        gap: 20px;
        padding: 20px;
    }

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

    .mobile-app.has-desktop-layout .message-bubble {
        max-width: min(68%, 760px);
    }
}

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

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

@media (min-width: 768px) {
    body {
        padding: 1.2rem 0;
        background:
            radial-gradient(circle at top left, rgba(88, 166, 255, 0.2), transparent 24rem),
            #0b1220;
    }

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

    .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: min(100vw, 430px);
        left: 50%;
        transform: translateX(-50%);
    }
}
