:root {
    --bg: #09131a;
    --bg-soft: #10222b;
    --panel: rgba(11, 24, 31, 0.86);
    --panel-strong: #112834;
    --line: rgba(149, 206, 197, 0.18);
    --text: #eef7f4;
    --muted: #9ab7b1;
    --accent: #42d7bb;
    --accent-strong: #0f9b83;
    --danger: #ff8570;
    --success: #6ce0a6;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    --chat-sidebar-width: 276px;
    --chat-edge-gap: 12px;
    --chat-dock-height: 560px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    font-family: "Avenir Next", "Trebuchet MS", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(66, 215, 187, 0.18), transparent 30%),
        radial-gradient(circle at top right, rgba(54, 122, 255, 0.22), transparent 28%),
        linear-gradient(180deg, #071015 0%, #0d1b23 100%);
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
}

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

button,
input {
    font: inherit;
}

textarea {
    font: inherit;
}

.page-shell {
    width: min(1160px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 48px;
}

body.chat-body {
    overflow-x: hidden;
}

.page-shell.is-chat-shell {
    width: 100%;
    margin: 0;
    padding: 10px 0 0;
}

.page-content.is-chat-content {
    gap: 0;
}

.page-shell.is-chat-shell .topbar {
    padding: 8px 16px 12px;
}

.page-shell.is-chat-shell .page-content {
    padding: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 0 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent) 0%, #368aff 100%);
    color: #041015;
}

.nav {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--muted);
}

.page-content {
    display: grid;
    gap: 24px;
}

.hero,
.split-page,
.dashboard-grid {
    display: grid;
    gap: 24px;
}

.hero,
.split-page {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hero-copy h1,
.panel h1 {
    font-size: clamp(2rem, 4vw, 3.6rem);
    line-height: 1.05;
    margin: 0 0 18px;
}

.panel h2,
.glass-card h2 {
    margin-top: 0;
    font-size: 1.35rem;
}

.panel,
.glass-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 28px;
    padding: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.panel.narrow {
    max-width: 620px;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 14px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.8rem;
    font-weight: 700;
}

.lede,
.muted {
    color: var(--muted);
}

.hero-actions,
.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.button,
.button-secondary,
.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.85rem 1.4rem;
    border: 0;
    cursor: pointer;
    transition: transform 180ms ease, opacity 180ms ease;
}

.button {
    background: linear-gradient(135deg, var(--accent) 0%, #80f0d7 100%);
    color: #052018;
    font-weight: 800;
}

.button-secondary,
.link-button {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.button:hover,
.button-secondary:hover,
.link-button:hover {
    transform: translateY(-1px);
}

.inline-form {
    display: inline;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.link-button {
    padding: 0;
    border-radius: 0;
    background: transparent;
}

.feature-list,
.list-stack {
    display: grid;
    gap: 12px;
    padding-left: 18px;
}

.feature-list li {
    color: var(--muted);
}

.list-stack {
    padding-left: 0;
}

.list-card,
.stat-card,
.check-item,
.device-status {
    display: grid;
    gap: 6px;
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-card strong {
    font-size: 1.8rem;
}

.check-grid,
.form-grid {
    display: grid;
    gap: 14px;
}

.form-grid label {
    display: grid;
    gap: 8px;
}

.form-grid input {
    width: 100%;
    padding: 0.95rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.form-grid textarea {
    width: 100%;
    min-height: 140px;
    padding: 0.95rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    resize: vertical;
}

.form-grid input:focus,
.form-grid textarea:focus {
    outline: 2px solid rgba(66, 215, 187, 0.35);
    border-color: rgba(66, 215, 187, 0.5);
}

.transfer-stack {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.transfer-card {
    display: grid;
    gap: 12px;
    padding: 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-toggle {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-toggle input[type="checkbox"] {
    margin-top: 3px;
}

.transfer-qr-block {
    display: grid;
    gap: 10px;
    justify-items: start;
}

.transfer-qr-image {
    width: 220px;
    height: 220px;
    padding: 10px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.alert {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 133, 112, 0.12);
    border: 1px solid rgba(255, 133, 112, 0.3);
    color: #ffd2c8;
}

.alert-success,
.check-item.ok,
.device-status-ready {
    background: rgba(108, 224, 166, 0.12);
    border-color: rgba(108, 224, 166, 0.32);
    color: #d7ffeb;
}

.check-item.bad,
.device-status-error {
    background: rgba(255, 133, 112, 0.12);
    border-color: rgba(255, 133, 112, 0.3);
    color: #ffd2c8;
}

.device-status-pending {
    background: rgba(66, 215, 187, 0.09);
    border-color: rgba(66, 215, 187, 0.26);
}

.contacts-page {
    align-items: start;
}

.chat-layout {
    display: block;
    min-height: calc(100vh - 78px);
}

.chat-sidebar,
.chat-main {
    min-height: 0;
}

.chat-sidebar {
    display: grid;
    gap: 10px;
    align-content: start;
    position: fixed;
    top: 72px;
    left: 0;
    bottom: 0;
    width: var(--chat-sidebar-width);
    padding: 14px 14px 120px;
    border-radius: 0 22px 0 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 5;
    scrollbar-width: none;
}

.chat-main {
    display: grid;
    gap: 10px;
    align-content: start;
    margin-left: calc(var(--chat-sidebar-width) + var(--chat-edge-gap));
    padding: 4px 14px calc(var(--chat-dock-height) + 20px) 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
}

.presence-card,
.chat-panel,
.conversation-link {
    display: grid;
    gap: 8px;
    padding: 12px 13px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.presence-card {
    margin-bottom: 4px;
}

.chat-notifications-card {
    display: grid;
    gap: 6px;
    margin-top: 2px;
}

.chat-notifications-button {
    width: fit-content;
}

.presence-select-group {
    display: grid;
    gap: 6px;
}

.presence-select-label {
    font-weight: 700;
    font-size: 0.92rem;
}

.presence-select,
.chat-compose textarea {
    width: 100%;
    font: inherit;
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
}

.presence-select {
    padding: 0.7rem 0.85rem;
    appearance: none;
}

.conversation-list {
    display: grid;
    gap: 8px;
}

.conversation-link {
    text-align: left;
    cursor: pointer;
    width: 100%;
    appearance: none;
}

.conversation-link.is-active {
    border-color: rgba(66, 215, 187, 0.42);
    background: rgba(66, 215, 187, 0.08);
}

.conversation-link strong {
    font-size: 0.92rem;
    line-height: 1.25;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.conversation-card-meta {
    display: grid;
    gap: 4px;
    font-size: 0.86rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    padding: 0.25rem 0.52rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
}

.unread-message-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: linear-gradient(135deg, #42d7bb, #5ce5cf);
    color: #071116;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    box-shadow: 0 8px 18px rgba(66, 215, 187, 0.22);
}

.status-pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.status-pill.is-available {
    color: #76f0b1;
}

.status-pill.is-away {
    color: #ffd36e;
}

.status-pill.is-dnd,
.status-pill.is-busy {
    color: #ff8d8d;
}

.status-pill.is-offline {
    color: #96a7b8;
}

.security-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.24rem 0.48rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(238, 247, 244, 0.8);
}

.security-pill.is-changed,
.security-pill.is-device_mismatch,
.security-pill.is-trusted_self_warning,
.security-pill.is-missing {
    color: #ffd0bf;
    border-color: rgba(255, 133, 112, 0.24);
    background: rgba(255, 133, 112, 0.08);
}

.missed-call-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.24rem 0.48rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #ffd0bf;
    border: 1px solid rgba(255, 133, 112, 0.24);
    background: rgba(255, 133, 112, 0.08);
}

.chat-workspace-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding-right: 0;
}

.chat-dock {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: flex-end;
    position: fixed;
    left: calc(var(--chat-sidebar-width) + var(--chat-edge-gap));
    right: var(--chat-edge-gap);
    bottom: 0;
    padding: 0 0 calc(env(safe-area-inset-bottom, 0px) + 12px);
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 20;
    scrollbar-width: none;
}

.chat-thread {
    display: grid;
    gap: 8px;
    min-height: 0;
    max-height: none;
    overflow: auto;
    padding: 10px 12px 6px;
    background: linear-gradient(180deg, rgba(6, 16, 21, 0.58), rgba(5, 13, 18, 0.18));
}

.chat-panel {
    flex: 0 0 min(100%, 308px);
    align-content: start;
    align-self: end;
    min-height: 468px;
    max-height: min(68vh, 560px);
    grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(20px);
    overflow: hidden;
    background: rgba(8, 20, 26, 0.97);
    border: 1px solid rgba(149, 206, 197, 0.18);
}

.chat-panel-header,
.chat-panel-toolbar,
.chat-panel-title {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.chat-panel-header {
    justify-content: space-between;
    padding: 10px 12px 8px;
    border-bottom: 1px solid rgba(149, 206, 197, 0.14);
    background: rgba(255, 255, 255, 0.03);
}

.chat-panel-title {
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.chat-panel-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(66, 215, 187, 0.82), rgba(54, 138, 255, 0.85));
    color: #041015;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.chat-panel-title-line {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.chat-panel-title strong {
    font-size: 0.78rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-panel-subtitle,
.chat-panel-number {
    font-size: 0.72rem;
}

.chat-panel-subtitle {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-presence-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    flex-shrink: 0;
    background: #96a7b8;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.03);
}

.chat-presence-dot.is-available {
    background: #76f0b1;
}

.chat-presence-dot.is-away {
    background: #ffd36e;
}

.chat-presence-dot.is-dnd,
.chat-presence-dot.is-busy {
    background: #ff8d8d;
}

.chat-presence-dot.is-offline {
    background: #96a7b8;
}

.chat-panel-number-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
}

.chat-call-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.chat-security-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: rgba(238, 247, 244, 0.88);
    background: rgba(149, 206, 197, 0.12);
    border: 1px solid rgba(149, 206, 197, 0.18);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.chat-security-badge:hover,
.chat-security-badge[aria-expanded="true"] {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.chat-security-badge.is-trusted {
    color: #7af2be;
    border-color: rgba(122, 242, 190, 0.25);
    background: rgba(122, 242, 190, 0.1);
}

.chat-security-badge.is-changed,
.chat-security-badge.is-device_mismatch,
.chat-security-badge.is-trusted_self_warning,
.chat-security-badge.is-missing {
    color: #ffd0bf;
    border-color: rgba(255, 133, 112, 0.28);
    background: rgba(255, 133, 112, 0.12);
}

.chat-panel-toolbar {
    min-height: 0;
    padding: 6px 12px 0;
}

.chat-panel-status {
    width: 100%;
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
}

.chat-security-banner {
    display: grid;
    gap: 8px;
    padding: 7px 12px 0;
}

.chat-security-banner .muted {
    display: block;
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 0.69rem;
    line-height: 1.45;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-security-banner.is-changed .muted,
.chat-security-banner.is-device_mismatch .muted,
.chat-security-banner.is-trusted_self_warning .muted,
.chat-security-banner.is-missing .muted {
    color: #ffd9cf;
    background: rgba(255, 133, 112, 0.08);
    border-color: rgba(255, 133, 112, 0.2);
}

.chat-security-action {
    justify-self: start;
    min-height: 30px;
    padding: 0 12px;
    font-size: 0.72rem;
}

.chat-security-details {
    display: grid;
    gap: 6px;
    padding: 7px 12px 0;
}

.chat-security-details strong,
.chat-security-details .muted,
.chat-security-details code {
    display: block;
}

.chat-security-details strong,
.chat-security-details .muted,
.chat-security-details code,
.chat-security-previous {
    padding: 0 10px;
}

.chat-security-details strong {
    padding-top: 8px;
    font-size: 0.72rem;
}

.chat-security-details .muted,
.chat-security-previous {
    font-size: 0.68rem;
    line-height: 1.45;
}

.chat-security-fingerprint {
    padding-top: 2px;
    padding-bottom: 2px;
    font-size: 0.68rem;
    line-height: 1.5;
    color: rgba(238, 247, 244, 0.92);
    word-break: break-word;
}

.chat-security-details.is-trusted,
.chat-security-details.is-trusted_self_warning,
.chat-security-details.is-changed,
.chat-security-details.is-device_mismatch,
.chat-security-details.is-missing {
    margin: 0 12px;
    padding: 8px 0 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-security-details.is-trusted .chat-security-fingerprint,
.chat-security-details.is-trusted_self_warning .chat-security-fingerprint {
    color: #9cefc7;
}

.chat-security-details.is-changed,
.chat-security-details.is-device_mismatch,
.chat-security-details.is-missing {
    background: rgba(255, 133, 112, 0.08);
    border-color: rgba(255, 133, 112, 0.2);
}

.chat-close-button {
    min-width: 28px;
    min-height: 28px;
    padding: 0;
    font-size: 1.05rem;
    flex-shrink: 0;
    background: transparent;
    border: 0;
    color: var(--muted);
    box-shadow: none;
}

.chat-icon-button {
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    border-radius: 999px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-icon-button svg {
    width: 16px;
    height: 16px;
    display: block;
}

.chat-call-button svg,
.chat-hangup-button svg,
.chat-attach-button svg {
    display: none;
}

.chat-call-button::before,
.chat-hangup-button::before,
.chat-attach-button::before {
    content: "";
    display: block;
    width: 16px;
    height: 16px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.chat-call-button {
    color: var(--accent);
    border: 1px solid rgba(66, 215, 187, 0.24);
    background: rgba(66, 215, 187, 0.08);
}

.chat-call-button::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2A19.86 19.86 0 0 1 11.2 19a19.5 19.5 0 0 1-6-6A19.86 19.86 0 0 1 2.09 4.18 2 2 0 0 1 4.08 2h3a2 2 0 0 1 2 1.72c.12.91.35 1.8.68 2.64a2 2 0 0 1-.45 2.11L8 9.78a16 16 0 0 0 6.22 6.22l1.31-1.31a2 2 0 0 1 2.11-.45c.84.33 1.73.56 2.64.68A2 2 0 0 1 22 16.92Z' fill='none' stroke='%2342d7bb' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.chat-hangup-button {
    background: rgba(255, 133, 112, 0.12);
    color: #ffd2c8;
    border: 1px solid rgba(255, 133, 112, 0.22);
}

.chat-hangup-button::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 15.5v2.3a1 1 0 0 1-1 1 17 17 0 0 1-8-2 17 17 0 0 1-8 2 1 1 0 0 1-1-1v-2.3a2 2 0 0 1 1.15-1.82A17.2 17.2 0 0 1 12 12a17.2 17.2 0 0 1 7.85 1.68A2 2 0 0 1 21 15.5Z' fill='none' stroke='%23ffd2c8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.chat-icon-button:disabled {
    opacity: 0.45;
    transform: none;
}

.chat-workspace-empty {
    min-height: 82px;
    display: grid;
    place-items: center;
    text-align: center;
    margin-right: 6px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 0.92rem;
}

.chat-bubble,
.chat-empty {
    max-width: 100%;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-entry {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.chat-entry.is-mine {
    justify-content: flex-end;
}

.chat-entry.is-system {
    justify-content: center;
}

.chat-entry-content {
    display: grid;
    gap: 4px;
    max-width: calc(100% - 42px);
}

.chat-entry.is-mine .chat-entry-content {
    justify-items: end;
}

.chat-message-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.chat-message-avatar.is-mine {
    background: rgba(66, 215, 187, 0.18);
    color: var(--text);
}

.chat-message-avatar.is-theirs {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.chat-day-separator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0 2px;
    color: rgba(238, 247, 244, 0.72);
    font-size: 0.72rem;
    font-weight: 700;
}

.chat-day-separator::before,
.chat-day-separator::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(149, 206, 197, 0.24);
}

.chat-bubble {
    display: grid;
    gap: 6px;
    max-width: 100%;
    width: fit-content;
}

.chat-bubble p {
    margin: 0;
    line-height: 1.45;
    font-size: 0.82rem;
    white-space: pre-wrap;
}

.chat-bubble.is-mine {
    margin-left: auto;
    background: rgba(66, 215, 187, 0.16);
    border-color: rgba(66, 215, 187, 0.22);
}

.chat-bubble.is-theirs {
    background: rgba(255, 255, 255, 0.06);
}

.chat-bubble.is-auth-invalid {
    background: rgba(255, 133, 112, 0.1);
    border-color: rgba(255, 133, 112, 0.32);
}

.chat-bubble.is-auth-legacy {
    border-style: dashed;
    border-color: rgba(149, 206, 197, 0.18);
}

.chat-empty {
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    font-size: 0.78rem;
}

.chat-system-card {
    display: grid;
    gap: 4px;
    justify-items: center;
    min-width: min(100%, 220px);
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
}

.chat-system-card strong {
    font-size: 0.78rem;
    line-height: 1.3;
}

.chat-system-card span {
    font-size: 0.72rem;
}

.chat-system-card.is-missed {
    background: rgba(255, 133, 112, 0.08);
    border-color: rgba(255, 133, 112, 0.24);
}

.chat-system-meta {
    font-size: 0.66rem;
}

.chat-meta {
    color: var(--muted);
    font-size: 0.68rem;
    padding: 0 2px;
}

.chat-meta[data-delivery-state="sent"],
.chat-meta[data-delivery-state="delivered"],
.chat-meta[data-delivery-state="read"] {
    letter-spacing: 0.01em;
}

.chat-meta[data-delivery-state="delivered"] {
    color: rgba(238, 247, 244, 0.84);
}

.chat-meta[data-delivery-state="read"] {
    color: #5ce5cf;
}

.chat-meta.is-invalid {
    color: #ffb3a5;
}

.chat-meta.is-legacy {
    color: rgba(238, 247, 244, 0.64);
}

.attachment-card,
.attachment-image-card,
.call-banner,
.call-live {
    display: grid;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.attachment-card {
    min-width: min(100%, 232px);
}

.attachment-card-error {
    background: rgba(255, 133, 112, 0.08);
    border-color: rgba(255, 133, 112, 0.24);
}

.attachment-image-card {
    position: relative;
    min-width: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    overflow: hidden;
}

.attachment-preview-status {
    margin-top: -2px;
    padding: 0 2px 4px;
}

.attachment-preview-link {
    display: inline-block;
    width: fit-content;
    max-width: 100%;
}

.attachment-preview-image {
    display: block;
    max-width: 100%;
    max-height: 156px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.attachment-image-link {
    display: block;
    width: fit-content;
    max-width: 100%;
    border-radius: 14px;
    overflow: hidden;
}

.attachment-image {
    display: block;
    width: auto;
    max-width: min(100%, 220px);
    max-height: 220px;
    border-radius: 14px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.24);
}

.chat-image-download {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(7, 17, 22, 0.72);
    color: #eef7f4;
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(10px);
}

.chat-image-download .chat-icon-glyph {
    font-size: 15px;
}

.call-banner {
    background: rgba(66, 215, 187, 0.08);
    border-color: rgba(66, 215, 187, 0.22);
}

.call-live {
    background: rgba(54, 138, 255, 0.08);
    border-color: rgba(54, 138, 255, 0.2);
}

.chat-compose {
    display: grid;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(149, 206, 197, 0.14);
    background: rgba(255, 255, 255, 0.03);
}

.compose-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    min-height: 0;
}

.chat-compose textarea {
    resize: none;
    min-height: 74px;
    max-height: 116px;
    padding: 0.8rem 0.9rem;
    border-radius: 14px;
    font-size: 0.82rem;
    line-height: 1.45;
    background: rgba(7, 17, 22, 0.96);
}

.chat-compose textarea:focus {
    outline: 2px solid rgba(66, 215, 187, 0.35);
    border-color: rgba(66, 215, 187, 0.5);
}

.chat-compose-note {
    display: none;
}

.chat-compose .inline-actions {
    justify-content: space-between;
    align-items: center;
}

.chat-attach-button {
    color: var(--muted);
    border: 1px solid rgba(149, 206, 197, 0.18);
    background: rgba(255, 255, 255, 0.04);
}

.chat-attach-button::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21.44 11.05 12.25 20.24a6 6 0 1 1-8.49-8.49l9.2-9.19a4 4 0 1 1 5.65 5.66l-9.2 9.19a2 2 0 0 1-2.82-2.83l8.48-8.48' fill='none' stroke='%239ab7b1' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.chat-call-button::before,
.chat-hangup-button::before,
.chat-attach-button::before {
    display: none;
    background-image: none;
}

.chat-icon-glyph {
    display: inline-block;
    font-size: 15px;
    line-height: 1;
    font-weight: 700;
    font-style: normal;
}

.chat-hangup-button .chat-icon-glyph {
    font-size: 16px;
}

.chat-panel .button:not(.chat-icon-button) {
    padding: 0.54rem 0.92rem;
    font-size: 0.8rem;
}

#call-remote-audio {
    display: none;
}

.chat-sidebar::-webkit-scrollbar,
.chat-dock::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.chat-thread::-webkit-scrollbar {
    width: 8px;
}

.chat-thread::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
}

.chat-global-status {
    max-width: 460px;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 0.84rem;
}

.page-shell.is-chat-shell .brand {
    gap: 10px;
    font-size: 0.88rem;
}

.page-shell.is-chat-shell .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 12px;
}

.page-shell.is-chat-shell .nav {
    gap: 12px;
    font-size: 0.92rem;
}

.chat-sidebar .button,
.chat-sidebar .button-secondary,
.chat-sidebar .link-button,
.chat-panel .button,
.chat-panel .button-secondary,
.chat-panel .link-button {
    padding: 0.68rem 1rem;
    font-size: 0.84rem;
}

.chat-sidebar .muted,
.chat-panel .muted,
.chat-main .muted {
    font-size: 0.84rem;
    line-height: 1.4;
}

.chat-sidebar .eyebrow {
    margin-bottom: 2px;
    font-size: 0.72rem;
}

.chat-sidebar .list-stack {
    gap: 10px;
}

@media (max-width: 920px) {
    :root {
        --chat-sidebar-width: 100%;
        --chat-edge-gap: 12px;
        --chat-dock-height: 0px;
    }

    .hero,
    .split-page,
    .dashboard-grid,
    .chat-layout {
        display: grid;
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .chat-header {
        flex-direction: column;
    }

    .chat-workspace-head {
        flex-direction: column;
    }

    .chat-sidebar {
        position: static;
        width: auto;
        padding: 18px;
        border-radius: 28px;
        overflow: visible;
    }

    .chat-main {
        margin-left: 0;
        padding: 0;
        min-height: auto;
    }

    .chat-dock {
        position: static;
        flex-direction: column;
        justify-content: flex-start;
        overflow: visible;
        padding: 0;
    }

    .chat-panel {
        flex-basis: auto;
        min-height: auto;
        max-height: none;
        border-radius: 20px;
    }

    .compose-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}
