@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;700&display=swap");

:root {
    color-scheme: light;
    --font-body: "Manrope", sans-serif;
    --font-display: "Space Grotesk", sans-serif;
    --plyr-color-main: #0f766e;
    --plyr-video-controls-background: linear-gradient(180deg, rgba(10, 16, 22, 0), rgba(10, 16, 22, 0.82));
    --plyr-video-control-background-hover: rgba(15, 118, 110, 0.9);
    --plyr-tooltip-background: rgba(24, 33, 38, 0.9);
    --plyr-menu-background: rgba(255, 252, 245, 0.96);
    --plyr-menu-color: #182126;
    --bg: #f4efe4;
    --bg-strong: #e6dcc5;
    --surface: rgba(255, 252, 245, 0.82);
    --surface-strong: #fffaf2;
    --surface-muted: rgba(255, 250, 242, 0.58);
    --line: rgba(31, 42, 50, 0.1);
    --text: #182126;
    --muted: #58656d;
    --accent: #0f766e;
    --accent-strong: #115e59;
    --accent-soft: rgba(15, 118, 110, 0.12);
    --highlight: #ef7c57;
    --danger: #b42318;
    --shadow: 0 22px 70px rgba(24, 33, 38, 0.14);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --plyr-color-main: #4dd1c3;
    --plyr-video-control-background-hover: rgba(77, 209, 195, 0.92);
    --plyr-tooltip-background: rgba(238, 244, 247, 0.92);
    --plyr-menu-background: rgba(16, 29, 37, 0.96);
    --plyr-menu-color: #eef4f7;
    --bg: #0d151b;
    --bg-strong: #101d25;
    --surface: rgba(16, 29, 37, 0.84);
    --surface-strong: #12222c;
    --surface-muted: rgba(18, 34, 44, 0.6);
    --line: rgba(232, 239, 244, 0.12);
    --text: #eef4f7;
    --muted: #91a0a9;
    --accent: #4dd1c3;
    --accent-strong: #82e4da;
    --accent-soft: rgba(77, 209, 195, 0.18);
    --highlight: #ff9f6b;
    --danger: #ff7c72;
    --shadow: 0 22px 80px rgba(2, 9, 14, 0.45);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(239, 124, 87, 0.18), transparent 32%),
        radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.18), transparent 26%),
        linear-gradient(180deg, var(--bg), var(--bg-strong));
}

.messenger-body {
    height: 100dvh;
    overflow: hidden;
}

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

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

button {
    cursor: pointer;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    border-radius: 18px;
    color: var(--text);
    padding: 0.95rem 1rem;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

textarea {
    resize: vertical;
    min-height: 112px;
}

.eyebrow {
    margin: 0 0 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    color: var(--muted);
}

.flash-stack {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 40;
    display: grid;
    gap: 0.75rem;
}

.flash-card {
    min-width: 260px;
    max-width: 420px;
    border-radius: 18px;
    padding: 0.9rem 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    background: var(--surface-strong);
}

.flash-success {
    border-color: rgba(15, 118, 110, 0.35);
}

.flash-error {
    border-color: rgba(180, 35, 24, 0.35);
}

.primary-button,
.ghost-button {
    border-radius: 999px;
    padding: 0.9rem 1.15rem;
    border: 1px solid transparent;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.primary-button {
    background: linear-gradient(135deg, var(--accent), var(--highlight));
    color: #fff;
    box-shadow: 0 16px 34px rgba(15, 118, 110, 0.26);
}

.primary-button:hover,
.ghost-button:hover {
    transform: translateY(-1px);
}

.primary-button-wide {
    width: 100%;
}

.ghost-button {
    background: var(--surface-muted);
    color: var(--text);
    border-color: var(--line);
}

.mobile-only {
    display: none;
}

.auth-shell {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 2rem;
}

.ambient {
    position: absolute;
    inset: auto;
    filter: blur(12px);
    opacity: 0.8;
    animation: float 16s ease-in-out infinite;
}

.ambient-one {
    width: 420px;
    height: 420px;
    top: -90px;
    left: -60px;
    border-radius: 46% 54% 70% 30% / 43% 46% 54% 57%;
    background: linear-gradient(135deg, rgba(239, 124, 87, 0.5), rgba(15, 118, 110, 0.28));
}

.ambient-two {
    width: 560px;
    height: 560px;
    right: -160px;
    bottom: -220px;
    border-radius: 59% 41% 38% 62% / 41% 55% 45% 59%;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.42), rgba(255, 159, 107, 0.28));
    animation-delay: -5s;
}

.ambient-grid {
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.9), transparent 82%);
    filter: none;
    animation: drift 24s linear infinite;
}

.auth-panel {
    position: relative;
    z-index: 2;
    width: min(1180px, 100%);
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 1.5rem;
    align-items: stretch;
}

.auth-hero,
.auth-card,
.sidebar-card,
.conversation-list-card,
.composer-card,
.member-pill,
.stage-empty,
.empty-panel,
.empty-thread,
.media-modal-card {
    backdrop-filter: blur(18px);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.auth-hero,
.auth-card {
    border-radius: 34px;
    padding: 2rem;
}

.auth-hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 600px;
}

.brand-chip,
.profile-mark {
    width: 4rem;
    height: 4rem;
    border-radius: 1.2rem;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--highlight));
    box-shadow: 0 14px 34px rgba(15, 118, 110, 0.3);
}

.auth-hero h1,
.auth-card h2,
.conversation-header h2,
.stage-empty h2 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.04em;
}

.auth-hero h1 {
    font-size: clamp(3rem, 5vw, 5.1rem);
    line-height: 0.96;
    margin-top: 1rem;
}

.auth-copy {
    max-width: 34rem;
    margin: 1rem 0 1.5rem;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.75;
}

.auth-points {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.8rem;
}

.auth-points li {
    position: relative;
    padding-left: 1.4rem;
}

.auth-points li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.5rem;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--highlight));
}

.auth-card {
    display: grid;
    gap: 1.5rem;
    align-content: center;
}

.auth-card-top {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
}

.logo-slot {
    display: grid;
    place-items: center;
    min-width: 190px;
    min-height: 92px;
    border-radius: 22px;
    border: 1px dashed rgba(15, 118, 110, 0.35);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.14);
    text-align: center;
    padding: 1rem;
}

.auth-form,
.stacked-form,
.composer-main {
    display: grid;
    gap: 1rem;
}

.form-field,
.card-heading {
    display: grid;
    gap: 0.45rem;
}

.form-field label,
.stacked-form label {
    font-size: 0.88rem;
    color: var(--muted);
}

.form-error,
.form-error-block {
    color: var(--danger);
    font-size: 0.9rem;
}

.auth-note {
    color: var(--muted);
    font-size: 0.94rem;
    line-height: 1.65;
}

.messenger-shell {
    position: relative;
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: clamp(320px, 24vw, 400px) minmax(0, 1fr);
    gap: 0;
    overflow: hidden;
    align-items: stretch;
    background:
        radial-gradient(circle at top left, rgba(239, 124, 87, 0.18), transparent 24%),
        linear-gradient(135deg, color-mix(in srgb, var(--bg-strong) 72%, transparent), var(--bg));
}

.messenger-sidebar,
.conversation-stage {
    min-height: 0;
}

.messenger-sidebar {
    position: relative;
    padding: 1rem;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 0.9rem;
    height: 100%;
    overflow: hidden;
    border-right: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 30%),
        color-mix(in srgb, var(--surface) 94%, var(--bg));
    backdrop-filter: blur(18px);
}

.messenger-sidebar .profile-mark {
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 0.95rem;
    font-size: 0.96rem;
    box-shadow: 0 10px 20px rgba(15, 118, 110, 0.22);
}

.sidebar-header,
.sidebar-header-actions,
.conversation-header,
.composer-footer,
.conversation-card-top,
.message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.sidebar-account {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.sidebar-account-copy,
.sidebar-section-head,
.conversation-card-bottom,
.employee-meta,
.sidebar-compose-option-copy {
    display: grid;
    gap: 0.35rem;
}

.sidebar-account-copy strong {
    font-size: 1rem;
}

.sidebar-account-copy p,
.card-heading p,
.conversation-card p,
.conversation-card small,
.stage-empty p,
.empty-panel p,
.empty-thread p,
.member-pill small,
.composer-status {
    margin: 0;
    color: var(--muted);
}

.sidebar-header {
    padding: 0.1rem 0.1rem 0;
}

.sidebar-header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.inline-action-form {
    margin: 0;
}

.theme-menu-root {
    position: relative;
}

.icon-action-button,
.sidebar-quick-button {
    border: 1px solid var(--line);
    background: var(--surface-muted);
    color: var(--text);
    border-radius: 999px;
    padding: 0.56rem 0.78rem;
    font-size: 0.82rem;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.icon-action-button:hover,
.sidebar-quick-button:hover {
    transform: translateY(-1px);
    border-color: rgba(15, 118, 110, 0.35);
}

.icon-action-button-icon {
    width: 2.7rem;
    height: 2.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.theme-toggle-button svg {
    width: 1.15rem;
    height: 1.15rem;
}

.theme-menu-root.is-open .theme-toggle-button {
    border-color: rgba(15, 118, 110, 0.38);
    background: rgba(15, 118, 110, 0.12);
    color: var(--accent-strong);
}

.theme-menu {
    position: absolute;
    top: calc(100% + 0.55rem);
    right: 0;
    z-index: 4;
    width: min(280px, calc(100vw - 2rem));
    display: grid;
    gap: 0.35rem;
    padding: 0.45rem;
    border-radius: 22px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-strong) 96%, transparent);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
}

.theme-menu[hidden] {
    display: none !important;
}

.theme-menu-option {
    width: 100%;
    border: 0;
    display: grid;
    grid-template-columns: 2.55rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem;
    border-radius: 16px;
    background: transparent;
    color: var(--text);
    text-align: left;
    transition: transform 160ms ease, background 160ms ease;
}

.theme-menu-option:hover,
.theme-menu-option.is-active {
    transform: translateY(-1px);
    background: rgba(15, 118, 110, 0.1);
}

.theme-menu-option-icon,
.theme-menu-option-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-menu-option-icon {
    width: 2.55rem;
    height: 2.55rem;
    border-radius: 0.9rem;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.16), rgba(239, 124, 87, 0.16));
    color: var(--accent-strong);
}

.theme-menu-option-icon svg,
.theme-menu-option-check svg {
    width: 1.1rem;
    height: 1.1rem;
}

.theme-menu-option-copy {
    min-width: 0;
    display: grid;
    gap: 0.2rem;
}

.theme-menu-option-copy strong,
.theme-menu-option-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.theme-menu-option-copy strong {
    font-size: 0.9rem;
}

.theme-menu-option-copy small {
    color: var(--muted);
    font-size: 0.76rem;
}

.theme-menu-option-check {
    width: 1.35rem;
    height: 1.35rem;
    color: var(--accent-strong);
    opacity: 0;
    transform: scale(0.82);
    transition: opacity 160ms ease, transform 160ms ease;
}

.theme-menu-option.is-active .theme-menu-option-check {
    opacity: 1;
    transform: scale(1);
}

.sidebar-search-panel {
    display: grid;
    gap: 0.65rem;
}

.sidebar-mode-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 0.75rem;
}

.sidebar-back-button {
    width: 2.6rem;
    height: 2.6rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.95rem;
    border: 1px solid var(--line);
    background: var(--surface-muted);
    color: var(--text);
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.sidebar-back-button:hover {
    transform: translateX(-1px);
    border-color: rgba(15, 118, 110, 0.32);
}

.sidebar-back-button svg {
    width: 1rem;
    height: 1rem;
}

.sidebar-panel-stack,
.directory-panel,
.chat-rail {
    min-height: 0;
}

.sidebar-panel-stack {
    position: relative;
    overflow: hidden;
}

.sidebar-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 0.75rem;
    min-height: 0;
}

.sidebar-panel.is-active {
    animation: sidebarPanelReveal 180ms ease;
}

.sidebar-panel[hidden] {
    display: none !important;
}

.directory-panel,
.chat-rail {
    overflow: hidden;
}

.group-selection-form {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
    gap: 0.75rem;
    min-height: 0;
}

.group-selection-list {
    margin-top: 0;
    padding: 0.2rem 0.2rem 0.1rem 0;
}

.sidebar-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.35rem;
    border-top: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
}

.group-selection-meta {
    min-width: 0;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

.sidebar-confirm-button {
    width: 3.1rem;
    height: 3.1rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--accent), var(--highlight));
    color: #fff;
    box-shadow: 0 14px 30px rgba(15, 118, 110, 0.24);
    transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.sidebar-confirm-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(15, 118, 110, 0.28);
}

.sidebar-confirm-button:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.sidebar-confirm-button svg {
    width: 1.15rem;
    height: 1.15rem;
}

.sidebar-compose {
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    min-height: 4.25rem;
}

.sidebar-compose-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.7rem);
    z-index: 3;
    width: min(300px, calc(100vw - 2rem));
    display: grid;
    gap: 0.45rem;
    padding: 0.55rem;
    border-radius: 24px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-strong) 96%, transparent);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
}

.sidebar-compose-menu[hidden] {
    display: none !important;
}

.sidebar-compose-option {
    width: 100%;
    border: 0;
    display: grid;
    grid-template-columns: 3rem minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem;
    border-radius: 18px;
    background: transparent;
    color: var(--text);
    text-align: left;
    transition: transform 160ms ease, background 160ms ease;
}

.sidebar-compose-option:hover {
    transform: translateY(-1px);
    background: rgba(15, 118, 110, 0.1);
}

.sidebar-compose-option-icon {
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.18), rgba(239, 124, 87, 0.18));
    color: var(--accent-strong);
}

.sidebar-compose-option-icon svg {
    width: 1.3rem;
    height: 1.3rem;
}

.sidebar-compose-option-copy strong {
    font-size: 0.92rem;
}

.sidebar-compose-option-copy small {
    color: var(--muted);
    font-size: 0.78rem;
}

.sidebar-compose-button {
    width: 4rem;
    height: 4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 1.2rem;
    background: linear-gradient(135deg, var(--accent), var(--highlight));
    color: #fff;
    box-shadow: 0 22px 36px rgba(15, 118, 110, 0.28);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.sidebar-compose-button:hover,
.sidebar-compose.is-open .sidebar-compose-button {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 26px 42px rgba(15, 118, 110, 0.34);
}

.sidebar-compose-button svg {
    width: 1.35rem;
    height: 1.35rem;
}

.sidebar-search {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.55rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    padding: 0.1rem 0.3rem 0.1rem 0.85rem;
}

.sidebar-search input {
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 0.72rem 0.75rem 0.72rem 0;
    font-size: 0.94rem;
}

.sidebar-search input:focus {
    box-shadow: none;
}

.sidebar-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.sidebar-search-icon {
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.sidebar-search-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

.sidebar-section-head h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 0.96rem;
}

.sidebar-section-head p {
    font-size: 0.78rem;
}

.employee-directory-list,
.telegram-conversation-list {
    display: grid;
    gap: 0.35rem;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.2rem;
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
}

.employee-directory-list {
    margin-top: 0.6rem;
}

.telegram-conversation-list {
    margin-top: 0.6rem;
}

.employee-entry-form {
    margin: 0;
}

.employee-entry {
    width: 100%;
    border: 0;
    background: transparent;
    display: grid;
    grid-template-columns: 2.6rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem;
    padding: 0.56rem 0.65rem;
    border-radius: 16px;
    text-align: left;
    color: inherit;
    transition: background 160ms ease, transform 160ms ease;
}

.employee-entry:hover,
.employee-entry.is-active {
    background: rgba(15, 118, 110, 0.1);
    transform: translateY(-1px);
}

.group-member-option {
    position: relative;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    gap: 0.65rem;
    padding: 0.62rem 0.65rem;
    border-radius: 18px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.group-member-option:hover {
    transform: translateY(-1px);
    background: rgba(15, 118, 110, 0.08);
    border-color: rgba(15, 118, 110, 0.16);
}

.group-member-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.group-member-mark {
    width: 1.35rem;
    height: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.4rem;
    border: 1px solid rgba(15, 118, 110, 0.26);
    background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
    color: transparent;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.group-member-mark svg {
    width: 0.85rem;
    height: 0.85rem;
}

.group-member-checkbox:focus-visible + .group-member-mark {
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.group-member-checkbox:checked + .group-member-mark {
    background: linear-gradient(135deg, var(--accent), var(--highlight));
    border-color: transparent;
    color: #fff;
    transform: scale(1.02);
}

.group-member-checkbox:checked ~ .employee-avatar {
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12), 0 10px 20px rgba(15, 118, 110, 0.22);
}

.group-member-checkbox:checked ~ .employee-meta strong {
    color: var(--accent-strong);
}

.employee-avatar,
.conversation-avatar {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 0.85rem;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--highlight));
    color: #fff;
    font-weight: 800;
    font-size: 0.82rem;
    box-shadow: 0 8px 16px rgba(15, 118, 110, 0.2);
}

.employee-meta,
.conversation-card-body {
    min-width: 0;
}

.employee-meta strong,
.conversation-card-body strong,
.conversation-card-bottom p,
.conversation-card-bottom small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.employee-meta strong,
.conversation-card-body strong {
    font-size: 0.92rem;
}

.employee-meta small,
.conversation-card-bottom p,
.conversation-card-bottom small {
    font-size: 0.8rem;
}

.employee-action {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent-strong);
}

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

.conversation-card {
    display: grid;
    gap: 0.45rem;
    padding: 0.62rem 0.68rem;
    border-radius: 16px;
    border: 1px solid transparent;
    background: transparent;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.conversation-card-telegram {
    grid-template-columns: 2.6rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.68rem;
}

.conversation-card:hover,
.conversation-card.is-active {
    transform: translateY(-1px);
    border-color: rgba(15, 118, 110, 0.24);
    background: rgba(15, 118, 110, 0.1);
}

.conversation-card-top span,
.conversation-kind-pill {
    font-size: 0.72rem;
    color: var(--muted);
}

.conversation-card-bottom p {
    margin: 0;
    font-weight: 500;
}

.conversation-card-bottom small {
    color: var(--muted);
}

.conversation-kind-pill {
    border-radius: 999px;
    padding: 0.2rem 0.38rem;
    background: rgba(15, 118, 110, 0.1);
    border: 1px solid rgba(15, 118, 110, 0.18);
    font-weight: 800;
    letter-spacing: 0.08em;
}

.sidebar-list-empty,
.sidebar-search-empty {
    border-radius: 16px;
    padding: 0.7rem;
    text-align: center;
    color: var(--muted);
    background: var(--surface-muted);
    border: 1px solid var(--line);
    font-size: 0.82rem;
}

.sidebar-search-empty {
    margin-top: 0.75rem;
}

.sidebar-search-empty[hidden] {
    display: none !important;
}

.sidebar-card,
.conversation-list-card,
.empty-panel,
.empty-thread {
    border-radius: 18px;
    padding: 0.82rem;
}

.conversation-stage {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.09), transparent 26%),
        linear-gradient(180deg, color-mix(in srgb, var(--surface) 70%, transparent), color-mix(in srgb, var(--bg) 70%, transparent));
}

.conversation-header {
    padding: 1rem 1.35rem;
    border-radius: 0;
    background: color-mix(in srgb, var(--surface) 95%, transparent);
    border: 0;
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.conversation-header h2,
.conversation-header-title {
    font-size: 1.12rem;
}

.conversation-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

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

.conversation-header-title {
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-header-toggle {
    width: 2.7rem;
    height: 2.7rem;
    flex: 0 0 auto;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 0.95rem;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
}

.conversation-header-toggle svg {
    width: 1.2rem;
    height: 1.2rem;
}

.socket-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 999px;
    padding: 0.42rem 0.68rem;
    background: rgba(255, 159, 107, 0.12);
    color: var(--muted);
    border: 1px solid var(--line);
    font-size: 0.78rem;
}

.socket-pill.is-live {
    background: rgba(15, 118, 110, 0.14);
    color: var(--accent-strong);
}

.message-stream {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    gap: 0.72rem;
    padding: 1.2rem 1.35rem;
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
}

.message-row {
    display: grid;
    grid-template-columns: 2.35rem minmax(0, 1fr);
    gap: 0.55rem;
    align-items: end;
    max-width: min(820px, 88%);
}

.message-row.is-mine {
    margin-left: auto;
    grid-template-columns: minmax(0, 1fr) 2.35rem;
}

.message-row.is-mine .message-avatar {
    order: 2;
}

.message-row.is-mine .message-bubble {
    order: 1;
    background: linear-gradient(145deg, rgba(15, 118, 110, 0.16), rgba(239, 124, 87, 0.16));
}

.message-avatar {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.8rem;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--highlight));
    color: #fff;
    font-weight: 700;
    font-size: 0.78rem;
}

.message-bubble {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 0.72rem 0.82rem;
    box-shadow: 0 8px 18px rgba(24, 33, 38, 0.08);
}

.message-author {
    font-weight: 700;
    font-size: 0.88rem;
}

.message-time {
    color: var(--muted);
    font-size: 0.74rem;
}

.message-body {
    line-height: 1.45;
    margin-top: 0.35rem;
    font-size: 0.94rem;
    word-break: break-word;
}

.message-attachments,
.file-preview-list {
    display: grid;
    gap: 0.55rem;
    margin-top: 0.55rem;
}

.attachment-card {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 0.6rem;
    align-items: center;
    padding: 0.56rem;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface-muted);
}

.attachment-thumb {
    width: 100%;
    border-radius: 14px;
    object-fit: cover;
}

.attachment-thumb {
    height: 64px;
}

.attachment-icon {
    display: grid;
    place-items: center;
    width: 72px;
    height: 64px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.18), rgba(239, 124, 87, 0.18));
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.attachment-icon.is-pdf {
    background: linear-gradient(135deg, rgba(180, 35, 24, 0.22), rgba(239, 124, 87, 0.2));
    color: #922018;
}

.attachment-icon.is-video {
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.22), rgba(46, 142, 255, 0.16));
}

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

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

.composer-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
    position: relative;
    padding: 0.9rem 1.35rem calc(1rem + env(safe-area-inset-bottom));
    border-radius: 0;
    border: 0;
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 95%, transparent);
    box-shadow: none;
    backdrop-filter: blur(16px);
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.composer-card.is-dragover {
    border-color: rgba(15, 118, 110, 0.32);
    background: linear-gradient(145deg, rgba(15, 118, 110, 0.08), rgba(239, 124, 87, 0.06)), var(--surface);
    box-shadow: 0 14px 30px rgba(15, 118, 110, 0.12);
}

.composer-input-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.55rem;
    align-items: center;
}

.composer-upload {
    width: 2.9rem;
    height: 2.9rem;
    display: grid;
    place-items: center;
    gap: 0;
    border-radius: 999px;
    border: 1px dashed rgba(15, 118, 110, 0.35);
    padding: 0;
    background: rgba(15, 118, 110, 0.08);
    text-align: center;
    color: var(--accent-strong);
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
    flex: 0 0 auto;
}

.composer-upload:hover {
    transform: translateY(-1px);
    border-color: rgba(15, 118, 110, 0.54);
    background: rgba(15, 118, 110, 0.14);
}

.composer-upload input {
    display: none;
}

.composer-upload-icon {
    width: 1.2rem;
    height: 1.2rem;
}

.composer-card textarea {
    min-height: 2.95rem;
    max-height: 9rem;
    padding: 0.72rem 0.9rem;
    border-radius: 18px;
    resize: none;
    overflow-y: auto;
    line-height: 1.35;
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
    min-width: 0;
}

.composer-card.is-dragover textarea {
    border-color: rgba(15, 118, 110, 0.35);
    background: rgba(15, 118, 110, 0.05);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.08);
}

.composer-send-button {
    width: 2.9rem;
    height: 2.9rem;
    border: 0;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--highlight));
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.22);
    transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
    flex: 0 0 auto;
}

.composer-send-button:hover {
    transform: translateY(-1px);
}

.composer-send-button:disabled {
    opacity: 0.55;
    cursor: wait;
    transform: none;
}

.composer-send-icon {
    width: 1rem;
    height: 1rem;
    transform: translateX(1px);
}

.composer-status {
    font-size: 0.76rem;
    padding-left: 0.15rem;
    line-height: 1.4;
}

.file-preview-list:empty,
.composer-status:empty {
    display: none;
}

.composer-status.is-error {
    color: var(--danger);
}

.composer-status.is-success {
    color: var(--accent-strong);
}

.file-preview-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.56rem 0.72rem;
    border-radius: 14px;
    background: var(--surface-muted);
    border: 1px solid var(--line);
    font-size: 0.82rem;
}

.stage-empty,
.empty-thread,
.empty-panel {
    display: grid;
    gap: 0.5rem;
    place-content: center;
    text-align: center;
    min-height: 220px;
}

.stage-empty {
    min-height: 100%;
    padding: clamp(2rem, 5vw, 4rem);
    border-radius: 0;
    border: 0;
    background:
        radial-gradient(circle at center, rgba(239, 124, 87, 0.1), transparent 34%),
        transparent;
    box-shadow: none;
}

.stage-empty p {
    max-width: 34rem;
    margin-inline: auto;
}

.sidebar-overlay,
.media-modal {
    position: fixed;
    inset: 0;
    z-index: 20;
}

.sidebar-overlay {
    background: rgba(6, 12, 18, 0.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}

.media-modal {
    display: grid;
    place-items: center;
    padding: 2rem;
}

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

.media-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 12, 16, 0.7);
}

.media-modal-card {
    position: relative;
    z-index: 2;
    width: min(980px, 100%);
    padding: 1rem;
    border-radius: 28px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
}

.media-modal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.2rem 0.2rem 0.8rem;
}

.media-modal-copy {
    min-width: 0;
    display: grid;
    gap: 0.18rem;
}

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

.media-modal-copy small {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.68rem;
}

.media-modal-copy strong {
    font-size: 0.95rem;
}

.media-modal-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.media-modal-open,
.media-modal-fullscreen,
.media-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.62rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-muted);
    color: var(--text);
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.media-modal-open:hover,
.media-modal-fullscreen:hover,
.media-modal-close:hover {
    transform: translateY(-1px);
    border-color: rgba(15, 118, 110, 0.28);
}

.media-modal-fullscreen.is-active {
    background: rgba(15, 118, 110, 0.16);
    border-color: rgba(15, 118, 110, 0.28);
    color: var(--accent-strong);
}

.media-modal-body {
    padding: 0.25rem;
}

.preview-surface {
    width: 100%;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: rgba(10, 16, 22, 0.92);
}

.preview-surface-image {
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.04);
}

.preview-video {
    display: block;
    width: 100%;
    max-height: 72vh;
    margin: 0 auto;
    object-fit: contain;
}

.preview-image {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 72vh;
    margin: 0 auto;
    object-fit: contain;
}

.preview-pdf {
    display: block;
    width: 100%;
    height: 72vh;
    border: 0;
    background: #fff;
}

.pdf-preview-stage {
    display: grid;
    gap: 1rem;
    max-height: 72vh;
    padding: 1rem;
    overflow: auto;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent),
        linear-gradient(180deg, rgba(14, 21, 27, 0.98), rgba(14, 21, 27, 0.92));
}

.pdf-preview-frame {
    display: grid;
    gap: 0.55rem;
    justify-items: center;
}

.pdf-preview-page-label {
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
}

.pdf-preview-page {
    display: block;
    width: 100%;
    max-width: 860px;
    height: auto;
    border-radius: 18px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
    background: #fff;
}

.pdf-preview-loading,
.video-preview-loading,
.preview-fallback {
    display: grid;
    gap: 0.85rem;
    place-items: center;
    min-height: 48vh;
    text-align: center;
    color: #f4efe4;
}

.preview-fallback a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.6rem;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
}

.preview-surface-video {
    display: grid;
    place-items: center;
    padding: 0;
}

.preview-surface-video .plyr,
.preview-surface-video video {
    width: 100%;
    max-height: 72vh;
    background: #000;
}

.preview-surface-video .plyr {
    border-radius: 24px;
}

.preview-surface-video .plyr video,
.preview-surface-video video,
.preview-surface-video .plyr__poster {
    object-fit: contain !important;
}

.media-modal.is-immersive {
    padding: 0;
}

.media-modal.is-immersive .media-modal-card,
.media-modal-card:fullscreen,
.media-modal-card:-webkit-full-screen {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    border-radius: 0;
    padding: 0.6rem;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.media-modal.is-immersive .media-modal-topbar,
.media-modal-card:fullscreen .media-modal-topbar,
.media-modal-card:-webkit-full-screen .media-modal-topbar {
    padding: 0 0 0.5rem;
}

.media-modal.is-immersive .media-modal-body,
.media-modal-card:fullscreen .media-modal-body,
.media-modal-card:-webkit-full-screen .media-modal-body {
    min-height: 0;
    overflow: hidden;
    padding: 0;
}

.media-modal.is-immersive .preview-surface,
.media-modal-card:fullscreen .preview-surface,
.media-modal-card:-webkit-full-screen .preview-surface {
    height: 100%;
    max-height: none;
}

.media-modal.is-immersive .pdf-preview-stage,
.media-modal-card:fullscreen .pdf-preview-stage,
.media-modal-card:-webkit-full-screen .pdf-preview-stage {
    height: 100%;
    max-height: none;
    padding: 0.8rem;
}

.media-modal.is-immersive .preview-video,
.media-modal.is-immersive .preview-image,
.media-modal.is-immersive .preview-pdf,
.media-modal.is-immersive .preview-surface-video .plyr,
.media-modal.is-immersive .preview-surface-video video,
.media-modal-card:fullscreen .preview-video,
.media-modal-card:fullscreen .preview-image,
.media-modal-card:fullscreen .preview-pdf,
.media-modal-card:fullscreen .preview-surface-video .plyr,
.media-modal-card:fullscreen .preview-surface-video video,
.media-modal-card:-webkit-full-screen .preview-video,
.media-modal-card:-webkit-full-screen .preview-image,
.media-modal-card:-webkit-full-screen .preview-pdf,
.media-modal-card:-webkit-full-screen .preview-surface-video .plyr,
.media-modal-card:-webkit-full-screen .preview-surface-video video {
    max-height: calc(100dvh - 5.25rem);
}

@keyframes float {
    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        transform: translate3d(10px, 22px, 0) scale(1.04);
    }
}

@keyframes drift {
    from {
        transform: translate3d(0, 0, 0);
    }
    to {
        transform: translate3d(-44px, -44px, 0);
    }
}

@keyframes sidebarPanelReveal {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1120px) {
    .auth-panel {
        grid-template-columns: 1fr;
    }

    .auth-hero {
        min-height: auto;
    }

    .messenger-shell {
        grid-template-columns: 1fr;
        height: 100dvh;
    }

    .mobile-only {
        display: inline-flex;
    }

    .messenger-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(420px, 100vw);
        z-index: 30;
        transform: translateX(-102%);
        transition: transform 220ms ease;
        height: auto;
        box-shadow: 0 24px 48px rgba(2, 9, 14, 0.28);
    }

    .messenger-shell.sidebar-open .messenger-sidebar {
        transform: translateX(0);
    }

    .messenger-shell.sidebar-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .conversation-stage {
        height: 100%;
    }
}

@media (max-width: 760px) {
    .auth-shell,
    .media-modal {
        padding: 0.75rem;
    }

    .auth-hero,
    .auth-card {
        border-radius: 24px;
        padding: 0.82rem;
    }

    .messenger-sidebar {
        padding: 0.85rem;
    }

    .auth-card-top,
    .conversation-header,
    .sidebar-header {
        grid-template-columns: 1fr;
        display: grid;
    }

    .conversation-header {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        padding: 0.82rem 1rem;
    }

    .conversation-header-left {
        gap: 0.55rem;
    }

    .conversation-header-title {
        font-size: 0.98rem;
    }

    .conversation-header-toggle {
        display: inline-flex;
    }

    .composer-card {
        display: grid;
        gap: 0.45rem;
        padding: 0.82rem 1rem calc(0.9rem + env(safe-area-inset-bottom));
    }

    .composer-input-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 0.45rem;
    }

    .sidebar-header-actions {
        justify-content: stretch;
    }

    .theme-menu-root {
        align-self: flex-start;
    }

    .theme-menu {
        left: 0;
        right: auto;
        width: min(280px, calc(100vw - 2.5rem));
    }

    .employee-entry,
    .conversation-card-telegram {
        grid-template-columns: 2.8rem minmax(0, 1fr);
    }

    .employee-action,
    .conversation-kind-pill {
        display: none;
    }

    .logo-slot,
    .composer-upload {
        min-width: 0;
    }

    .composer-upload,
    .composer-send-button {
        width: 2.7rem;
        height: 2.7rem;
    }

    .media-modal-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .sidebar-action-row {
        padding-bottom: calc(0.15rem + env(safe-area-inset-bottom));
    }

    .message-stream {
        padding: 0.9rem 1rem;
    }

    .sidebar-compose {
        min-height: 3.85rem;
    }

    .sidebar-compose-menu {
        width: min(100%, 320px);
    }

    .sidebar-compose-button {
        width: 3.55rem;
        height: 3.55rem;
        border-radius: 1.05rem;
    }

    .sidebar-confirm-button {
        width: 2.95rem;
        height: 2.95rem;
    }

    .media-modal-actions {
        width: 100%;
        justify-content: space-between;
    }

    .preview-pdf,
    .preview-video,
    .preview-image,
    .preview-surface-video .plyr,
    .preview-surface-video video {
        max-height: 62vh;
    }

    .preview-pdf {
        height: 62vh;
    }

    .pdf-preview-stage {
        max-height: 62vh;
        padding: 0.75rem;
    }


    .member-strip {
        padding: 0.75rem;
    }

    .message-row,
    .message-row.is-mine {
        max-width: 100%;
    }

    .attachment-card {
        grid-template-columns: 1fr;
    }
}
