/* ─────────────────────────────────────────────────────────────
   Eduplus Messenger — Theme
   Overrides Bootstrap 5 CSS variables + shared app styles.
   See docs/design.md for the full design system.
───────────────────────────────────────────────────────────── */

:root {
    /* Brand green — desaturated, mid-tone, eye-friendly */
    --bs-primary: #3E8368;
    --bs-primary-rgb: 62, 131, 104;
    --bs-primary-text-emphasis: #2A5C48;
    --bs-primary-bg-subtle: #E9F3EE;
    --bs-primary-border-subtle: #C6E2D5;
    --bs-link-color: #3E8368;
    --bs-link-color-rgb: 62, 131, 104;
    --bs-link-hover-color: #2A5C48;
    --bs-link-hover-color-rgb: 42, 92, 72;

    /* Neutrals — warm gray-green, not pure gray */
    --bs-body-bg: #F5F7F5;
    --bs-body-bg-rgb: 245, 247, 245;
    --bs-body-color: #2B322D;
    --bs-body-color-rgb: 43, 50, 45;
    --bs-secondary-color: #6B7770;
    --bs-tertiary-color: #93A099;
    --bs-border-color: #E1E7E3;
    --bs-border-color-translucent: rgba(43, 50, 45, 0.08);

    /* Surfaces */
    --surface-0: #FFFFFF;
    --surface-1: #FBFCFB;

    /* Chat-specific */
    --bubble-out-bg: #DCF1E7;
    --bubble-out-color: #1F3B30;
    --bubble-in-bg: #FFFFFF;
    --bubble-in-color: #2B322D;
    --bubble-radius: 1rem;
    --presence-online: #3E8368;
    --presence-offline: #C7CDC9;

    /* Type & shape */
    --bs-body-font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    --bs-body-font-size: 0.9rem;
    --bs-body-line-height: 1.5;
    --bs-border-radius: 0.6rem;
    --bs-border-radius-sm: 0.45rem;
    --bs-border-radius-lg: 0.9rem;
    --bs-border-radius-pill: 50rem;
    --shadow-xs: 0 1px 2px rgba(20, 30, 24, 0.05);
    --shadow-sm: 0 2px 6px rgba(20, 30, 24, 0.06), 0 1px 2px rgba(20, 30, 24, 0.04);
    --shadow-md: 0 8px 24px rgba(20, 30, 24, 0.08);
}

body {
    background: var(--bs-body-bg);
}

/* ── Buttons — compact by default ─────────────────────────── */

.btn {
    font-weight: 500;
}

.btn-primary {
    box-shadow: var(--shadow-xs);
}

.btn-xs {
    padding: 0.2rem 0.45rem;
    font-size: 0.75rem;
    border-radius: var(--bs-border-radius-sm);
}

/* ── App Shell ─────────────────────────────────────────────── */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin-left: 260px;
    transition: margin-left 0.2s ease;
}

.page-content {
    flex: 1;
    padding: 1.25rem;
}

.impersonation-banner {
    background: var(--bs-warning-bg-subtle, #fff3cd);
    color: #7a5b00;
    text-align: center;
    font-size: 0.82rem;
    padding: 0.4rem 1rem;
}

.impersonation-banner a {
    font-weight: 600;
}

/* ── Sidebar ───────────────────────────────────────────────── */

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    background: var(--surface-0);
    border-right: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--bs-body-color);
    min-width: 0;
}

.sidebar-brand-icon img {
    width: 32px;
    height: 32px;
    border-radius: var(--bs-border-radius-sm);
    object-fit: cover;
    display: block;
}

.sidebar-brand-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--bs-secondary-color);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.25rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.6rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.7rem;
    border-radius: var(--bs-border-radius-sm);
    color: var(--bs-secondary-color);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.15rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-nav .nav-link:hover {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
}

.sidebar-nav .nav-link.active {
    background: var(--bs-primary);
    color: #fff;
    box-shadow: var(--shadow-xs);
}

.sidebar-nav .nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-nav .nav-badge {
    background: var(--bs-danger);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.22rem 0.4rem;
    border-radius: var(--bs-border-radius-pill);
}

.sidebar-nav .nav-caret {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.sidebar-nav a[aria-expanded="true"] .nav-caret {
    transform: rotate(90deg);
}

.sidebar-submenu {
    padding: 0.15rem 0 0.35rem 2.15rem;
}

.sidebar-submenu .nav-link {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 400;
}

.sidebar-footer {
    padding: 0.85rem 1.1rem;
    border-top: 1px solid var(--bs-border-color);
}

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

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-user-avatar-photo {
    object-fit: cover;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.sidebar-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-role {
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
}

.sidebar-backdrop {
    display: none;
}

/* ── Mobile drawer ─────────────────────────────────────────── */

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: var(--shadow-md);
    }

    .app-sidebar.is-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .is-mobile-app .sidebar-brand {
        margin-top: 30px;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(20, 30, 24, 0.35);
        z-index: 1035;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }

    .sidebar-backdrop.is-visible {
        opacity: 1;
        visibility: visible;
    }

    .is-mobile-app .app-topbar {
        margin-top: 30px;
    }
}

/* ── Topbar ────────────────────────────────────────────────── */

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1.25rem;
    background: var(--surface-0);
    border-bottom: 1px solid var(--bs-border-color);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-title {
    font-size: 1rem;
    font-weight: 600;
}

.sidebar-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 34px;
    height: 34px;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-sm);
    background: var(--surface-0);
}

.sidebar-toggle span {
    display: block;
    width: 16px;
    height: 2px;
    margin: 0 auto;
    background: var(--bs-body-color);
    border-radius: 1px;
}

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

.topbar-icon-btn {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-1);
    border: 1px solid var(--bs-border-color);
    border-radius: 50%;
    color: var(--bs-secondary-color);
    font-size: 1.05rem;
}

.topbar-icon-btn::after {
    display: none;
}

.topbar-icon-btn:hover {
    color: var(--bs-primary);
    border-color: var(--bs-primary-border-subtle);
}

.topbar-icon-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: var(--bs-danger);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--surface-0);
}

.topbar-notifications {
    width: 320px;
    padding: 0;
    border: 1px solid var(--bs-border-color);
    box-shadow: var(--shadow-md);
}

.topbar-notifications-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--bs-border-color);
    font-weight: 600;
    font-size: 0.85rem;
}

.topbar-notifications-list {
    max-height: 320px;
    overflow-y: auto;
}

.topbar-notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.65rem 0.9rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--bs-border-color-translucent);
}

.topbar-notification-item:hover {
    background: var(--surface-1);
}

.topbar-notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.topbar-notification-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar-notification-text {
    font-size: 0.82rem;
    line-height: 1.35;
}

.topbar-notification-time {
    font-size: 0.72rem;
    color: var(--bs-tertiary-color);
    margin-top: 0.15rem;
}

.topbar-notifications-footer {
    display: block;
    text-align: center;
    padding: 0.6rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-top: 1px solid var(--bs-border-color);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: inherit;
    padding: 0.25rem 0.5rem 0.25rem 0.25rem;
    border-radius: var(--bs-border-radius-pill);
}

.topbar-user:hover {
    background: var(--surface-1);
}

.topbar-user::after {
    display: none;
}

.topbar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.topbar-user-avatar-photo {
    object-fit: cover;
}

.topbar-user-info {
    flex-direction: column;
    line-height: 1.2;
    text-align: left;
}

.topbar-user-name {
    font-size: 0.82rem;
    font-weight: 600;
}

.topbar-user-role {
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
}

/* ── Page header ───────────────────────────────────────────── */

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.1rem;
}

.page-heading {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.page-subheading {
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
    margin: 0.15rem 0 0;
}

/* ── Cards & widgets ───────────────────────────────────────── */

.card {
    border: 1px solid var(--bs-border-color);
    box-shadow: var(--shadow-xs);
}

.card-widget-title {
    font-size: 0.88rem;
    font-weight: 600;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: var(--surface-0);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--shadow-xs);
    padding: 0.95rem 1.05rem;
    height: 100%;
}

.stat-card-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--bs-border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.stat-card-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-card-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card-label {
    font-size: 0.76rem;
    color: var(--bs-secondary-color);
}

.avatar-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.avatar-circle-lg {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
}

.avatar-photo {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.user-photo-preview {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}

.quick-action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 1.1rem 0.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    color: var(--bs-body-color);
    text-decoration: none;
    background: var(--surface-1);
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.quick-action-tile i {
    font-size: 1.35rem;
    color: var(--bs-primary);
}

.quick-action-tile:hover {
    border-color: var(--bs-primary-border-subtle);
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
}

/* ── Empty state ───────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 2.25rem 1rem;
    color: var(--bs-secondary-color);
}

.empty-state-icon {
    font-size: 1.9rem;
    color: var(--bs-tertiary-color);
    margin-bottom: 0.5rem;
    display: block;
}

.empty-state-title {
    font-weight: 600;
    color: var(--bs-body-color);
    font-size: 0.9rem;
}

.empty-state-text {
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

/* ── Settings page ─────────────────────────────────────────── */

.settings-logo-preview {
    width: 64px;
    height: 64px;
    border-radius: var(--bs-border-radius);
    object-fit: cover;
    border: 1px solid var(--bs-border-color);
}

/* ── Users page ────────────────────────────────────────────── */

.users-search-input {
    max-width: 300px;
}

.users-per-page-select {
    width: auto;
}

.users-table thead th {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--bs-tertiary-color);
    border-bottom-width: 1px;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

.users-table tbody td {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

.users-table tbody tr:hover {
    background: var(--surface-1);
}

.users-role-badge {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    font-weight: 500;
    font-size: 0.7rem;
}

.users-status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 0.35rem;
}

.users-status-dot.is-active {
    background: var(--presence-online);
}

.users-status-dot.is-inactive {
    background: var(--presence-offline);
}

/* ── Chat shell ────────────────────────────────────────────── */

.chat-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.chat-rail {
    width: 72px;
    flex-shrink: 0;
    background: var(--surface-0);
    border-right: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0;
}

.chat-rail-brand-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.chat-rail-brand img {
    width: 36px;
    height: 36px;
    border-radius: var(--bs-border-radius-sm);
    object-fit: cover;
    display: block;
}

.chat-rail-brand-name {
    display: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.chat-rail-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.chat-rail-link {
    width: 44px;
    height: 44px;
    border-radius: var(--bs-border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-secondary-color);
    font-size: 1.2rem;
}

.chat-rail-link-label {
    display: none;
}

.chat-rail-link.active,
.chat-rail-link:hover {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
}

.chat-rail-footer {
    margin-top: auto;
}

.chat-rail-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    overflow: hidden;
}

.chat-rail-backdrop {
    display: none;
}

.chat-rail-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-body {
    flex: 1;
    display: flex;
    min-width: 0;
}

.chat-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--bs-secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.chat-icon-btn:hover {
    background: var(--surface-1);
    color: var(--bs-primary);
}

.chat-icon-btn:disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ── Conversation list pane ───────────────────────────────── */

.chat-list-pane {
    width: 340px;
    flex-shrink: 0;
    border-right: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    background: var(--surface-0);
}

.chat-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem 0.5rem;
}

.is-mobile-app .chat-list-header {
    margin-top: 30px;
}

.chat-list-title {
    font-weight: 700;
    margin: 0;
}

.chat-list-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 1rem 0.75rem;
    padding: 0.4rem 0.75rem;
    background: var(--surface-1);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-pill);
}

.chat-list-search i {
    color: var(--bs-tertiary-color);
    font-size: 0.85rem;
}

.chat-list-search input {
    border: none;
    background: transparent;
    font-size: 0.82rem;
    flex: 1;
    outline: none;
}

.chat-list-scroll {
    flex: 1;
    overflow-y: auto;
}

.chat-list-skeleton-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 1rem;
}

.chat-list-empty {
    text-align: center;
    color: var(--bs-secondary-color);
    padding: 3rem 1.5rem;
}

.chat-list-empty i {
    font-size: 2rem;
    color: var(--bs-tertiary-color);
    margin-bottom: 0.5rem;
    display: block;
}

.chat-list-empty p {
    font-weight: 600;
    color: var(--bs-body-color);
    margin: 0;
}

.chat-list-empty small {
    font-size: 0.78rem;
}

.chat-list-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.65rem 1rem;
    border: none;
    background: transparent;
    text-align: left;
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease;
}

.chat-list-item:hover {
    background: var(--surface-1);
}

.chat-list-item.is-active {
    background: var(--bs-primary-bg-subtle);
    border-left-color: var(--bs-primary);
}

.chat-list-item-avatar {
    position: relative;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}

.chat-list-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-presence-dot {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--presence-offline);
    border: 2px solid var(--surface-0);
}

.chat-presence-dot.is-online {
    background: var(--presence-online);
}

.chat-list-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.chat-list-item-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.chat-list-item-name {
    font-weight: 600;
    font-size: 0.88rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-list-item-time {
    font-size: 0.7rem;
    color: var(--bs-tertiary-color);
    flex-shrink: 0;
}

.chat-list-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.chat-list-item-preview {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-list-item-badge {
    background: var(--bs-primary);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: var(--bs-border-radius-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.35rem;
    flex-shrink: 0;
}

/* ── Thread pane ───────────────────────────────────────────── */

.chat-thread-pane {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bs-body-bg);
}

.chat-thread-empty,
.chat-thread-empty-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--bs-secondary-color);
    padding: 2rem;
}

.chat-thread-empty i {
    font-size: 3rem;
    color: var(--bs-primary-border-subtle);
    margin-bottom: 0.75rem;
}

.chat-thread-empty h6 {
    font-weight: 600;
    color: var(--bs-body-color);
}

.chat-thread-empty p {
    font-size: 0.85rem;
    max-width: 260px;
}

.chat-thread-empty-messages i {
    font-size: 1.75rem;
    color: var(--bs-tertiary-color);
    margin-bottom: 0.35rem;
}

.chat-thread-empty-messages p {
    font-size: 0.85rem;
    margin: 0;
}

.chat-thread {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-thread-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 1.1rem;
    background: var(--surface-0);
    border-bottom: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}

/* Same reasoning as .chat-list-header above — keeps the call/delete icons
   from landing under the status bar/notch in the wrapped app. */
.is-mobile-app .chat-thread-header {
    margin-top: 30px;
}

.chat-thread-header-identity {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    border: none;
    background: transparent;
    padding: 0;
    text-align: left;
    min-width: 0;
    flex: 1;
}

.chat-thread-header-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
}

.chat-thread-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-thread-header-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-thread-header-name {
    font-weight: 600;
    font-size: 0.92rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-thread-header-status {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}

.chat-thread-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
}

.chat-thread-messages-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.chat-thread-loading {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-thread-loading-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 1.1rem;
    background: var(--surface-0);
    border-bottom: 1px solid var(--bs-border-color);
}

.chat-thread-loading-body {
    flex: 1;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-bubble-skeleton {
    height: 38px;
    border-radius: var(--bubble-radius);
}

.chat-bubble-skeleton-in {
    align-self: flex-start;
}

.chat-bubble-skeleton-out {
    align-self: flex-end;
}

/* ── Message bubbles ───────────────────────────────────────── */

.chat-message-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
    max-width: 72%;
}

.chat-message-row.is-grouped {
    margin-top: -0.05rem;
}

.chat-message-row:not(.is-grouped) {
    margin-top: 0.6rem;
}

.chat-message-row.is-theirs {
    align-self: flex-start;
}

.chat-message-row.is-mine {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}

.chat-message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-message-bubble {
    position: relative;
    background: var(--bubble-in-bg);
    color: var(--bubble-in-color);
    border-radius: var(--bubble-radius);
    padding: 0.5rem 0.75rem;
    box-shadow: var(--shadow-xs);
    min-width: 0;
}

.chat-message-row.is-mine .chat-message-bubble {
    background: var(--bubble-out-bg);
    color: var(--bubble-out-color);
}

.chat-message-sender {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--bs-primary);
    margin-bottom: 0.15rem;
}

.chat-message-text {
    font-size: 0.87rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-message-deleted {
    font-size: 0.82rem;
    font-style: italic;
    color: var(--bs-tertiary-color);
}

.chat-message-reply-quote {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    border-left: 3px solid var(--bs-primary);
    background: rgba(0, 0, 0, 0.04);
    border-radius: 0.35rem;
    padding: 0.3rem 0.55rem;
    margin-bottom: 0.35rem;
}

.chat-message-reply-sender {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--bs-primary);
}

.chat-message-reply-text {
    font-size: 0.76rem;
    color: var(--bs-secondary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem;
    margin-top: 0.2rem;
}

.chat-message-edited,
.chat-message-time {
    font-size: 0.66rem;
    color: var(--bs-tertiary-color);
}

.chat-message-meta i {
    font-size: 0.85rem;
    color: var(--bs-tertiary-color);
}

.chat-message-seen {
    color: var(--bs-primary) !important;
}

/* Optimistic send state — shown immediately on send(), before the server
   confirms. Slightly dimmed so it visibly reads as "in flight". */
.chat-message-row.is-pending .chat-message-bubble {
    opacity: 0.65;
}

.chat-message-pending-spinner {
    width: 0.7rem;
    height: 0.7rem;
    color: var(--bs-tertiary-color);
}

.chat-message-row.is-failed .chat-message-bubble {
    opacity: 1;
    background: var(--bs-danger-bg-subtle, #f8d7da);
}

.chat-message-failed-icon {
    color: var(--bs-danger);
    font-size: 0.85rem;
}

.chat-message-reactions {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.3rem;
}

.chat-message-reaction-pill {
    background: var(--surface-0);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-pill);
    font-size: 0.7rem;
    padding: 0.05rem 0.4rem;
    cursor: default;
}

.chat-message-actions {
    position: absolute;
    top: -1.6rem;
    right: 0;
    display: none;
    gap: 0.15rem;
    background: var(--surface-0);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-pill);
    padding: 0.15rem;
    box-shadow: var(--shadow-sm);
}

.chat-message-row.is-mine .chat-message-actions {
    right: auto;
    left: 0;
}

.chat-message-bubble:hover .chat-message-actions,
.chat-message-bubble.is-actions-open .chat-message-actions {
    display: flex;
}

.chat-message-action {
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: var(--bs-secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
}

.chat-message-action:hover {
    background: var(--surface-1);
    color: var(--bs-primary);
}

/* ── Attachments ───────────────────────────────────────────── */

.chat-attachment-grid {
    display: grid;
    gap: 3px;
    border-radius: 0.6rem;
    overflow: hidden;
    margin-bottom: 0.35rem;
    max-width: 260px;
}

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

.chat-attachment-grid-2,
.chat-attachment-grid-3,
.chat-attachment-grid-4 {
    grid-template-columns: 1fr 1fr;
}

.chat-attachment-image {
    position: relative;
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
}

.chat-attachment-grid-1 .chat-attachment-image {
    aspect-ratio: 4 / 3;
}

.chat-attachment-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chat-attachment-image[data-more]::after {
    content: attr(data-more);
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-attachment-documents {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
    min-width: 220px;
}

.chat-attachment-document {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    background: var(--surface-1);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.6rem;
    text-decoration: none;
    color: inherit;
}

.chat-attachment-document:hover {
    border-color: var(--bs-primary-border-subtle);
}

.chat-attachment-document-icon {
    width: 34px;
    height: 34px;
    border-radius: 0.5rem;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-attachment-document-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.chat-attachment-document-name {
    font-size: 0.8rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-attachment-document-size {
    font-size: 0.68rem;
    color: var(--bs-tertiary-color);
}

.chat-attachment-document-download {
    color: var(--bs-tertiary-color);
    flex-shrink: 0;
}

/* ── Typing indicator ──────────────────────────────────────── */

.chat-typing-bubble {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.65rem 0.85rem;
}

.chat-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--bs-tertiary-color);
    animation: chat-typing-bounce 1.2s infinite;
}

.chat-typing-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.chat-typing-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes chat-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* ── Composer ──────────────────────────────────────────────── */

.chat-composer {
    background: var(--surface-0);
    border-top: 1px solid var(--bs-border-color);
    padding: 0.65rem 1rem;
    flex-shrink: 0;
    padding-bottom: calc(0.65rem + env(safe-area-inset-bottom));
}

.chat-reply-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: var(--surface-1);
    border-left: 3px solid var(--bs-primary);
    border-radius: 0.4rem;
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.5rem;
}

.chat-reply-banner-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-reply-banner-sender {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--bs-primary);
}

.chat-reply-banner-text {
    font-size: 0.76rem;
    color: var(--bs-secondary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-attach-preview {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.15rem;
}

.chat-attach-preview-item {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 0.5rem;
    overflow: hidden;
    background: var(--surface-1);
    border: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}

.chat-attach-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-attach-preview-doc {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    font-size: 0.6rem;
    padding: 0.2rem;
    text-align: center;
    overflow: hidden;
}

.chat-attach-preview-doc i {
    font-size: 1.1rem;
    color: var(--bs-primary);
}

.chat-attach-preview-doc span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.chat-attach-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
}

.chat-composer-form {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.chat-composer-input {
    flex: 1;
    resize: none;
    border: 1px solid var(--bs-border-color);
    border-radius: 1.25rem;
    padding: 0.5rem 0.9rem;
    font-size: 0.87rem;
    max-height: 140px;
    background: var(--surface-1);
    outline: none;
    line-height: 1.4;
    font-family: inherit;
}

.chat-composer-input:focus {
    border-color: var(--bs-primary);
    background: var(--surface-0);
}

.chat-composer-input:disabled {
    background: var(--surface-1);
    color: var(--bs-secondary-color);
    opacity: 0.75;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bs-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
}

.chat-send-btn:disabled {
    background: var(--bs-tertiary-color);
    opacity: 0.6;
}

/* ── New chat modal ────────────────────────────────────────── */

.new-chat-picked {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.6rem;
}

.new-chat-chip {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    border-radius: var(--bs-border-radius-pill);
    padding: 0.2rem 0.3rem 0.2rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 500;
}

.new-chat-chip button {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
}

.new-chat-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--surface-1);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-pill);
    margin-bottom: 0.6rem;
}

.new-chat-search i {
    color: var(--bs-tertiary-color);
    font-size: 0.85rem;
}

.new-chat-search input {
    border: none;
    background: transparent;
    font-size: 0.83rem;
    flex: 1;
    outline: none;
}

.new-chat-results {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-sm);
}

.new-chat-results-empty {
    padding: 1.25rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}

.new-chat-contact {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.5rem 0.7rem;
    border: none;
    border-bottom: 1px solid var(--bs-border-color-translucent);
    background: transparent;
    text-align: left;
    cursor: pointer;
    margin: 0;
}

.new-chat-contact:last-child {
    border-bottom: none;
}

.new-chat-contact:hover {
    background: var(--surface-1);
}

.new-chat-contact-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
    overflow: hidden;
}

.new-chat-contact-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.new-chat-contact-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.new-chat-contact-name {
    font-size: 0.82rem;
    font-weight: 500;
}

.new-chat-contact-username {
    font-size: 0.7rem;
    color: var(--bs-tertiary-color);
}

.new-chat-contact-picked {
    color: var(--bs-primary);
    flex-shrink: 0;
}

/* ── Responsive: mobile single-pane ───────────────────────── */

@media (max-width: 991.98px) {
    .chat-rail {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 240px;
        flex-direction: column;
        align-items: stretch;
        padding: 1rem 0.75rem;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: var(--shadow-md);
        z-index: 1045;
    }

    .chat-rail.is-open {
        transform: translateX(0);
    }

    .chat-rail-brand-row {
        padding: 0 0.35rem;
    }

    .is-mobile-app .chat-rail-brand-row {
        margin-top: 30px;
    }

    .chat-rail-brand-name {
        display: block;
    }

    .chat-rail-nav {
        flex-direction: column;
        align-items: stretch;
    }

    .chat-rail-link {
        width: 100%;
        justify-content: flex-start;
        gap: 0.6rem;
        padding: 0 0.75rem;
    }

    .chat-rail-link-label {
        display: inline;
        font-size: 0.85rem;
        font-weight: 500;
    }

    .chat-rail-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(20, 30, 24, 0.35);
        z-index: 1040;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }

    .chat-rail-backdrop.is-visible {
        opacity: 1;
        visibility: visible;
    }

    .chat-list-pane {
        width: 100%;
    }

    .chat-list-pane.is-hidden-mobile {
        display: none;
    }

    .chat-thread-pane {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 1030;
    }

    .chat-thread-pane.is-visible-mobile {
        display: flex;
    }

    .chat-message-row {
        max-width: 85%;
    }
}

/* ── Standalone chat-shell pages (e.g. profile) ───────────────── */

.chat-page-pane {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bs-body-bg);
    overflow-y: auto;
}

.chat-page-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 1.1rem;
    background: var(--surface-0);
    border-bottom: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}

.chat-page-title {
    font-weight: 600;
    margin: 0;
}

.chat-page-body {
    flex: 1;
    padding: 1.5rem 1.25rem;
    display: flex;
    justify-content: center;
}

.chat-page-card {
    width: 100%;
    max-width: 460px;
    background: var(--surface-0);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--shadow-xs);
    padding: 1.75rem;
    height: fit-content;
}

/* ── Group info panel ─────────────────────────────────────── */

.group-info-identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.4rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.group-info-photo {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    overflow: hidden;
}

.group-info-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.group-info-photo-edit {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bs-primary);
    color: #fff;
    border: 2px solid var(--surface-0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.group-info-name-form {
    display: flex;
    gap: 0.4rem;
    width: 100%;
    max-width: 260px;
}

.group-info-add-member {
    margin-bottom: 1.25rem;
}

.group-info-members {
    display: flex;
    flex-direction: column;
}

.group-info-member-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-sm);
    overflow: hidden;
}

.group-info-member {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
}

.group-info-member:last-child {
    border-bottom: none;
}

/* ── Audio/video calling overlay ───────────────────────────── */

.call-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: linear-gradient(160deg, #0f2f22, #06140f);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.call-overlay-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
    padding: 2rem;
}

.call-overlay-avatar {
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 600;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.call-overlay-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.call-overlay-name {
    font-weight: 600;
    margin: 0;
}

.call-overlay-status {
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 1.5rem;
}

.call-overlay-actions {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.call-action-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
}

.call-action-accept {
    background: #1fa855;
}

.call-action-decline {
    background: #e5484d;
}

.call-action-mute {
    background: rgba(255, 255, 255, 0.15);
}

.call-action-mute.is-muted {
    background: #fff;
    color: #111;
}

/* ── Video call layout ─────────────────────────────────────── */

.call-remote-video {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.call-overlay.is-video-call .call-remote-video {
    display: block;
}

.call-overlay.is-video-call .call-overlay-avatar {
    display: none;
}

.call-overlay.is-video-call .call-overlay-inner {
    position: relative;
    z-index: 1;
    justify-content: flex-end;
    height: 100%;
    padding-bottom: 3rem;
}

.call-overlay.is-video-call .call-overlay-name,
.call-overlay.is-video-call .call-overlay-status {
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.call-local-video-wrap {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 100px;
    height: 140px;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    z-index: 2;
    background: #000;
}

.call-local-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.call-local-video.is-mirrored {
    transform: scaleX(-1);
}

/* ── TEMPORARY call debug panel (remove once calling is confirmed) ──── */

.call-debug-panel {
    position: fixed;
    bottom: 90px;
    right: 12px;
    z-index: 3000;
}

.call-debug-toggle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: #222;
    color: #fff;
    font-size: 1.1rem;
    box-shadow: var(--shadow-md);
}

.call-debug-log {
    position: absolute;
    bottom: 50px;
    right: 0;
    width: min(90vw, 380px);
    max-height: 50vh;
    overflow-y: auto;
    background: #111;
    color: #ddd;
    font-family: monospace;
    font-size: 0.72rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-md);
}

.call-debug-row {
    padding: 0.15rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    word-break: break-word;
}

.call-debug-success {
    color: #6fd88a;
}

.call-debug-error {
    color: #ff8a8a;
}

.call-debug-info {
    color: #9fc7ff;
}
