/* [Chat Design System Stylesheet] Written by Antigravity */
/* Short explanation: High-end Obsidian-Cyan dark theme with glassmorphism, electric brand accents, 
   smooth responsive layouts, animated message feeds, and light/dark theme support matching SkyDrive. */

:root {
    /* Base Obsidian Void Surfaces */
    --bg-base: #080b11;
    --bg-surface: #0e1422;
    --bg-surface-elevated: #151d2f;
    --bg-card: rgba(18, 26, 44, 0.72);
    --bg-card-hover: rgba(26, 38, 64, 0.88);
    --bg-glass: rgba(14, 20, 34, 0.85);

    /* Subtle Borders & Focus Rings */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(56, 189, 248, 0.4);
    --border-strong: rgba(255, 255, 255, 0.16);
    --border-focus: rgba(56, 189, 248, 0.65);

    /* Electric Cyan & Brand Accents */
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-light: #38bdf8;
    --primary-glow: rgba(56, 189, 248, 0.28);
    --primary-gradient: linear-gradient(135deg, #38bdf8 0%, #3b82f6 50%, #8b5cf6 100%);
    --accent-gradient: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 100%);

    /* Message Bubbles */
    --bubble-me: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    --bubble-them: #151d2f;
    --bubble-border: rgba(255, 255, 255, 0.06);

    /* Text Colors */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-faint: #64748b;
    --danger: #f43f5e;
    --success: #10b981;
    --warning: #f59e0b;

    /* Typography */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Interactive State Helpers */
    --bg-hover-subtle: rgba(255, 255, 255, 0.08);
    --nav-active-bg: rgba(2, 132, 199, 0.16);
    --nav-active-text: #e0f2fe;
    --nav-active-border: rgba(56, 189, 248, 0.35);

    /* Layout & Dimensions */
    --sidebar-width: 250px;
    --header-height: 60px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;

    /* Transitions & Shadows */
    --shadow-soft: 0 12px 36px -10px rgba(0, 0, 0, 0.65);
    --shadow-glow: 0 0 30px -5px rgba(56, 189, 248, 0.22);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* [Daylight Light Theme Support] Written by Antigravity */
/* Short explanation: High-contrast daylight theme tokens when data-theme="light" is applied */
[data-theme="light"] {
    --bg-base: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.94);
    --bg-card-hover: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.88);
    --border-subtle: rgba(15, 23, 42, 0.08);
    --border-hover: rgba(2, 132, 199, 0.4);
    --border-strong: rgba(15, 23, 42, 0.14);
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-faint: #94a3b8;
    --bg-hover-subtle: rgba(15, 23, 42, 0.05);
    --nav-active-bg: rgba(2, 132, 199, 0.1);
    --nav-active-text: #0284c7;
    --nav-active-border: rgba(2, 132, 199, 0.3);
    --bubble-me: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    --bubble-them: #e2e8f0;
    --bubble-border: rgba(0, 0, 0, 0.04);
}

/* Base Resets */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    width: 100%;
    font-family: var(--font-body);
    background-color: var(--bg-base);
    color: var(--text-main);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* App Container Layout */
.chat-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at top right, rgba(2, 132, 199, 0.08), transparent 45%),
                radial-gradient(circle at bottom left, rgba(56, 189, 248, 0.05), transparent 40%),
                var(--bg-base);
}

/* ==========================================================================
   [Universal Top Navigation Bar] Written by Antigravity
   Short explanation: Full-width universal header unifying Chat with SkyDrive
   and OmniChat AI with brand, ecosystem tabs, active room title, and profile.
   ========================================================================== */
.universal-top-bar {
    height: 60px;
    min-height: 60px;
    background: var(--bg-glass);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    position: relative;
    box-sizing: border-box;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.universal-top-bar .brand-wrap {
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    color: inherit;
}

.universal-top-bar .brand-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: var(--shadow-glow);
    flex-shrink: 0;
}

/* Matching SaaS Brand App Icon (SkyDrive / Nexus Point / OmniChat) */
.brand-app-icon {
    display: inline-block;
    vertical-align: middle;
    object-fit: cover;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 16px rgba(56, 189, 248, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}
.brand-app-icon:hover {
    transform: scale(1.04);
}
.brand-app-icon.lg {
    width: 68px;
    height: 68px;
    border-radius: 18px;
    margin-bottom: 6px;
}
.brand-app-icon.sm {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.logo-badge {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
}

.universal-top-bar .brand-text h1 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
    margin: 0;
}

.universal-top-bar .brand-text span {
    font-size: 0.65rem;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

/* [Universal Ecosystem Navigation Tabs] Written by Antigravity */
/* Short explanation: Cohesive top navigation tabs matching SkyDrive and OmniChat AI */
.universal-nav-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.04);
    padding: 3px 4px;
    border-radius: 9px;
    border: 1px solid var(--border-subtle);
    margin-left: 6px;
    flex-shrink: 0;
}

.universal-nav-tabs .nav-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 7px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    transition: var(--transition-fast);
    border: 1px solid transparent;
    white-space: nowrap;
    flex-shrink: 0;
}

.universal-nav-tabs .nav-tab span {
    white-space: nowrap;
}

.universal-nav-tabs .nav-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
}

.universal-nav-tabs .nav-tab.active {
    color: var(--primary-light);
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.28);
    font-weight: 600;
}

/* App-Specific Palette Accents on Active Tab matching Logo Colors */
.universal-nav-tabs .nav-tab.active[data-app="skydrive"],
.universal-nav-tabs .nav-tab.active[href="/"] {
    color: #38bdf8 !important;
    background: rgba(56, 189, 248, 0.15) !important;
    border-color: rgba(56, 189, 248, 0.35) !important;
    box-shadow: 0 0 12px -2px rgba(56, 189, 248, 0.25);
}
.universal-nav-tabs .nav-tab.active[data-app="chat"],
.universal-nav-tabs .nav-tab.active[href="/chat"],
.universal-nav-tabs .nav-tab.active[href="/chat/"] {
    color: #34d399 !important;
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(52, 211, 153, 0.35) !important;
    box-shadow: 0 0 12px -2px rgba(16, 185, 129, 0.25);
}
.universal-nav-tabs .nav-tab.active[data-app="ai"],
.universal-nav-tabs .nav-tab.active[href="/ai"],
.universal-nav-tabs .nav-tab.active[href="/ai/"] {
    color: #c084fc !important;
    background: rgba(139, 92, 246, 0.16) !important;
    border-color: rgba(192, 132, 252, 0.38) !important;
    box-shadow: 0 0 12px -2px rgba(139, 92, 246, 0.25);
}
.universal-nav-tabs .nav-tab.active[data-app="docs"],
.universal-nav-tabs .nav-tab.active[href="/docs"],
.universal-nav-tabs .nav-tab.active[href="/docs/"] {
    color: #60a5fa !important;
    background: rgba(37, 99, 235, 0.18) !important;
    border-color: rgba(96, 165, 250, 0.38) !important;
    box-shadow: 0 0 12px -2px rgba(37, 99, 235, 0.28);
}
.universal-nav-tabs .nav-tab.active[data-app="calendar"],
.universal-nav-tabs .nav-tab.active[href="/calendar"],
.universal-nav-tabs .nav-tab.active[href="/calendar/"] {
    color: #22d3ee !important;
    background: rgba(6, 182, 212, 0.16) !important;
    border-color: rgba(34, 211, 238, 0.38) !important;
    box-shadow: 0 0 12px -2px rgba(6, 182, 212, 0.25);
}
.universal-nav-tabs .nav-tab.active[data-app="gallery"],
.universal-nav-tabs .nav-tab.active[href="/gallery"],
.universal-nav-tabs .nav-tab.active[href="/gallery/"] {
    color: #f472b6 !important;
    background: rgba(236, 72, 153, 0.16) !important;
    border-color: rgba(244, 114, 182, 0.38) !important;
    box-shadow: 0 0 12px -2px rgba(236, 72, 153, 0.25);
}

.universal-nav-tabs .nav-tab-icon {
    flex-shrink: 0;
}

.top-bar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    max-width: 500px;
    padding: 0 14px;
}

.top-bar-center .header-room-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-bar-center .room-title-wrap h2 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

.top-bar-center .room-desc-truncate {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    padding: 4px 10px 4px 5px;
    border-radius: 20px;
}

.topbar-user-pill .profile-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-card);
}

.topbar-user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.topbar-user-meta .profile-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
}

.topbar-user-meta .topbar-user-handle {
    font-size: 0.68rem;
    color: var(--text-faint);
}

.topbar-user-pill .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-faint);
}

.topbar-user-pill .status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.45);
}

.universal-top-bar .icon-btn-sm {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.universal-top-bar .icon-btn-sm:hover {
    color: var(--text-main);
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

/* Chat Body Layout */
.chat-body-layout {
    flex: 1;
    display: flex;
    height: calc(100vh - 60px);
    position: relative;
    overflow: hidden;
}

.sidebar-drawer-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-drawer-header .drawer-title {
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--text-main);
    font-size: 0.95rem;
}

/* ==========================================================================
   Left Navigation Sidebar
   ========================================================================== */
.chat-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    height: 100%;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 20;
    transition: transform var(--transition);
}

/* Universal App Switcher Dropdown */
.app-switcher {
    position: relative;
}

.switcher-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.switcher-btn:hover {
    color: var(--text-main);
    border-color: var(--border-hover);
}

.switcher-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 6px;
    min-width: 180px;
    box-shadow: var(--shadow-soft);
    display: none;
    flex-direction: column;
    z-index: 100;
}

.switcher-menu.active {
    display: flex;
}

.switcher-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
}

.switcher-item:hover {
    background: rgba(56, 189, 248, 0.12);
    color: var(--primary-light);
}

/* User Profile Badge Card */
.sidebar-profile {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.015);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--primary);
    background: var(--bg-surface-elevated);
    flex-shrink: 0;
}

.profile-meta {
    overflow: hidden;
}

.profile-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.74rem;
    color: var(--success);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.profile-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-btn-sm {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.icon-btn-sm:hover {
    color: var(--text-main);
    background: var(--bg-surface-elevated);
}

/* Search and Filter Input */
.sidebar-search {
    padding: 14px 14px 8px;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 7px 14px;
    gap: 8px;
    transition: var(--transition);
}

.search-bar:focus-within {
    border-color: var(--primary-light);
    background: var(--bg-surface-elevated);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 13px;
    width: 100%;
}

.search-bar input::placeholder {
    color: var(--text-faint);
}

/* Scrollable Channel & DM Lists */
.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px 16px 10px;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 10px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-faint);
}

.section-add-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.section-add-btn:hover {
    color: var(--primary-light);
    background: rgba(56, 189, 248, 0.1);
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--bg-hover-subtle);
    color: var(--text-main);
    border-color: var(--border-subtle);
}

.nav-item.active {
    background: var(--nav-active-bg);
    color: var(--nav-active-text);
    border-color: var(--nav-active-border);
    font-weight: 600;
}

.nav-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.nav-item-icon {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--primary-light);
    width: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item-avatar {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}

.nav-item-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.88rem;
}

.nav-item-badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-glow);
}

/* ==========================================================================
   Center Main Chat Workspace
   ========================================================================== */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    background: var(--bg-base);
}

/* Workspace Header */
.chat-header {
    height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}

.header-room-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.mobile-toggle-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.room-title-wrap h2 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.room-title-wrap p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.header-room-badges {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-tag {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--primary-light);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Scrollable Messages Stream */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Date Divider */
.date-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 12px 0;
}

.date-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-subtle);
}

.date-divider span {
    position: relative;
    background: var(--bg-surface-elevated);
    padding: 4px 14px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-faint);
    border: 1px solid var(--border-subtle);
}

/* Message Item */
.message-row {
    display: flex;
    gap: 14px;
    animation: fadeIn 0.25s ease-out;
}

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

.message-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
    margin-top: 2px;
}

.message-content-wrap {
    flex: 1;
    max-width: 82%;
}

.message-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.message-author {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-main);
}

.message-username {
    font-size: 0.75rem;
    color: var(--text-faint);
}

.message-time {
    font-size: 0.72rem;
    color: var(--text-faint);
    margin-left: auto;
}

.message-bubble {
    background: var(--bubble-them);
    border: 1px solid var(--bubble-border);
    padding: 10px 14px;
    border-radius: 4px 16px 16px 16px;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-main);
    word-break: break-word;
}

.message-row.is-me {
    flex-direction: row-reverse;
}

.message-row.is-me .message-content-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message-row.is-me .message-bubble {
    background: var(--bubble-me);
    border-radius: 16px 4px 16px 16px;
    color: #ffffff;
    box-shadow: 0 4px 18px rgba(2, 132, 199, 0.28);
}

/* Inline Code and Code Blocks in Messages */
.message-bubble code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: rgba(0, 0, 0, 0.35);
    padding: 2px 6px;
    border-radius: 4px;
}

.message-bubble pre {
    background: #0b0f19;
    border: 1px solid var(--border-subtle);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 8px 0;
}

.message-bubble pre code {
    background: transparent;
    padding: 0;
}

/* Bottom Chat Input Form */
.chat-input-area {
    padding: 16px 28px 20px 28px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
}

.input-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: var(--transition);
}

.input-card:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 16px var(--primary-glow);
}

.input-textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.94rem;
    line-height: 1.45;
    resize: none;
    min-height: 24px;
    max-height: 160px;
}

.input-textarea::placeholder {
    color: var(--text-faint);
}

.input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* [Input Left Attachment Tools] Written by Antigravity */
/* Short explanation: Styles the SkyDrive attach button and draft attachment preview badge in the chat input card */
.input-left-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.attach-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
}

.attach-btn:hover {
    color: var(--primary-light);
    border-color: var(--primary);
    background: rgba(2, 132, 199, 0.12);
}

/* [Draft Drive Attachment Preview Chip] Written by Antigravity */
/* Short explanation: Preview chip shown above input textarea when a file from SkyDrive is attached */
.draft-attachment-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(2, 132, 199, 0.14);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    margin-bottom: 4px;
    animation: fadeIn 0.2s ease-out;
}

.draft-att-left {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.draft-att-icon {
    font-size: 1rem;
}

.draft-att-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

.draft-att-size {
    font-size: 0.75rem;
    color: var(--primary-light);
    font-family: var(--font-mono);
}

.draft-att-remove-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 4px;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.draft-att-remove-btn:hover {
    color: var(--danger);
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-hint {
    font-size: 0.72rem;
    color: var(--text-faint);
}

.send-btn {
    background: var(--primary-gradient);
    border: none;
    color: #ffffff;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    box-shadow: var(--shadow-glow);
}

.send-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

/* ==========================================================================
   Modals (Group Creation, DM Search, Auth)
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 14, 0.78);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-backdrop.active {
    display: flex;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 65vh;
    overflow-y: auto;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input, .form-group textarea {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.form-group input:focus, .form-group textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 12px var(--primary-glow);
}

.user-select-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.user-select-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.user-select-item:hover {
    border-color: var(--border-hover);
    background: rgba(56, 189, 248, 0.08);
}

.user-select-item.selected {
    border-color: var(--primary);
    background: rgba(2, 132, 199, 0.16);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    color: var(--text-main);
    background: var(--bg-surface-elevated);
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    color: #fff;
    padding: 8px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    opacity: 0.92;
}

/* Tabs for Auth Modal */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 16px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}

.auth-tab.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary-light);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* ========================================================================== */
/* [Mobile & Responsive Layout System] Written by Antigravity                 */
/* Short explanation: Fluid layout adaptability for mobile screens (<=820px   */
/* and <=480px) with off-canvas sidebar drawer, backdrop blur overlay,        */
/* compact chat header, touch-friendly reactions, and optimized input area.   */
/* ========================================================================== */

/* Desktop defaults for mobile-only controls */
.chat-sidebar-backdrop {
    display: none;
}
.sidebar-close-btn.mobile-only {
    display: none;
}

@media (max-width: 820px) {
    /* [Mobile Off-Canvas Drawer] Written by Antigravity */
    /* Short explanation: Fixed slide-out drawer on mobile screens with smooth transition */
    .chat-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 285px;
        max-width: 84vw;
        height: 100vh;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: none;
    }
    .chat-sidebar.open {
        transform: translateX(0);
        box-shadow: 6px 0 32px rgba(0, 0, 0, 0.65);
    }
    .sidebar-close-btn.mobile-only {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        background: transparent;
        border: none;
        color: var(--text-muted);
        cursor: pointer;
        border-radius: var(--radius-sm);
        margin-left: auto;
        transition: color var(--transition-fast), background var(--transition-fast);
    }
    .sidebar-close-btn.mobile-only:hover,
    .sidebar-close-btn.mobile-only:active {
        color: var(--text-main);
        background: var(--bg-hover-subtle);
    }

    /* [Mobile Sidebar Backdrop] Written by Antigravity */
    /* Short explanation: Blurred backdrop overlay that dismisses sidebar drawer on tap */
    .chat-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.65);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 195;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .chat-sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Header Compact Layout */
    .chat-header {
        padding: 0 12px;
        height: 56px;
        gap: 8px;
    }
    .mobile-toggle-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: var(--radius-sm);
        margin-right: 4px;
        flex-shrink: 0;
    }
    .room-title-wrap {
        overflow: hidden;
        min-width: 0;
        flex: 1;
    }
    .room-title-wrap h2 {
        font-size: 15px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .room-title-wrap p {
        font-size: 11.5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Mobile Chat Input Area */
    .chat-input-area {
        padding: 8px 10px;
    }
    .input-card {
        padding: 8px 12px;
        border-radius: 16px;
    }
    #attach-drive-btn span {
        display: none; /* Hide button text, keep paperclip icon on mobile */
    }
    #attach-drive-btn {
        padding: 6px 10px;
    }
    #btn-send-message {
        padding: 7px 16px;
        font-size: 13px;
    }

    /* Messages & Mobile Reactions */
    .messages-container {
        padding: 12px 10px;
    }
    .message-bubble-wrap {
        max-width: 88%;
    }
    /* Touch-friendly reactions without requiring mouse hover */
    .message-reaction-trigger {
        opacity: 0.55;
        pointer-events: auto;
    }
    .message-row:hover .message-reaction-trigger,
    .message-reaction-trigger:active {
        opacity: 1;
    }
    .reaction-picker-popover {
        max-width: calc(100vw - 32px);
    }

    /* Responsive DM request banner */
    .dm-request-banner {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }
    .dm-request-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Extra-Small Mobile Screens (<= 480px) */
@media (max-width: 480px) {
    .message-bubble-wrap {
        max-width: 95%;
    }
    .modal-card {
        width: calc(100% - 20px) !important;
        margin: 10px auto !important;
        padding: 18px 14px !important;
    }
    .header-room-badges {
        display: none;
    }
    .attachment-card {
        max-width: 100%;
    }
}

/* ==========================================================================
   [Message Reactions & Actions] Written by Antigravity
   Short explanation: Message hover reaction trigger, floating reaction picker popover,
   and interactive reaction counter pills below message bubbles.
   ========================================================================== */
.message-bubble-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.message-row:hover .message-reaction-trigger {
    opacity: 1;
    pointer-events: auto;
}

.message-reaction-trigger {
    position: absolute;
    top: -12px;
    right: 8px;
    opacity: 0;
    pointer-events: none;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-hover);
    color: var(--text-muted);
    border-radius: var(--radius-full);
    padding: 3px 8px;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: var(--transition);
    z-index: 5;
}

.message-row.is-me .message-reaction-trigger {
    right: auto;
    left: 8px;
}

.message-reaction-trigger:hover {
    color: var(--primary-light);
    transform: scale(1.08);
}

/* Floating Reaction Picker Popover */
.reaction-picker-popover {
    position: fixed;
    z-index: 2000;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-full);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px var(--primary-glow);
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: popoverIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popoverIn {
    from { opacity: 0; transform: scale(0.85) translateY(4px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.reaction-pick-btn {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 3px;
    border-radius: 6px;
    transition: transform 0.15s ease;
}

.reaction-pick-btn:hover {
    transform: scale(1.3);
}

/* Reaction Pills */
.reaction-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.reaction-pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 2px 8px;
    font-size: 0.76rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.reaction-pill:hover {
    border-color: var(--primary);
    background: rgba(2, 132, 199, 0.12);
    color: var(--text-main);
}

.reaction-pill.reacted {
    background: rgba(2, 132, 199, 0.2);
    border-color: var(--primary-light);
    color: var(--primary-light);
    font-weight: 600;
}

.reaction-pill .reaction-count {
    font-size: 0.72rem;
    font-weight: 600;
}

/* ==========================================================================
   [Message Attachment Cards] Written by Antigravity
   Short explanation: Rich cards rendering attached Drive files inside the chat message stream.
   ========================================================================== */
.message-attachments {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.attachment-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    text-decoration: none;
    color: var(--text-main);
    transition: var(--transition);
    max-width: 380px;
}

.attachment-card:hover {
    border-color: var(--primary-light);
    background: rgba(2, 132, 199, 0.15);
    transform: translateY(-1px);
}

.attachment-icon {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attachment-info {
    flex: 1;
    overflow: hidden;
}

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

.attachment-meta {
    font-size: 0.74rem;
    color: var(--text-faint);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.attachment-download-icon {
    color: var(--primary-light);
    opacity: 0.7;
    transition: var(--transition);
}

.attachment-card:hover .attachment-download-icon {
    opacity: 1;
    transform: translateY(2px);
}

/* [Attachment Fallback Card Styling] Written by Antigravity */
/* Short explanation: Styled notification card displayed when an attached file cannot be loaded or was moved in Drive */
.attachment-fallback-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px dashed rgba(245, 158, 11, 0.35);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    max-width: 380px;
    margin: 4px 0;
}

.attachment-fallback-card .fallback-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.attachment-fallback-card .fallback-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.attachment-fallback-card .fallback-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-fallback-card .fallback-desc {
    font-size: 0.72rem;
    color: #f59e0b;
}

/* ==========================================================================
   [SkyDrive File Picker Modal Styles] Written by Antigravity
   Short explanation: Modal allowing user to browse and select personal files from SkyDrive.
   ========================================================================== */
.modal-card-lg {
    max-width: 620px;
}

.modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-icon-badge {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: rgba(2, 132, 199, 0.18);
    border: 1px solid rgba(56, 189, 248, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

/* File Picker Search Bar */
.drive-search-bar-wrap {
    margin-bottom: 10px;
}
.drive-search-input-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.drive-search-input-box:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}
.drive-search-icon {
    position: absolute;
    left: 10px;
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0.8;
}
.drive-search-input {
    width: 100%;
    padding: 8px 32px 8px 34px;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
}
.drive-search-input::placeholder {
    color: var(--text-faint);
}
.drive-search-clear-btn {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-faint);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    transition: var(--transition);
}
.drive-search-clear-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
}
.drive-item-location {
    font-size: 0.72rem;
    color: var(--text-faint);
    margin-left: 6px;
}

.drive-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 0.82rem;
    overflow-x: auto;
}

.drive-crumb {
    color: var(--primary-light);
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.drive-crumb:hover {
    text-decoration: underline;
}

.drive-crumb-separator {
    color: var(--text-faint);
}

.drive-browser-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 340px;
    overflow-y: auto;
    padding-right: 4px;
}

.drive-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: var(--transition);
}

.drive-item:hover {
    border-color: var(--primary-light);
    background: rgba(2, 132, 199, 0.12);
}

.drive-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.drive-item-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.drive-item-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drive-item-meta {
    font-size: 0.75rem;
    color: var(--text-faint);
    white-space: nowrap;
}

/* ==========================================================================
   [Recipient Search Autocomplete Styles (Matched to File Sharing)] Written by Antigravity
   Short explanation: Exact visual match of SkyDrive's recipient search box with @ prefix,
   glowing green selection, clear button, and suggestions dropdown.
   ========================================================================== */
.recipient-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.recipient-input-prefix {
    position: absolute;
    left: 12px;
    color: var(--primary-light);
    font-weight: 700;
    font-family: var(--font-mono);
    pointer-events: none;
    font-size: 14px;
}

#dm-recipient-input, #group-member-input, #group-settings-add-input {
    width: 100%;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    border-radius: var(--radius-md);
    padding: 10px 32px 10px 28px;
    font-size: 13px;
    font-family: var(--font-body);
    outline: none;
    transition: var(--transition);
}

#dm-recipient-input:focus, #group-member-input:focus, #group-settings-add-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

#dm-recipient-input.has-selection {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}

.recipient-clear-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition);
}

.recipient-clear-btn:hover {
    color: var(--text-main);
}

.recipient-suggestions-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6);
    max-height: 180px;
    overflow-y: auto;
    z-index: 1050;
    padding: 4px 0;
}

.recipient-suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background var(--transition);
}

.recipient-suggestion-item:hover,
.recipient-suggestion-item.active {
    background: rgba(2, 132, 199, 0.2);
}

.recipient-suggestion-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--primary-gradient);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.recipient-suggestion-name {
    font-size: 13px;
    color: var(--text-main);
    font-weight: 500;
}

.recipient-match-highlight {
    color: #38bdf8;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.field-hint {
    font-size: 0.75rem;
    color: var(--text-faint);
    margin-top: 4px;
}

.field-hint.recipient-selected-hint {
    color: #34d399 !important;
    font-weight: 500;
}

/* Selected Members Chips Container (Group Chat) */
.member-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    min-height: 32px;
}

.member-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(2, 132, 199, 0.18);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: var(--radius-full);
    padding: 3px 8px 3px 4px;
    font-size: 0.78rem;
    color: var(--text-main);
    animation: fadeIn 0.15s ease-out;
}

.member-chip-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

.member-chip-name {
    font-weight: 600;
}

.member-chip-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.15s ease;
}

.member-chip-remove:hover {
    color: var(--danger);
}

/* ==========================================================================
   [Empty Chat Workspace State] Written by Antigravity
   Short explanation: Modern welcoming empty state when no conversation is active.
   ========================================================================== */
.empty-chat-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    padding: 40px 20px;
    animation: fadeIn 0.3s ease-out;
}

.empty-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
    background: rgba(2, 132, 199, 0.12);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(56, 189, 248, 0.25);
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.12);
}

.empty-chat-state h3 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.empty-chat-state p {
    font-size: 0.88rem;
    color: var(--text-muted);
    max-width: 360px;
    margin-bottom: 24px;
    line-height: 1.5;
}

.empty-actions {
    display: flex;
    gap: 12px;
}

/* ==========================================================================
   [Message Request Confirmation Banner & Spam Protection UI] Written by Antigravity
   Short explanation: Styling for the first-time message request banner, action buttons
   (accept, decline, block), message reporting triggers, and request pending notices.
   ========================================================================== */
.dm-request-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(217, 119, 6, 0.06));
    border-bottom: 1px solid rgba(245, 158, 11, 0.35);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    animation: fadeIn 0.25s ease-out;
}

.dm-request-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.4));
}

.dm-request-info {
    flex: 1;
}

.dm-request-info h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fbbf24;
    margin-bottom: 4px;
}

.dm-request-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
}

.dm-request-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-request-accept, .btn-request-decline, .btn-request-block {
    padding: 7px 14px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-request-accept {
    background: #10b981;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

.btn-request-accept:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-request-decline {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-subtle);
    color: var(--text-main);
}

.btn-request-decline:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--border-hover);
}

.btn-request-block {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.btn-request-block:hover {
    background: #ef4444;
    color: #ffffff;
    transform: translateY(-1px);
}

/* Pending banner for sender / read-only indicator */
.dm-pending-sender-notice {
    margin: 12px 24px;
    padding: 10px 16px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Report Abuse Trigger Button on Message Hover */
.message-report-btn {
    background: none;
    border: none;
    color: var(--text-faint);
    cursor: pointer;
    padding: 3px 6px;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease, background 0.15s ease;
    opacity: 0;
    pointer-events: none;
}

.message-row:hover .message-report-btn {
    opacity: 0.7;
    pointer-events: auto;
}

.message-report-btn:hover {
    opacity: 1 !important;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Locked attachment indicator */
.attachment-card-locked {
    opacity: 0.6;
    cursor: not-allowed !important;
    border-style: dashed;
}

.attachment-card-locked:hover {
    transform: none !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    background: rgba(0, 0, 0, 0.25) !important;
}

/* ==========================================================================
   [Save to Drive Attachment Action Button] Written by Antigravity
   Short explanation: Button inside chat attachment cards allowing users to save shared files to personal SkyDrive with one click.
   ========================================================================== */
.attachment-main-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    flex: 1;
    overflow: hidden;
}

.attachment-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    flex-shrink: 0;
}

.attachment-save-btn {
    background: rgba(2, 132, 199, 0.16);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: var(--primary-light);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
}

.attachment-save-btn:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    transform: translateY(-1px);
}

.attachment-dl-btn {
    color: var(--primary-light);
    opacity: 0.8;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.attachment-dl-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

/* ==========================================================================
   [RCS/iMessage-Style Rich Media Preview System] Written by Antigravity
   Short explanation: Complete CSS for inline image thumbnails, embedded video players,
   styled audio players, Open Graph link preview cards, fullscreen image lightbox,
   typing indicators, and device media upload button — matching Google Messages and iMessage UX.
   ========================================================================== */

/* ---- Inline Media Wrappers & Expand Buttons ---- */
.media-preview-container {
    position: relative;
    display: inline-block;
    margin-top: 8px;
    max-width: 100%;
}

.media-expand-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
    z-index: 10;
}

.media-preview-container:hover .media-expand-btn {
    opacity: 1;
}

.media-expand-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

/* [Media Preview Image] Written by Antigravity */
/* Short explanation: Renders image attachments as rounded thumbnails inside message bubbles
   with smooth loading fade-in, hover scale, and cursor pointer for lightbox expansion. */
.media-preview-image {
    max-width: 360px;
    max-height: 320px;
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    cursor: pointer;
    object-fit: cover;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--bubble-border);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.4s ease;
    opacity: 0;
    animation: mediaFadeIn 0.5s ease forwards;
}

.media-preview-image:hover {
    transform: scale(1.015);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
}

/* [iMessage bubble image containment] Written by Antigravity */
/* Short explanation: Images that are the only content get tighter bubble padding like iMessage */
.message-bubble.media-only {
    padding: 4px;
    background: transparent;
    border: none;
    box-shadow: none;
}

.message-row.is-me .message-bubble.media-only {
    background: transparent;
    box-shadow: none;
}

@keyframes mediaFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

/* ---- Inline Video Player ---- */
/* [Media Preview Video] Written by Antigravity */
/* Short explanation: Renders video attachments with native browser controls (play, pause, volume, seek, fullscreen)
   inside message bubbles. Rounded corners, dark background, max 400px width. */
.media-preview-video {
    max-width: 400px;
    max-height: 340px;
    width: 100%;
    border-radius: var(--radius-md);
    background: #000;
    border: 1px solid var(--bubble-border);
    outline: none;
    animation: mediaFadeIn 0.5s ease forwards;
}

.media-preview-video:focus {
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* ---- Styled Audio Player (iMessage Voice Message Style) ---- */
/* [Media Audio Player] Written by Antigravity */
/* Short explanation: Custom audio player wrapper resembling iMessage voice message bubbles —
   pill-shaped container with play/pause button, progress bar, time indicator, and waveform dots. */
.media-audio-player {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 16px;
    margin-top: 8px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.1), rgba(59, 130, 246, 0.08));
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 20px;
    max-width: 360px;
    animation: mediaFadeIn 0.5s ease forwards;
}

.audio-main-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.audio-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 0 4px;
}

.audio-control-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}

.audio-control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.audio-play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-gradient);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.3);
}

.audio-play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(2, 132, 199, 0.45);
}

.audio-play-btn:active {
    transform: scale(0.95);
}

.audio-progress-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

/* [Audio Waveform Visualizer Dots] Written by Antigravity */
/* Short explanation: Decorative waveform-style dots above the progress bar to mimic iMessage voice messages. */
.audio-waveform {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 18px;
    overflow: hidden;
}

.audio-waveform-bar {
    width: 3px;
    border-radius: 2px;
    background: var(--primary-light);
    opacity: 0.4;
    transition: height 0.15s ease, opacity 0.15s ease;
}

.audio-waveform-bar.active {
    opacity: 1;
    background: var(--primary-light);
}

.audio-progress-bar {
    width: 100%;
    height: 4px;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.audio-progress-bar::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-light);
    box-shadow: 0 0 6px var(--primary-glow);
    cursor: pointer;
}

.audio-progress-bar::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-light);
    border: none;
    cursor: pointer;
}

.audio-time-display {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--text-faint);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ---- Open Graph Link Preview Cards ---- */
/* [Link Preview Card] Written by Antigravity */
/* Short explanation: Rich card for Open Graph web link previews — horizontal layout with thumbnail image,
   title, description, site favicon/name, accent border-left, and hover lift effect. Matches iMessage/RCS link bubbles. */
.link-preview-card {
    display: flex;
    gap: 0;
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--bubble-border);
    border-left: 3px solid var(--primary-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    max-width: 420px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    text-decoration: none;
    color: inherit;
    animation: mediaFadeIn 0.4s ease forwards;
}

.link-preview-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    border-color: var(--primary-light);
}

.link-preview-image {
    width: 120px;
    min-height: 90px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.3);
}

.link-preview-body {
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    flex: 1;
}

.link-preview-site {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-preview-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.link-preview-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Fullscreen Image Lightbox ---- */
/* [Image Lightbox Overlay] Written by Antigravity */
/* Short explanation: Full-screen dark overlay with centered image for iMessage-style tap-to-expand viewing.
   Backdrop blur, zoom-in animation, close-on-click, Escape key close. */
.media-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: lightboxFadeIn 0.25s ease-out;
}

.media-lightbox.active {
    display: flex;
}

.media-lightbox-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 40px;
}

.media-lightbox-content img,
.media-lightbox-content video {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: lightboxZoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.media-lightbox-content .media-audio-player {
    transform: scale(1.5);
    transform-origin: center;
}

.lightbox-audio-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 60px;
    animation: lightboxZoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.album-art-preview {
    width: 240px;
    height: 240px;
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.album-art-preview svg {
    z-index: 2;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.album-art-preview::after {
    content: '';
    position: absolute;
    inset: -50%;
    background: conic-gradient(from 0deg, transparent 0%, rgba(255,255,255,0.1) 25%, transparent 50%, rgba(0,0,0,0.1) 75%, transparent 100%);
    animation: albumSpin 8s linear infinite;
    animation-play-state: paused;
}

.album-art-preview.playing::after {
    animation-play-state: running;
}

.album-art-preview.playing {
    transform: scale(1.05);
}

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

.media-lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.3rem;
    transition: background 0.15s ease, transform 0.15s ease;
    z-index: 10000;
}

.media-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

/* [Lightbox Footer & Actions] Written by Antigravity */
/* Short explanation: Footer container in lightbox holding filename and action buttons */
.media-lightbox-footer {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 0 20px;
}

.media-lightbox-filename {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    padding: 8px 18px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    white-space: nowrap;
    max-width: 80vw;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.media-lightbox-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

@keyframes lightboxFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes lightboxZoomIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

/* ---- Typing Indicator ---- */
/* [Typing Indicator Bubble] Written by Antigravity */
/* Short explanation: Three-dot bounce animation showing "User is typing..." in the chat feed,
   inspired by iMessage's pulsating ellipsis indicator. */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    animation: fadeIn 0.3s ease-out;
}

.typing-indicator-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.typing-indicator-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bubble-them);
    border: 1px solid var(--bubble-border);
    border-radius: 16px;
    padding: 10px 16px;
}

.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    40% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

.typing-indicator-name {
    font-size: 0.75rem;
    color: var(--text-faint);
    font-style: italic;
}

/* ---- Device Media Upload Button ---- */
/* [Media Attach Button] Written by Antigravity */
/* Short explanation: Camera/gallery upload button in the chat input area, styled to match
   existing SkyDrive attach button and emoji row. */
.media-attach-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
}

.media-attach-btn:hover {
    color: var(--primary-light);
    border-color: var(--primary);
    background: rgba(2, 132, 199, 0.12);
}

/* [Media Upload Progress Indicator] Written by Antigravity */
/* Short explanation: Small progress bar shown during file upload to SkyDrive */
.media-upload-progress {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(2, 132, 199, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    animation: fadeIn 0.2s ease-out;
}

.media-upload-progress.active {
    display: flex;
}

.upload-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

.upload-progress-text {
    font-size: 0.72rem;
    color: var(--primary-light);
    font-weight: 600;
    white-space: nowrap;
}

/* ---- Light Theme Overrides for Rich Media ---- */
/* [Light Theme Rich Media Adjustments] Written by Antigravity */
/* Short explanation: Ensures all rich media components render correctly in light mode */
[data-theme="light"] .media-preview-image {
    border-color: rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .media-audio-player {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.08), rgba(59, 130, 246, 0.05));
    border-color: rgba(2, 132, 199, 0.2);
}

[data-theme="light"] .link-preview-card {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .link-preview-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .audio-progress-bar {
    background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .typing-indicator-dots {
    background: #e2e8f0;
}

[data-theme="light"] .media-lightbox {
    background: rgba(255, 255, 255, 0.92);
}

[data-theme="light"] .media-lightbox-close {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.15);
    color: #0f172a;
}

[data-theme="light"] .media-lightbox-filename {
    background: rgba(255, 255, 255, 0.8);
    color: #0f172a;
}

/* ---- Mobile Responsive Rich Media ---- */
/* [Mobile Rich Media Adjustments] Written by Antigravity */
/* Short explanation: Constrains media previews to fit mobile viewports */
@media (max-width: 820px) {
    .media-preview-image {
        max-width: 280px;
        max-height: 260px;
    }
    .media-preview-video {
        max-width: 300px;
        max-height: 260px;
    }
    .media-audio-player {
        max-width: 280px;
        padding: 8px 12px;
        gap: 8px;
    }
    .audio-play-btn {
        width: 32px;
        height: 32px;
    }
    .link-preview-card {
        max-width: 300px;
        flex-direction: column;
    }
    .link-preview-image {
        width: 100%;
        height: 120px;
        min-height: auto;
    }
    .media-lightbox-close {
        top: 12px;
        right: 12px;
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 480px) {
    .media-preview-image {
        max-width: 220px;
        max-height: 200px;
    }
    .media-preview-video {
        max-width: 240px;
        max-height: 220px;
    }
    .media-audio-player {
        max-width: 220px;
        padding: 6px 10px;
        min-width: 200px;
    }
    .link-preview-card {
        max-width: 240px;
    }
    .media-attach-btn span {
        display: none; /* Icon only on small screens */
    }
}

/* ---- Metadata Panel ---- */
/* [File Metadata Panel] Written by Antigravity */
/* Short explanation: Display panel for rich file metadata (artist, album, resolution, size) extracted via ffprobe */
.metadata-panel {
    margin-top: 6px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    animation: fadeIn 0.3s ease;
}

[data-theme='dark'] .metadata-panel {
    background: rgba(255, 255, 255, 0.04);
}

.metadata-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.metadata-label {
    font-weight: 600;
    color: var(--text-main);
}

/* ==========================================================================
   [Mobile Responsive & Viewport Enhancements] Written by Antigravity
   Short explanation: Prevents top-bar-right from being pushed off-screen on tablet/mobile,
   hides universal nav tabs on mobile screens, collapses profile handle, and prevents input toolbar crowding.
   ========================================================================== */

/* Responsive Universal Navigation Tabs: Collapse text to icon-only sooner */
@media (max-width: 1500px) {
    .universal-nav-tabs .nav-tab span {
        display: none !important;
    }

    .universal-nav-tabs .nav-tab {
        padding: 5px 9px !important;
        gap: 0 !important;
        justify-content: center !important;
    }

    .universal-nav-tabs .nav-tab-icon {
        width: 15px !important;
        height: 15px !important;
    }
}

/* Tablet (max-width: 820px) top bar adjustments */
@media (max-width: 820px) {
    .universal-top-bar {
        padding: 0 10px;
        gap: 6px;
        overflow: hidden;
    }
    .top-bar-left {
        gap: 6px;
        flex-shrink: 0;
    }
    .universal-nav-tabs .nav-tab span {
        display: none; /* Icon-only tabs on tablet */
    }
    .universal-nav-tabs .nav-tab {
        padding: 5px 8px;
    }
    .top-bar-center {
        padding: 0 8px;
        min-width: 0;
        flex: 1 1 auto;
        justify-content: flex-start;
    }
    .top-bar-center .room-title-wrap {
        min-width: 0;
        max-width: 100%;
    }
    .top-bar-center .room-title-wrap h2,
    .top-bar-center .room-desc-truncate {
        max-width: 100%;
    }
    .top-bar-right {
        margin-left: auto;
        flex-shrink: 0;
        gap: 6px;
    }
    .topbar-user-pill .topbar-user-meta {
        display: none; /* Hide username/handle text, keep avatar */
    }
    .topbar-user-pill {
        padding: 4px;
    }
}

/* Mobile (max-width: 540px) top bar adjustments */
@media (max-width: 540px) {
    .universal-nav-tabs {
        display: flex !important;
        margin-left: 2px !important;
        padding: 2px 2px !important;
        gap: 2px !important;
    }
    .universal-nav-tabs .nav-tab {
        padding: 4px 6px !important;
    }
    .universal-nav-tabs .nav-tab-icon {
        width: 13px !important;
        height: 13px !important;
    }
    .universal-top-bar .brand-text span {
        display: none !important;
    }
    .top-bar-center .room-desc-truncate {
        display: none; /* Hide subtitle on tiny screens */
    }
    .top-bar-right .signout-btn {
        display: none; /* Accessible in drawer */
    }
    .chat-input-actions .input-hint {
        display: none !important; /* Hide 'Markdown & code supported' tip so buttons don't collide */
    }
    .chat-input-actions {
        gap: 6px;
    }
}

@media (max-width: 420px) {
    .universal-top-bar .brand-text {
        display: none !important;
    }
}

/* [Sent Message Bubble Timestamp Contrast] Written by Antigravity */
/* Short explanation: Ensures high contrast on timestamps in both light and dark themes */
[data-theme="light"] .message-row.is-me .message-time {
    color: #64748b;
}

/* [Sidebar Drawer Footer Styling] Written by Antigravity */
/* Short explanation: Positions and styles mobile theme toggle and signout at bottom of drawer */
.sidebar-drawer-footer {
    display: none;
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    gap: 8px;
    background: var(--bg-surface);
}
@media (max-width: 820px) {
    .sidebar-drawer-footer.mobile-only {
        display: flex;
    }
}
.drawer-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}
.drawer-action-btn:hover {
    color: var(--text-main);
    background: var(--bg-hover-subtle);
}
.drawer-action-btn.danger:hover {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   Group Chat Settings, Profile Photo & System Notifications
   ========================================================================== */

/* Header Room Avatar & Settings Trigger */
.header-room-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-room-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 1.5px solid var(--border-subtle);
    background: var(--bg-surface-elevated);
    flex-shrink: 0;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.header-room-avatar:hover {
    transform: scale(1.05);
    border-color: var(--primary-light);
}

.room-title-wrap {
    cursor: pointer;
}

.header-room-badges {
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-settings-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(6, 182, 212, 0.1);
    color: var(--primary-light);
    border: 1px solid rgba(6, 182, 212, 0.25);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.group-settings-btn:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--primary-light);
    color: #fff;
    transform: translateY(-1px);
}

/* Sidebar Group Avatar Thumbnail */
.nav-item-avatar.group-avatar-thumb {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

/* System Message Notifications in Chat Feed */
.message-row.system-message-row {
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 8px 0;
    padding: 0;
    animation: fadeIn 0.25s ease-out;
}

.system-message-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: 9999px;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.4;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
    max-width: 90%;
    text-align: center;
}

[data-theme="light"] .system-message-pill {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--text-muted);
}

.system-message-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
}

.system-message-text {
    font-weight: 500;
    color: var(--text-main);
}

.system-message-time {
    font-size: 0.72rem;
    color: var(--text-faint);
    margin-left: 4px;
    white-space: nowrap;
}

/* Group Settings Modal */
.modal-card.group-settings-card {
    max-width: 540px;
    width: 100%;
}

.group-settings-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: calc(85vh - 140px);
    overflow-y: auto;
    padding-right: 4px;
}

/* Group Avatar & Branding */
.group-settings-avatar-section {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

[data-theme="light"] .group-settings-avatar-section {
    background: rgba(0, 0, 0, 0.015);
}

.group-avatar-preview-wrap {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--primary-light);
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.2);
    cursor: pointer;
}

.group-settings-avatar-large {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.group-avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #fff;
    opacity: 0;
    transition: opacity var(--transition-fast);
    font-size: 0.7rem;
    font-weight: 600;
}

.group-avatar-preview-wrap:hover .group-avatar-overlay {
    opacity: 1;
}

.group-avatar-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.btn-sm-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    width: fit-content;
}

.btn-sm-action:hover {
    border-color: var(--primary-light);
    background: var(--bg-hover-subtle);
    color: var(--primary-light);
}

.btn-sm-action.btn-sm-danger {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.25);
    background: rgba(239, 68, 68, 0.05);
}

.btn-sm-action.btn-sm-danger:hover {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Info Form */
.group-settings-info-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.input-save-group {
    display: flex;
    gap: 8px;
}

.input-save-group input {
    flex: 1;
}

.btn-save-name {
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Members Section */
.group-settings-members-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 1px solid var(--border-subtle);
    padding-top: 16px;
}

.section-subhead {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.section-subhead h4 {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-main);
}

.subhead-hint {
    font-size: 0.76rem;
    color: var(--text-faint);
}

.group-members-roster {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 6px;
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .group-members-roster {
    background: rgba(0, 0, 0, 0.02);
}

.group-member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.group-member-item:hover {
    background: var(--bg-hover-subtle);
}

.group-member-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.group-member-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}

.group-member-names {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.group-member-display {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-member-handle {
    font-size: 0.74rem;
    color: var(--text-faint);
}

.group-member-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 6px;
}

.member-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.member-badge.creator {
    background: rgba(6, 182, 212, 0.15);
    color: var(--primary-light);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.member-badge.you {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
}

[data-theme="light"] .member-badge.you {
    background: rgba(0, 0, 0, 0.06);
}

.btn-remove-member {
    padding: 4px 10px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--danger);
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-remove-member:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--danger);
}

.group-settings-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-leave-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-leave-group:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* SkyDrive Parity Header Action Buttons                                       */
/* ═══════════════════════════════════════════════════════════════════════════ */
.primary-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-fast, 0.15s ease);
    box-shadow: 0 2px 8px var(--primary-glow);
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.primary-btn.sm {
    padding: 6px 14px;
    font-size: 12px;
}

.secondary-btn {
    background: var(--bg-surface-elevated);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-fast, 0.15s ease);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.secondary-btn.sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* Desktop Shell Integration (Electron)                                       */
/* ═══════════════════════════════════════════════════════════════════════════ */
html.is-desktop-app .brand-wrap,
body.is-desktop-app .brand-wrap,
html.is-desktop-app .universal-nav-tabs,
body.is-desktop-app .universal-nav-tabs,
html.is-desktop-app #topbar-user-pill,
body.is-desktop-app #topbar-user-pill,
html.is-desktop-app .signout-btn,
body.is-desktop-app .signout-btn,
html.is-desktop-app .theme-toggle-btn,
body.is-desktop-app .theme-toggle-btn {
    display: none !important;
}

html.is-desktop-app .top-bar-left,
body.is-desktop-app .top-bar-left {
    padding-left: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* WebRTC Voice & Video Call Styles                                            */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* Topbar Header Call Action Buttons */
.call-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(56, 189, 248, 0.25);
    background: rgba(56, 189, 248, 0.08);
    color: var(--primary-light);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.call-header-btn:hover {
    background: rgba(56, 189, 248, 0.18);
    border-color: rgba(56, 189, 248, 0.5);
    box-shadow: 0 0 12px var(--primary-glow);
    transform: translateY(-1px);
}

.call-header-btn:active {
    transform: translateY(0);
}

/* Incoming Call Modal */
.call-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 11, 17, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeInCallModal 0.25s ease-out;
}

.incoming-call-card {
    position: relative;
    width: 320px;
    padding: 32px 24px 28px;
    background: var(--bg-card);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px var(--primary-glow);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.incoming-avatar-wrap {
    position: relative;
    width: 88px;
    height: 88px;
    margin-bottom: 16px;
}

.incoming-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-light);
    box-shadow: 0 0 20px var(--primary-glow);
}

.incoming-call-type-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 28px;
    height: 28px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 2px solid var(--bg-surface);
}

.incoming-call-pulse-ring {
    position: absolute;
    top: 20px;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    border: 2px solid var(--primary-light);
    opacity: 0.8;
    animation: pulseRing 1.8s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
    pointer-events: none;
}

@keyframes pulseRing {
    0% { transform: scale(0.85); opacity: 0.9; }
    50% { transform: scale(1.3); opacity: 0.3; }
    100% { transform: scale(1.6); opacity: 0; }
}

.incoming-call-card h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.incoming-call-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.incoming-call-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    background: rgba(56, 189, 248, 0.12);
    color: var(--primary-light);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-bottom: 26px;
    animation: blinkText 1.4s infinite alternate;
}

@keyframes blinkText {
    from { opacity: 0.7; }
    to { opacity: 1; }
}

.incoming-call-actions {
    display: flex;
    gap: 36px;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.call-btn-circle {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
}

.call-btn-decline {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

.call-btn-decline:hover {
    transform: scale(1.12);
    box-shadow: 0 6px 22px rgba(239, 68, 68, 0.6);
}

.call-btn-accept {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
    animation: ringBounce 1s infinite alternate;
}

.call-btn-accept:hover {
    transform: scale(1.12);
    box-shadow: 0 6px 22px rgba(16, 185, 129, 0.6);
}

@keyframes ringBounce {
    0% { transform: scale(1); }
    100% { transform: scale(1.08); }
}

/* Active Call Modal Overlay (Full / Theater) */
.active-call-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 13, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 24px;
    animation: fadeInCallModal 0.25s ease-out;
}

.active-call-card {
    position: relative;
    width: 100%;
    max-width: 960px;
    height: 85vh;
    max-height: 720px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Topbar in Call Card */
.active-call-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: rgba(14, 20, 34, 0.65);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(8px);
    z-index: 10;
}

.active-call-peer-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.call-topbar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.active-call-peer-meta h4 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.active-call-subtext {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.call-timer {
    font-family: var(--font-mono);
    color: var(--primary-light);
    font-weight: 600;
}

.call-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.call-action-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.call-action-icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-main);
    transform: translateY(-1px);
}

/* Stage View (Audio / Video) */
.active-call-stage {
    flex: 1;
    position: relative;
    background: #020408;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Audio Call Stage */
.audio-stage-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.audio-avatar-pulse-container {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.audio-stage-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-light);
    box-shadow: 0 0 30px var(--primary-glow);
    z-index: 2;
}

.audio-pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--primary-light);
    pointer-events: none;
}

.audio-pulse-ring.ring-1 {
    animation: audioPulse 2.4s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.audio-pulse-ring.ring-2 {
    animation: audioPulse 2.4s cubic-bezier(0.215, 0.61, 0.355, 1) infinite 1.2s;
}

@keyframes audioPulse {
    0% { transform: scale(0.85); opacity: 0.8; }
    50% { transform: scale(1.35); opacity: 0.25; }
    100% { transform: scale(1.7); opacity: 0; }
}

.audio-stage-content h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.audio-stage-note {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Video Stage */
.video-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #000;
}

.remote-video-feed {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.pip-video-wrap {
    position: absolute;
    bottom: 24px;
    right: 24px;
    width: 190px;
    height: 130px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border-hover);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    background: #111;
    z-index: 5;
    transition: transform 0.2s ease;
}

.pip-video-wrap:hover {
    transform: scale(1.03);
}

.local-video-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror self video */
}

.pip-label {
    position: absolute;
    bottom: 6px;
    left: 8px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.65);
    padding: 2px 6px;
    border-radius: 4px;
    color: #fff;
}

/* Bottom Call Control Bar */
.active-call-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 18px 24px;
    background: rgba(14, 20, 34, 0.8);
    border-top: 1px solid var(--border-subtle);
    backdrop-filter: blur(12px);
    z-index: 10;
}

.call-ctl-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 68px;
    height: 64px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
}

.call-ctl-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--border-strong);
    transform: translateY(-2px);
}

.call-ctl-btn.active-off {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.call-ctl-btn.active-screen {
    background: rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.5);
    color: var(--primary-light);
}

.ctl-label {
    font-size: 0.72rem;
    font-weight: 500;
}

.call-ctl-hangup {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    border-color: #ef4444 !important;
    color: #fff !important;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

.call-ctl-hangup:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

/* Floating Minimized Pill */
.floating-call-pill {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-full);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px var(--primary-glow);
    z-index: 9999;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
    user-select: none;
    animation: slideUpPill 0.3s ease-out;
}

.floating-call-pill:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.75), 0 0 26px var(--primary-glow);
}

.pill-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light);
}

.pill-info {
    display: flex;
    flex-direction: column;
}

.pill-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pill-timer {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--primary-light);
}

.pill-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 6px;
}

.pill-icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.pill-icon-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: scale(1.1);
}

.pill-icon-btn.active-off {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.4);
}

.pill-hangup-btn {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: #fff !important;
}

.pill-hangup-btn:hover {
    background: #dc2626 !important;
}

@keyframes fadeInCallModal {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

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

@media (max-width: 768px) {
    .active-call-overlay {
        padding: 0;
    }
    .active-call-card {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
    .pip-video-wrap {
        bottom: 16px;
        right: 16px;
        width: 120px;
        height: 90px;
    }
    .active-call-controls {
        gap: 10px;
        padding: 12px 16px;
    }
    .call-ctl-btn {
        width: 58px;
        height: 56px;
    }
}

/* ==========================================================================
   NovaDocs (.ndml) Document Preview System
   ========================================================================== */

/* ---- Inline Message Document Preview Card ---- */
.ndml-preview-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 440px;
    background: var(--bg-card, #1e293b);
    border: 1px solid rgba(52, 211, 153, 0.28);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.ndml-preview-card:hover {
    border-color: rgba(52, 211, 153, 0.55);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35), 0 0 15px rgba(52, 211, 153, 0.15);
}

.ndml-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(52, 211, 153, 0.08);
    border-bottom: 1px solid rgba(52, 211, 153, 0.15);
    gap: 10px;
}

.ndml-card-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.ndml-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(52, 211, 153, 0.18);
    color: #34d399;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.ndml-card-filename {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main, #f8fafc);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ndml-card-size {
    font-size: 0.75rem;
    color: var(--text-faint, #94a3b8);
    white-space: nowrap;
}

/* Document Mini-Sheet Snippet Preview in Message */
.ndml-card-sheet-preview {
    position: relative;
    padding: 16px 20px;
    background: #ffffff;
    color: #0f172a;
    min-height: 140px;
    max-height: 190px;
    overflow: hidden;
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 0.85rem;
    line-height: 1.5;
    cursor: pointer;
    user-select: none;
}

.ndml-card-sheet-preview h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
    line-height: 1.25;
}

.ndml-card-sheet-preview h2, .ndml-card-sheet-preview h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    margin-top: 8px;
    margin-bottom: 4px;
}

.ndml-card-sheet-preview p {
    margin-bottom: 6px;
    color: #334155;
}

.ndml-card-sheet-preview blockquote {
    border-left: 3px solid #38bdf8;
    padding-left: 8px;
    margin: 6px 0;
    color: #475569;
    font-style: italic;
    background: #f8fafc;
}

.ndml-card-sheet-preview card, .ndml-card-sheet-preview .card {
    display: block;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 10px;
    margin: 6px 0;
    font-size: 0.8rem;
}

.ndml-card-sheet-preview table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    margin: 6px 0;
}

.ndml-card-sheet-preview th, .ndml-card-sheet-preview td {
    border: 1px solid #cbd5e1;
    padding: 4px 6px;
}

.ndml-card-sheet-preview th {
    background: #f1f5f9;
}

/* Gradient fade at bottom of snippet */
.ndml-card-sheet-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.95) 80%, #ffffff 100%);
    pointer-events: none;
}

/* Hover overlay on snippet */
.ndml-card-sheet-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 5;
}

.ndml-card-sheet-preview:hover .ndml-card-sheet-overlay {
    opacity: 1;
}

.ndml-sheet-overlay-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(15, 23, 42, 0.88);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.4);
    border-radius: 9999px;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    transform: scale(0.95);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ndml-card-sheet-preview:hover .ndml-sheet-overlay-btn {
    transform: scale(1);
}

/* Card Action Toolbar */
.ndml-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-surface, #1e293b);
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    flex-wrap: wrap;
}

.ndml-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.18s ease;
    border: 1px solid transparent;
}

.ndml-action-btn-primary {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.3);
}

.ndml-action-btn-primary:hover {
    background: #34d399;
    color: #0f172a;
    border-color: #34d399;
    box-shadow: 0 2px 8px rgba(52, 211, 153, 0.3);
}

.ndml-action-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main, #e2e8f0);
    border-color: rgba(255, 255, 255, 0.1);
}

.ndml-action-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Drive Picker Preview Button */
.drive-item-preview-btn {
    padding: 2px 8px;
    font-size: 0.72rem;
    border-radius: 4px;
    background: rgba(52, 211, 153, 0.14);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.25);
    cursor: pointer;
    transition: all 0.15s ease;
}

.drive-item-preview-btn:hover {
    background: #34d399;
    color: #0f172a;
}

/* Draft Chip Preview Button */
.draft-att-preview-btn {
    padding: 2px 6px;
    font-size: 0.7rem;
    border-radius: 4px;
    background: rgba(52, 211, 153, 0.18);
    color: #34d399;
    border: none;
    cursor: pointer;
    margin-left: 4px;
    font-weight: 600;
}

.draft-att-preview-btn:hover {
    background: #34d399;
    color: #0f172a;
}

/* ---- Fullscreen NovaDocs Document Reader Modal ---- */
.doc-preview-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(11, 15, 25, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    animation: lightboxFadeIn 0.2s ease-out;
}

.doc-preview-modal-backdrop.active {
    display: flex;
}

.doc-preview-container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    background: #0b0f19;
    position: relative;
    overflow: hidden;
}

/* Reader Top Bar */
.doc-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    height: 56px;
    background: #131b2e;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    gap: 16px;
    z-index: 20;
    flex-shrink: 0;
}

.doc-preview-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.doc-preview-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.28);
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.doc-preview-title {
    font-size: 1rem;
    font-weight: 600;
    color: #f8fafc;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

.doc-preview-pages-indicator {
    font-size: 0.78rem;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.doc-preview-header-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-preview-zoom-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.06);
    padding: 3px 6px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.doc-zoom-btn {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: #e2e8f0;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.doc-zoom-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.doc-zoom-level {
    font-size: 0.8rem;
    font-weight: 600;
    color: #cbd5e1;
    min-width: 44px;
    text-align: center;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
}

.doc-zoom-level:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #34d399;
}

.doc-zoom-fit-btn {
    padding: 3px 8px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.doc-zoom-fit-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

.doc-preview-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.doc-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.doc-action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

.doc-action-btn.doc-action-primary {
    background: #0284c7;
    color: #ffffff;
    border-color: #38bdf8;
}

.doc-action-btn.doc-action-primary:hover {
    background: #0369a1;
    box-shadow: 0 2px 10px rgba(56, 189, 248, 0.3);
}

.doc-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    margin-left: 4px;
}

.doc-close-btn:hover {
    background: #ef4444;
    color: #ffffff;
}

/* Scrollable Document Canvas Viewport */
.doc-preview-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    background: #0f172a;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 16px 80px 16px;
    scroll-behavior: smooth;
}

.doc-preview-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.15s ease-out;
    transform-origin: top center;
}

.doc-preview-canvas {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    width: 100%;
}

/* Letter Sheet Styling (.ndml-page) */
.ndml-page {
    background: #ffffff;
    color: #0f172a;
    width: 816px;
    min-height: 1056px;
    padding: 72px; /* 1-inch margins */
    box-sizing: border-box;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.2);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 11pt;
    line-height: 1.8;
    word-break: break-word;
    position: relative;
    user-select: text;
}

/* Page Break Dividers */
.ndml-page-break {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 816px;
    margin: -16px 0 -16px 0;
    user-select: none;
    position: relative;
}

.ndml-page-break::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    border-top: 1px dashed rgba(148, 163, 184, 0.4);
}

.ndml-page-break-badge {
    position: relative;
    z-index: 2;
    background: #1e293b;
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 12px;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Page Number in Bottom-Right Corner */
.ndml-page-footer-num {
    position: absolute;
    bottom: 24px;
    right: 72px;
    font-size: 9pt;
    color: #94a3b8;
    font-weight: 500;
}

/* Page Typography */
.ndml-page h1 {
    font-size: 24pt;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.25;
    color: #0f172a;
}

.ndml-page h2 {
    font-size: 18pt;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 12px;
    line-height: 1.3;
    color: #1e293b;
}

.ndml-page h3 {
    font-size: 14pt;
    font-weight: 600;
    margin-top: 16px;
    margin-bottom: 8px;
    line-height: 1.35;
    color: #334155;
}

.ndml-page h4 {
    font-size: 12pt;
    font-weight: 600;
    margin-top: 14px;
    margin-bottom: 6px;
    color: #475569;
}

.ndml-page p {
    margin-bottom: 12px;
}

.ndml-page blockquote {
    border-left: 4px solid #38bdf8;
    padding: 8px 16px;
    margin: 14px 0;
    color: #475569;
    background: #f8fafc;
    font-style: italic;
    border-radius: 0 6px 6px 0;
}

.ndml-page pre, .ndml-page code {
    font-family: 'JetBrains Mono', monospace;
    background: #f1f5f9;
    color: #0f172a;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 9.5pt;
}

.ndml-page pre {
    padding: 12px 16px;
    overflow-x: auto;
    margin: 14px 0;
    line-height: 1.5;
}

.ndml-page table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.ndml-page th, .ndml-page td {
    border: 1px solid #cbd5e1;
    padding: 8px 12px;
    text-align: left;
}

.ndml-page th {
    background: #f1f5f9;
    font-weight: 600;
    color: #0f172a;
}

.ndml-page ul, .ndml-page ol {
    margin-left: 28px;
    margin-bottom: 14px;
}

.ndml-page li {
    margin-bottom: 4px;
}

.ndml-page hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 20px 0;
}

.ndml-page img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* NovaDocs Custom Tags */
.ndml-page card, .ndml-page .card {
    display: block;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 18px;
    margin: 14px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ndml-page card[title]::before, .ndml-page .card[title]::before {
    content: attr(icon) " " attr(title);
    font-weight: 700;
    font-size: 1.05rem;
    display: block;
    margin-bottom: 6px;
    color: #0f172a;
}

.ndml-page note, .ndml-page .note {
    display: block;
    background: #eff6ff;
    border-left: 4px solid #38bdf8;
    border-radius: 0 6px 6px 0;
    padding: 12px 16px;
    margin: 14px 0;
    color: #1e40af;
    font-size: 10pt;
    line-height: 1.6;
}

.ndml-page warning, .ndml-page .warning {
    display: block;
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    border-radius: 0 6px 6px 0;
    padding: 12px 16px;
    margin: 14px 0;
    color: #92400e;
    font-size: 10pt;
    line-height: 1.6;
}

.ndml-page subtitle, .ndml-page .doc-subtitle {
    display: block;
    font-size: 13pt;
    color: #64748b;
    font-style: italic;
    margin-top: -6px;
    margin-bottom: 18px;
    line-height: 1.4;
}

.ndml-page grid, .ndml-page .grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin: 14px 0;
}

.ndml-page timeline, .ndml-page .timeline {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0;
    padding-left: 16px;
    border-left: 2px solid #38bdf8;
}

.ndml-page event, .ndml-page .event {
    display: block;
    font-size: 10pt;
    color: #334155;
    line-height: 1.5;
}

.ndml-page event[year]::before, .ndml-page .event[year]::before {
    content: attr(year) " — " attr(label);
    font-weight: 600;
    color: #0284c7;
    display: block;
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    #doc-preview-modal, #doc-preview-canvas, #doc-preview-canvas * {
        visibility: visible;
    }
    #doc-preview-modal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100% !important;
        background: #ffffff !important;
        padding: 0 !important;
    }
    .doc-preview-header, .ndml-page-break, .doc-preview-footer-num {
        display: none !important;
    }
    .doc-preview-body {
        padding: 0 !important;
        background: #ffffff !important;
        overflow: visible !important;
    }
    .ndml-page {
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0.75in !important;
        page-break-after: always;
        break-after: page;
        border-radius: 0 !important;
    }
}

/* Light Theme overrides for Reader Modal */
[data-theme="light"] .doc-preview-container {
    background: #f1f5f9;
}

[data-theme="light"] .doc-preview-header {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .doc-preview-title {
    color: #0f172a;
}

[data-theme="light"] .doc-preview-pages-indicator {
    background: #f1f5f9;
    color: #64748b;
}

[data-theme="light"] .doc-preview-zoom-bar {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

[data-theme="light"] .doc-zoom-btn {
    color: #334155;
}

[data-theme="light"] .doc-zoom-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

[data-theme="light"] .doc-zoom-level {
    color: #1e293b;
}

[data-theme="light"] .doc-action-btn {
    background: #f8fafc;
    color: #334155;
    border-color: #cbd5e1;
}

[data-theme="light"] .doc-action-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

[data-theme="light"] .doc-close-btn {
    background: #f1f5f9;
    color: #64748b;
}

[data-theme="light"] .doc-preview-body {
    background: #e2e8f0;
}

[data-theme="light"] .ndml-page-break-badge {
    background: #e2e8f0;
    color: #475569;
    border-color: #cbd5e1;
}

/* ---- Format Badge Variants ---- */
.ndml-badge.badge-md {
    background: rgba(168, 85, 247, 0.18);
    color: #c084fc;
}
.ndml-badge.badge-rtf {
    background: rgba(236, 72, 153, 0.18);
    color: #f472b6;
}
.ndml-badge.badge-txt {
    background: rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
}
.ndml-badge.badge-json {
    background: rgba(234, 179, 8, 0.18);
    color: #facc15;
}
.ndml-badge.badge-csv {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
}
.ndml-badge.badge-code {
    background: rgba(6, 182, 212, 0.18);
    color: #22d3ee;
}

/* Light theme badge text overrides */
[data-theme="light"] .ndml-badge.badge-md { color: #7e22ce; }
[data-theme="light"] .ndml-badge.badge-rtf { color: #be185d; }
[data-theme="light"] .ndml-badge.badge-txt { color: #475569; }
[data-theme="light"] .ndml-badge.badge-json { color: #b45309; }
[data-theme="light"] .ndml-badge.badge-csv { color: #047857; }
[data-theme="light"] .ndml-badge.badge-code { color: #0e7490; }

/* ---- Document Sheet Enhanced Formatting (Markdown, RTF, Code, Tables) ---- */
.ndml-page blockquote, .ndml-card-sheet-preview blockquote {
    border-left: 4px solid #38bdf8;
    background: #f8fafc;
    padding: 8px 14px;
    margin: 10px 0;
    color: #475569;
    font-style: italic;
    border-radius: 0 6px 6px 0;
}

.ndml-page pre, .ndml-card-sheet-preview pre {
    background: #0f172a;
    color: #f1f5f9;
    padding: 14px 18px;
    border-radius: 8px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.86rem;
    line-height: 1.55;
    overflow-x: auto;
    margin: 12px 0;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2);
}

.ndml-page code, .ndml-card-sheet-preview code {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.88em;
    background: #f1f5f9;
    color: #0f172a;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.ndml-page pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border: none;
    font-size: inherit;
}

/* Document & CSV Tables */
.doc-table, .doc-csv-table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 0.88rem;
}

.doc-table th, .doc-csv-table th {
    background: #f1f5f9;
    color: #0f172a;
    font-weight: 700;
    text-align: left;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
}

.doc-table td, .doc-csv-table td {
    padding: 8px 14px;
    border: 1px solid #e2e8f0;
    color: #334155;
}

.doc-table tr:nth-child(even), .doc-csv-table tr:nth-child(even) {
    background: #f8fafc;
}

/* Plain Text & Log Document Sheet View */
.doc-plain-text-block {
    font-family: 'Fira Code', 'Consolas', 'Courier New', monospace;
    font-size: 0.86rem;
    line-height: 1.6;
    color: #1e293b;
    white-space: pre-wrap;
    word-break: break-word;
    background: #fcfcfc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 16px 20px;
    margin: 0;
}

/* JSON Syntax Highlight Classes */
.token-key { color: #0284c7; font-weight: 600; }
.token-str { color: #16a34a; }
.token-num { color: #d97706; }
.token-bool { color: #9333ea; font-weight: 600; }
.token-null { color: #dc2626; font-style: italic; }

/* Horizontal rules */
.ndml-page hr {
    border: none;
    border-top: 2px solid #e2e8f0;
    margin: 20px 0;
}

/* Task lists */
.doc-task-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
}
.doc-task-checkbox {
    margin: 0;
    pointer-events: none;
}



