:root {
    --bg: #040404;
    --bg-soft: #070708;
    --sidebar: #09090b;
    --sidebar-soft: #0d0d10;
    --panel: #101013;
    --panel-soft: #141417;
    --panel-elevated: #18181c;
    --panel-hover: #1d1d22;
    --line: rgba(255, 255, 255, 0.07);
    --line-strong: rgba(255, 255, 255, 0.13);
    --text: #f6f6f8;
    --text-soft: #9a9aa5;
    --text-muted: #6d6d75;
    --white: #f3f3f5;
    --black: #040404;
    --success: #4fda7f;
    --success-soft: rgba(79, 218, 127, 0.16);
    --danger: #e35a5a;
    --danger-soft: rgba(227, 90, 90, 0.15);
    --warning: #f0bd55;
    --shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
    --radius: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.05), transparent 26%),
        linear-gradient(180deg, #080808 0%, #040404 100%);
    color: var(--text);
    font-family: "Segoe UI", Arial, sans-serif;
}

body {
    min-height: 100vh;
}

html {
    scrollbar-width: thin;
    scrollbar-color: #2a2a31 #09090b;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: #09090b;
}

*::-webkit-scrollbar-thumb {
    background: #28282f;
    border-radius: 999px;
    border: 2px solid #09090b;
}

*::-webkit-scrollbar-thumb:hover {
    background: #34343d;
}

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

button {
    cursor: pointer;
}

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

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

#app {
    height: 100%;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

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

.icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-shell--split {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 25vw);
    gap: 0;
    padding: 0;
    place-items: stretch;
    background: #040404;
}

.auth-card {
    width: min(440px, 100%);
    padding: 28px;
    border-radius: 24px;
    background: rgba(10, 10, 12, 0.94);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    display: grid;
    gap: 20px;
}

.auth-card--side {
    width: 100%;
    max-width: 440px;
}

.compact-card {
    width: min(380px, 100%);
}

.auth-media {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    background: #040404;
}

.auth-media__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-media__scrim {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(4, 4, 4, 0.18) 0%, rgba(4, 4, 4, 0.62) 100%),
        linear-gradient(90deg, rgba(4, 4, 4, 0.18) 0%, rgba(4, 4, 4, 0.74) 100%);
}

.auth-media__content {
    position: relative;
    z-index: 1;
    height: 100%;
    padding: 44px 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
}

.auth-side {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 36px;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.04), transparent 24%),
        linear-gradient(180deg, #060607 0%, #040404 100%);
    border-left: 1px solid var(--line);
}

.auth-copy {
    display: grid;
    gap: 8px;
}

.auth-copy__title,
.auth-hero__copy h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.auth-copy__subtitle,
.auth-hero__copy p {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.6;
}

.auth-hero__copy {
    display: grid;
    gap: 12px;
    max-width: 540px;
}

.auth-hero__points {
    display: grid;
    gap: 14px;
    max-width: 520px;
}

.auth-point {
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(4, 4, 4, 0.36);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
    display: grid;
    gap: 6px;
}

.auth-point strong {
    font-size: 14px;
}

.auth-point span {
    color: var(--text-soft);
    line-height: 1.55;
    font-size: 14px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-block--compact .brand-logo {
    width: 54px;
    height: 54px;
}

.brand-block--compact .brand-title {
    font-size: 26px;
}

.brand-logo {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    object-fit: cover;
    background: var(--panel-soft);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-logo-fallback {
    background: linear-gradient(135deg, #18181d 0%, #0f0f11 100%);
}

.brand-copy {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.brand-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-subtitle {
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.5;
}

.stack-sm,
.stack-md,
.stack-lg {
    display: grid;
}

.stack-sm {
    gap: 10px;
}

.stack-md {
    gap: 14px;
}

.stack-lg {
    gap: 20px;
}

.field-block {
    display: grid;
    gap: 8px;
}

.field-block > span,
.field-label {
    color: var(--text-soft);
    font-size: 13px;
}

.field-input,
.field-select,
.field-textarea,
.search-input {
    width: 100%;
    min-height: 46px;
    border-radius: 12px;
    padding: 12px 14px;
    background: #0d0d10;
    border: 1px solid var(--line-strong);
    color: var(--text);
    outline: none;
    transition: none;
}

.field-textarea {
    min-height: 120px;
    resize: vertical;
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus,
.search-input:focus {
    border-color: rgba(255, 255, 255, 0.22);
    background: #0d0d10;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.nav-button,
.footer-button,
.tab-button,
.tool-chip {
    min-height: 42px;
    border-radius: 12px;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 14px;
    font-weight: 700;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.tab-button:hover,
.tool-chip:hover,
.entity-card--interactive:hover,
.chat-row:hover,
.modal-close:hover {
    transform: none;
}

.primary-button {
    background: var(--white);
    color: var(--black);
}

.secondary-button,
.tool-chip,
.tab-button,
.footer-button,
.nav-button,
.ghost-button {
    background: var(--panel-soft);
    color: var(--text);
    border-color: var(--line);
}

.secondary-button--icon {
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 12px;
    justify-content: center;
}

.secondary-button--icon.active {
    background: rgba(79, 218, 127, 0.08);
    border-color: rgba(79, 218, 127, 0.22);
}

.danger-button {
    background: var(--danger-soft);
    border-color: rgba(227, 90, 90, 0.2);
    color: var(--text);
}

.wide {
    width: 100%;
}

.auth-footer {
    color: var(--text-muted);
    text-align: center;
    font-size: 13px;
    line-height: 1.5;
}

.notice-card,
.error-card,
.flash {
    padding: 13px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.notice-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.error-card,
.flash.flash-error {
    background: var(--danger-soft);
    border: 1px solid rgba(227, 90, 90, 0.22);
}

.flash.flash-info {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.messenger-shell {
    height: 100vh;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(280px, 20vw) minmax(0, 1fr);
    overflow: hidden;
}

.messenger-shell.admin-shell {
    grid-template-columns: minmax(320px, 20vw) minmax(0, 1fr);
}

.sidebar {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px 16px;
    background: rgba(8, 8, 10, 0.96);
    border-right: 1px solid var(--line);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sidebar-brand img,
.sidebar-brand .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--panel-soft);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-mark {
    display: grid;
    place-items: center;
    color: var(--text-soft);
    font-size: 12px;
}

.sidebar-brand__copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.sidebar-brand__title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.sidebar-brand__subtitle {
    color: var(--text-soft);
    font-size: 12px;
}

.sidebar-user {
    padding: 14px;
    border-radius: 16px;
    background: var(--panel-soft);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: #19191e;
    border: 1px solid rgba(255, 255, 255, 0.06);
    object-fit: cover;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: var(--text);
    flex: 0 0 42px;
}

.avatar.avatar-sm {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    flex-basis: 38px;
}

.avatar.avatar-lg {
    width: 48px;
    height: 48px;
    border-radius: 15px;
    flex-basis: 48px;
}

.sidebar-user__copy,
.chat-row__copy,
.entity-card__copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.sidebar-user__title,
.chat-row__title,
.entity-card__title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}

.sidebar-user__subtitle,
.chat-row__company,
.entity-card__subtitle,
.entity-card__meta,
.workspace-subtitle,
.text-soft {
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.45;
}

.sidebar-nav,
.settings-tabs {
    display: grid;
    gap: 6px;
}

.nav-button {
    width: 100%;
    justify-content: flex-start;
    padding: 0 14px;
    color: var(--text-soft);
    min-height: 62px;
    align-items: flex-start;
    padding-top: 12px;
    padding-bottom: 12px;
}

.nav-button.active {
    background: #16161a;
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.09);
}

.nav-button__copy {
    min-width: 0;
    flex: 1 1 auto;
    display: grid;
    gap: 4px;
}

.nav-button__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.nav-button__label {
    flex: 1 1 auto;
    text-align: left;
}

.nav-button__description {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
    text-align: left;
}

.nav-button__badge,
.chat-row__badge {
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #2a2a31;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.chat-row__badge {
    background: #34343d;
    color: var(--white);
}

.nav-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.nav-status.online {
    background: rgba(79, 218, 127, 0.13);
    color: var(--success);
}

.nav-status.offline,
.nav-status.dnd {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-soft);
}

.sidebar-spacer {
    flex: 1 1 auto;
}

.sidebar-footer {
    display: grid;
    gap: 8px;
}

.footer-button {
    width: 100%;
    justify-content: flex-start;
    background: transparent;
}

.footer-button.active {
    background: #16161a;
    border-color: rgba(255, 255, 255, 0.09);
}

.sidebar-search {
    position: relative;
}

.sidebar-search > .icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.sidebar-search .search-input {
    padding-left: 42px;
    padding-right: 42px;
    background: #111115;
    min-height: 42px;
}

.toolbar-search {
    max-width: 320px;
    width: 100%;
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2a2a31;
    color: var(--text-soft);
    padding: 0;
}

.search-clear .icon {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
}

.search-clear:hover {
    background: #35353e;
    color: var(--text);
}

.sidebar-label {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 4px;
}

.chat-list,
.entity-list {
    display: grid;
    gap: 8px;
    min-height: 0;
}

.chat-list {
    overflow: auto;
    padding-right: 2px;
}

.chat-row,
.entity-card {
    background: var(--panel-soft);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 12px;
}

.chat-row {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 12px;
    cursor: pointer;
}

.chat-row.active {
    background: #18181d;
    border-color: rgba(255, 255, 255, 0.1);
}

.chat-row__meta {
    display: grid;
    justify-items: end;
    gap: 8px;
    text-align: right;
}

.chat-row__time {
    color: var(--text-muted);
    font-size: 11px;
}

.chat-row__copy {
    text-align: left;
    align-content: start;
}

.chat-row > .avatar {
    width: 64px;
    height: 64px;
    min-height: 64px;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    flex: 0 0 64px;
    align-self: stretch;
}

.chat-row__presence {
    color: var(--text-muted);
    font-size: 12px;
    text-align: left;
}

.workspace {
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.04), transparent 24%),
        linear-gradient(180deg, #050506 0%, #040404 100%);
}

.workspace-header {
    padding: 22px 24px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(7, 7, 9, 0.86);
    backdrop-filter: blur(14px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.workspace-title-group {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.workspace-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.workspace-actions,
.toolbar,
.toolbar-group,
.row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.workspace-actions {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
}

.row-between {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.header-actions-inline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.workspace-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 20px 24px 24px;
    display: grid;
    gap: 16px;
    align-content: start;
}

.workspace-body--chat {
    overflow: hidden;
    padding-bottom: 0;
    display: flex;
    flex-direction: column;
    align-content: stretch;
}

.workspace-body--chat > .chat-workspace {
    flex: 1 1 auto;
}

.panel-card,
.surface-card,
.status-bar,
.composer,
.modal-card {
    background: var(--panel-soft);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
}

.surface-card,
.panel-card {
    padding: 16px;
}

.surface-card.soft {
    background: rgba(255, 255, 255, 0.03);
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.compact-select {
    min-width: 180px;
    max-width: 260px;
}

.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
}

.status-bar.online {
    background: rgba(15, 17, 15, 0.95);
}

.status-bar.offline,
.status-bar.dnd {
    background: rgba(23, 13, 13, 0.95);
}

.status-bar__left,
.status-bar__right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--text-muted);
    flex: 0 0 9px;
}

.status-bar.online .status-dot {
    background: var(--success);
}

.status-bar.offline .status-dot,
.status-bar.dnd .status-dot {
    background: var(--danger);
}

.status-bar__right {
    color: var(--text-soft);
    font-size: 12px;
}

.header-status {
    min-width: min(420px, 42vw);
    max-width: min(540px, 48vw);
    margin-left: auto;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: grid;
    gap: 6px;
}

.header-status__meta {
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.35;
    text-align: right;
}

.header-status__value {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    text-align: right;
}

.header-status__value .status-dot {
    width: 8px;
    height: 8px;
    flex-basis: 8px;
}

.header-status--online .header-status__value {
    color: var(--success);
}

.header-status--online .header-status__value .status-dot {
    background: var(--success);
}

.header-status--offline .header-status__value,
.header-status--dnd .header-status__value {
    color: var(--text-soft);
}

.header-status--offline .header-status__value .status-dot,
.header-status--dnd .header-status__value .status-dot {
    background: var(--danger);
}

.chat-workspace {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    min-width: 0;
}

.chat-workspace--with-search {
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 16px;
}

.chat-panel {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

.chat-search-panel {
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    background: rgba(9, 9, 11, 0.98);
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
}

.chat-search-panel__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.chat-search-panel__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.chat-search-panel__search {
    padding: 14px 16px 0;
}

.chat-search-field {
    width: 100%;
}

.chat-search-field .search-input {
    padding-right: 42px;
}

.chat-search-results {
    min-height: 0;
    overflow: auto;
    padding: 14px 12px 14px 16px;
    display: grid;
    gap: 10px;
}

.chat-search-result {
    width: 100%;
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: #121216;
    text-align: left;
    color: var(--text);
}

.chat-search-result:hover {
    border-color: rgba(255, 255, 255, 0.11);
    background: #17171c;
}

.chat-search-result__date {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.chat-search-result__text {
    color: var(--white);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chat-search-result__meta {
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.4;
}

.chat-search-empty {
    min-height: 100%;
    display: grid;
    place-items: center;
    padding: 32px 20px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-soft);
    text-align: center;
    line-height: 1.6;
}

.search-clear--hidden {
    opacity: 0;
    pointer-events: none;
}

.chat-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overflow-x: hidden;
    padding-right: 4px;
    min-width: 0;
    overflow-anchor: none;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
    scroll-behavior: auto;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    overflow-anchor: none;
    padding-bottom: 4px;
}

.messages-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 auto 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-soft);
    font-size: 12px;
}

.messages-loader__spinner {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.18);
    border-top-color: rgba(255, 255, 255, 0.72);
    animation: spin 0.7s linear infinite;
}

.message-day-separator {
    display: flex;
    justify-content: center;
    margin: 6px 0 2px;
}

.message-day-separator span {
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1;
}

.message-row {
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
    gap: 10px;
    min-width: 0;
    overflow-anchor: none;
}

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

.message-avatar-slot {
    flex: 0 0 32px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.message-bubble {
    max-width: min(720px, calc(88% - 42px));
    min-width: 0;
    padding: 14px 16px;
    border-radius: 14px;
    background: #151519;
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: grid;
    gap: 10px;
}

.message-row.self .message-bubble {
    background: #111115;
}

.message-row--search-hit .message-bubble {
    border-color: rgba(79, 218, 127, 0.4);
    box-shadow: 0 0 0 1px rgba(79, 218, 127, 0.16), 0 20px 44px rgba(0, 0, 0, 0.26);
}

.avatar.avatar-msg {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    border-radius: 999px;
}

.message-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.6;
    font-size: 14px;
    max-width: 100%;
}

.message-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-muted);
    font-size: 11px;
}

.message-footer span {
    min-width: 0;
}

.message-footer__meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.message-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    flex: 0 0 10px;
    display: inline-block;
}

.message-status-dot.unread {
    background: #5a5a63;
}

.message-status-dot.read {
    background: #58d3d5;
}

.attachment-list,
.draft-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 12px;
    max-width: 100%;
    min-width: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text);
    font-size: 12px;
}

.attachment-chip span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-chip button {
    border: none;
    background: none;
    color: var(--text-soft);
    padding: 0;
}

.typing-line {
    min-height: 18px;
    color: var(--text-soft);
    font-size: 13px;
    padding: 0 4px;
}

.composer {
    padding: 10px 14px 14px;
    display: grid;
    gap: 10px;
    position: relative;
    z-index: 2;
    background: rgba(16, 16, 19, 0.98);
    min-width: 0;
    overflow: visible;
}

.composer--inline {
    gap: 10px;
}

.composer-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    min-width: 0;
}

.composer--inline .draft-attachments {
    padding: 0 2px 2px;
}

.chat-panel.drag-active .chat-drop-overlay {
    opacity: 1;
    pointer-events: none;
}

.chat-drop-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    background: rgba(4, 4, 4, 0.36);
    backdrop-filter: blur(14px);
}

.chat-drop-overlay__inner {
    padding: 18px 22px;
    border-radius: 18px;
    background: rgba(17, 17, 21, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0.01em;
    text-align: center;
}

.chat-drop-overlay__inner span {
    display: block;
    margin-top: 6px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 500;
}

.jump-to-latest {
    position: absolute;
    right: 18px;
    bottom: 182px;
    z-index: 6;
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(17, 17, 21, 0.96);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
}

.jump-to-latest:hover {
    background: rgba(26, 26, 31, 0.98);
}

.jump-to-latest__badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #34343d;
    color: var(--white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

.jump-to-latest .icon,
.jump-to-latest svg,
.jump-to-latest path,
.jump-to-latest__badge {
    pointer-events: none;
}

.composer-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.composer-inputline {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 46px;
    max-height: 156px;
    padding: 12px 16px;
    border-radius: 24px;
    background: #0f0f12;
    line-height: 1.5;
    resize: none;
    overflow-y: hidden;
}

.composer-icon-button {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #121216;
    color: var(--text);
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.composer-icon-button:hover,
.composer-icon-button.active {
    background: #17171c;
    border-color: rgba(255, 255, 255, 0.12);
}

.composer-icon-button input {
    display: none;
}

.composer-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.tool-chip {
    min-height: 38px;
    padding: 0 12px;
    font-size: 13px;
}

.tool-chip input {
    display: none;
}

.composer-textarea {
    min-height: 112px;
    resize: vertical;
    min-width: 0;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.composer-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

.composer-submit {
    min-width: 138px;
    will-change: auto;
}

.composer-submit--round {
    width: 46px;
    min-width: 46px;
    height: 46px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 46px;
    align-self: flex-end;
}

.composer-submit--round .icon {
    width: 18px;
    height: 18px;
}

.emoji-trigger__mark {
    font-size: 16px;
    line-height: 1;
}

.emoji-picker {
    display: grid;
    gap: 12px;
    padding: 12px;
    width: min(440px, calc(100vw - 96px));
    max-width: 100%;
    position: absolute;
    left: 14px;
    bottom: calc(100% + 10px);
    z-index: 12;
    border-radius: 16px;
    background: rgba(18, 18, 22, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.42);
}

.emoji-picker--loading {
    min-height: 160px;
}

.emoji-picker__toolbar {
    display: grid;
    gap: 10px;
}

.emoji-picker__tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.emoji-picker__tab {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: #141419;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.emoji-picker__tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    line-height: 1;
}

.emoji-picker__tab-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.emoji-picker__tab.active,
.emoji-picker__tab:hover {
    border-color: rgba(79, 218, 127, 0.32);
    background: rgba(79, 218, 127, 0.08);
}

.emoji-picker__search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    min-height: 46px;
    border-radius: 999px;
    border: 1px solid rgba(79, 218, 127, 0.34);
    background: #111114;
}

.emoji-picker__search .search-input {
    min-height: 42px;
    height: 42px;
    padding: 0;
    background: transparent;
    border: none;
}

.emoji-picker__search .search-input:focus {
    border: none;
    background: transparent;
}

.emoji-picker__body {
    max-height: 360px;
    overflow: auto;
    padding-right: 4px;
}

.emoji-picker__section {
    display: grid;
    gap: 10px;
}

.emoji-picker__section + .emoji-picker__section {
    margin-top: 14px;
}

.emoji-picker__section-title {
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
}

.emoji-picker__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
    gap: 8px;
}

.emoji-picker__item {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: #111115;
    color: var(--text);
    font-size: 20px;
}

.emoji-picker__item:hover,
.emoji-trigger.active {
    border-color: rgba(255, 255, 255, 0.12);
    background: #17171c;
}

.empty-state {
    min-height: 220px;
    padding: 28px 20px;
    border-radius: 16px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--text-soft);
    line-height: 1.65;
}

.entity-card {
    display: grid;
    gap: 12px;
}

.entity-card--interactive {
    cursor: pointer;
}

.entity-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.entity-card__meta {
    color: var(--text-muted);
    font-size: 12px;
}

.entity-card__copy {
    text-align: left;
}

.entity-card__title,
.chat-row__title {
    color: var(--white);
    text-align: left;
}

.entity-card__description {
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.6;
}

.clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.status-pill,
.new-pill,
.meta-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.meta-pill {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-soft);
}

.new-pill {
    background: var(--success-soft);
    color: var(--success);
}

.status-pill.in-progress {
    background: rgba(110, 138, 255, 0.16);
    color: #9baeff;
}

.status-pill.on-review {
    background: rgba(240, 189, 85, 0.17);
    color: var(--warning);
}

.status-pill.canceled {
    background: var(--danger-soft);
    color: var(--danger);
}

.status-pill.completed {
    background: var(--success-soft);
    color: var(--success);
}

.settings-shell {
    display: grid;
    gap: 16px;
}

.settings-tabs {
    display: flex;
    flex-wrap: wrap;
}

.tab-button {
    min-height: 38px;
    color: var(--text-soft);
}

.tab-button.active {
    background: #1a1a1f;
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.1);
}

.settings-panel {
    display: grid;
    gap: 16px;
}

.detail-grid {
    display: grid;
    gap: 14px;
}

.detail-item {
    display: grid;
    gap: 6px;
}

.detail-label {
    color: var(--text-muted);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.detail-value {
    line-height: 1.6;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, 0.74);
    display: grid;
    place-items: center;
    padding: 22px;
}

.modal-card {
    width: min(720px, 100%);
    max-height: calc(100vh - 44px);
    overflow: auto;
    padding: 22px;
    box-shadow: var(--shadow);
    background: var(--panel-elevated);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.modal-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.modal-close {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--white);
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.split-two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.checkbox-row,
.recipient-list {
    display: grid;
    gap: 10px;
}

.checkbox,
.recipient-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    cursor: pointer;
}

.checkbox input[type="checkbox"],
.recipient-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    margin: 0;
    flex: 0 0 18px;
    border-radius: 6px;
    border: 1px solid var(--line-strong);
    background: linear-gradient(180deg, #121216 0%, #0c0c10 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 0 0 1px rgba(0, 0, 0, 0.22);
    display: inline-grid;
    place-items: center;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.checkbox input[type="checkbox"]:hover,
.recipient-item input[type="checkbox"]:hover {
    border-color: rgba(255, 255, 255, 0.22);
    background: linear-gradient(180deg, #15151a 0%, #101014 100%);
}

.checkbox input[type="checkbox"]:checked,
.recipient-item input[type="checkbox"]:checked {
    border-color: rgba(255, 255, 255, 0.24);
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23f6f6f8' d='M6.35 11.35 3.4 8.4l1.06-1.06 1.89 1.88 5.2-5.2 1.06 1.06z'/%3E%3C/svg%3E") center/12px 12px no-repeat,
        linear-gradient(180deg, #1a1a20 0%, #131319 100%);
}

.checkbox input[type="checkbox"]:focus-visible,
.recipient-item input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px rgba(255, 255, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.recipient-list {
    max-height: 220px;
    overflow: auto;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
}

.support-grid {
    display: grid;
    gap: 12px;
}

.support-grid .split-two {
    align-items: end;
}

.photo-preview {
    width: 68px;
    height: 68px;
    border-radius: 18px;
    object-fit: cover;
    background: var(--panel-soft);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.divider {
    height: 1px;
    background: var(--line);
}

@media (max-width: 1180px) {
    .messenger-shell.admin-shell {
        grid-template-columns: 290px minmax(0, 1fr);
    }
}

@media (max-width: 980px) {
    .auth-shell--split {
        grid-template-columns: 1fr;
    }

    .auth-media {
        min-height: 340px;
    }

    .auth-side {
        min-height: auto;
        padding: 24px 16px 32px;
        border-left: none;
        border-top: 1px solid var(--line);
    }

    .messenger-shell,
    .messenger-shell.admin-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid var(--line);
    }

    .chat-list {
        max-height: 280px;
    }
}

@media (max-width: 720px) {
    .auth-shell,
    .workspace-body,
    .workspace-header,
    .sidebar {
        padding-left: 14px;
        padding-right: 14px;
    }

    .auth-card,
    .modal-card {
        padding: 18px;
        border-radius: 18px;
    }

    .auth-media__content {
        padding: 24px 20px;
    }

    .workspace-header {
        padding-top: 18px;
        padding-bottom: 14px;
        align-items: flex-start;
        flex-direction: column;
    }

    .workspace-actions,
    .toolbar {
        width: 100%;
    }

    .workspace-actions {
        justify-content: flex-start;
    }

    .header-status {
        width: 100%;
        min-width: 0;
        max-width: none;
        margin-left: 0;
    }

    .header-status__meta,
    .header-status__value {
        text-align: left;
        justify-content: flex-start;
    }

    .split-two {
        grid-template-columns: 1fr;
    }

    .message-bubble {
        max-width: 100%;
    }

    .chat-workspace--with-search {
        grid-template-columns: minmax(0, 1fr);
    }

    .composer-row {
        gap: 8px;
    }

    .composer-icon-button,
    .composer-submit--round {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }

    .composer-inputline {
        min-height: 42px;
        height: 42px;
    }
}
