/* CSS spec: @import rules must precede all other rules. The admin console
   relies on these for its display typography — moved to the top so they
   actually load. For production, prefer a <link> in _Host.cshtml to drop
   the render-blocking penalty. */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;0,9..144,800;1,9..144,400;1,9..144,600&family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ═══════════════════════════════════════════════════════════════
   Pulse Chat — Theme System & Core Styles
   3 built-in themes: light (default), dark, midnight
   Swap via data-pulse-theme attribute on any ancestor element.
   ═══════════════════════════════════════════════════════════════ */

/* ── Theme: Light (Default) ────────────────────────────────── */
:root,
[data-pulse-theme="light"] {
    --pulse-primary: #4f46e5;
    --pulse-primary-hover: #4338ca;
    --pulse-primary-light: #eef2ff;
    --pulse-primary-rgb: 79, 70, 229;

    --pulse-bg: #ffffff;
    --pulse-bg-secondary: #f8fafc;
    --pulse-bg-tertiary: #f1f5f9;
    --pulse-bg-hover: #f1f5f9;
    --pulse-bg-active: #e2e8f0;
    --pulse-bg-input: #ffffff;

    --pulse-text: #0f172a;
    --pulse-text-secondary: #64748b;
    --pulse-text-muted: #94a3b8;

    --pulse-border: #e2e8f0;
    --pulse-border-strong: #cbd5e1;
    --pulse-border-focus: var(--pulse-primary);

    --pulse-accent: #ef4444;
    --pulse-accent-hover: #dc2626;
    --pulse-success: #22c55e;
    --pulse-warning: #f59e0b;
    --pulse-warning-bg: rgba(245, 158, 11, 0.12);
    --pulse-warning-border: rgba(245, 158, 11, 0.35);
    --pulse-warning-text: #8a5a00;
    --pulse-info: #3b82f6;

    --pulse-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --pulse-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --pulse-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --pulse-shadow-panel: -2px 0 20px rgba(0, 0, 0, 0.06);

    --pulse-code-bg: #1e293b;
    --pulse-code-text: #e2e8f0;
    --pulse-code-inline-bg: #f1f5f9;
    --pulse-code-inline-border: #e2e8f0;

    --pulse-avatar-bg: var(--pulse-primary);
    --pulse-avatar-text: #ffffff;

    --pulse-radius-sm: 6px;
    --pulse-radius-md: 8px;
    --pulse-radius-lg: 12px;
    --pulse-radius-full: 9999px;

    --pulse-sidebar-width: 280px;
    --pulse-panel-width: 780px;

    --pulse-transition: 0.15s ease;

    --pulse-overlay: rgba(15, 23, 42, 0.4);

    --pulse-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ── Theme: Dark ───────────────────────────────────────────── */
[data-pulse-theme="dark"] {
    --pulse-primary: #818cf8;
    --pulse-primary-hover: #6366f1;
    --pulse-primary-light: rgba(129, 140, 248, 0.1);
    --pulse-primary-rgb: 129, 140, 248;

    --pulse-bg: #1e1e2e;
    --pulse-bg-secondary: #181825;
    --pulse-bg-tertiary: #11111b;
    --pulse-bg-hover: #313244;
    --pulse-bg-active: #45475a;
    --pulse-bg-input: #313244;

    --pulse-text: #cdd6f4;
    --pulse-text-secondary: #a6adc8;
    --pulse-text-muted: #6c7086;

    --pulse-border: #313244;
    --pulse-border-strong: #45475a;
    --pulse-border-focus: var(--pulse-primary);

    --pulse-accent: #f38ba8;
    --pulse-accent-hover: #eba0ac;
    --pulse-success: #a6e3a1;
    --pulse-warning: #f9e2af;
    --pulse-warning-bg: rgba(249, 226, 175, 0.14);
    --pulse-warning-border: rgba(249, 226, 175, 0.35);
    --pulse-warning-text: #f9e2af;
    --pulse-info: #89b4fa;

    --pulse-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --pulse-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --pulse-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --pulse-shadow-panel: -2px 0 20px rgba(0, 0, 0, 0.3);

    --pulse-code-bg: #11111b;
    --pulse-code-text: #cdd6f4;
    --pulse-code-inline-bg: #313244;
    --pulse-code-inline-border: #45475a;

    --pulse-avatar-bg: #585b70;
    --pulse-avatar-text: #cdd6f4;

    --pulse-overlay: rgba(0, 0, 0, 0.6);
}

/* ── Theme: Midnight (Ocean Blue) ──────────────────────────── */
[data-pulse-theme="midnight"] {
    --pulse-primary: #22d3ee;
    --pulse-primary-hover: #06b6d4;
    --pulse-primary-light: rgba(34, 211, 238, 0.1);
    --pulse-primary-rgb: 34, 211, 238;

    --pulse-bg: #0c1222;
    --pulse-bg-secondary: #162032;
    --pulse-bg-tertiary: #1c2a3f;
    --pulse-bg-hover: #1e3048;
    --pulse-bg-active: #264060;
    --pulse-bg-input: #162032;

    --pulse-text: #e0f2fe;
    --pulse-text-secondary: #7dd3fc;
    --pulse-text-muted: #38bdf8;

    --pulse-border: #1e3a5f;
    --pulse-border-strong: #2563eb;
    --pulse-border-focus: var(--pulse-primary);

    --pulse-accent: #f472b6;
    --pulse-accent-hover: #ec4899;
    --pulse-success: #34d399;
    --pulse-warning: #fcd34d;
    --pulse-warning-bg: rgba(252, 211, 77, 0.12);
    --pulse-warning-border: rgba(252, 211, 77, 0.35);
    --pulse-warning-text: #fcd34d;
    --pulse-info: #60a5fa;

    --pulse-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --pulse-shadow-md: 0 4px 12px rgba(0, 50, 100, 0.4);
    --pulse-shadow-lg: 0 12px 40px rgba(0, 50, 100, 0.5);
    --pulse-shadow-panel: -2px 0 24px rgba(0, 50, 100, 0.4);

    --pulse-code-bg: #162032;
    --pulse-code-text: #e0f2fe;
    --pulse-code-inline-bg: #1e3048;
    --pulse-code-inline-border: #1e3a5f;

    --pulse-avatar-bg: #0891b2;
    --pulse-avatar-text: #ffffff;

    --pulse-overlay: rgba(0, 10, 30, 0.8);
}


/* ═══════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════ */

.pulse-chat-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    font-family: var(--pulse-font);
    color: var(--pulse-text);
    transition: width var(--pulse-transition), box-shadow var(--pulse-transition);

    /* Container queries: the three-pane layout collapses when THIS panel
       is narrow (not when the viewport is). OpexPrime embeds the panel at
       whatever width its host page gives it, so viewport-based media
       queries don't help — we need to react to the panel's own size. */
    container-name: pulse-panel;
    container-type: inline-size;
}

.pulse-chat-panel.open {
    width: var(--pulse-panel-width);
    border-left: 1px solid var(--pulse-border);
    background: var(--pulse-bg);
    box-shadow: var(--pulse-shadow-panel);
}

.pulse-chat-panel.closed {
    width: auto;
}

.pulse-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.pulse-sidebar {
    width: var(--pulse-sidebar-width);
    border-right: 1px solid var(--pulse-border);
    background: var(--pulse-bg-secondary);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.pulse-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--pulse-bg);
}

.pulse-main.pulse-empty {
    align-items: center;
    justify-content: center;
    color: var(--pulse-text-muted);
}


/* ═══════════════════════════════════════════════════════════════
   TOGGLE BUTTON (FAB)
   ═══════════════════════════════════════════════════════════════ */

.pulse-toggle-btn {
    position: fixed !important;
    bottom: 24px;
    right: 24px;
    width: 56px !important;
    height: 56px !important;
    border-radius: var(--pulse-radius-full) !important;
    background: var(--pulse-primary) !important;
    color: white !important;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 16px rgba(var(--pulse-primary-rgb), 0.35);
    z-index: 1001;
    transition: transform var(--pulse-transition), box-shadow var(--pulse-transition);
}

.pulse-toggle-btn:hover {
    background: var(--pulse-primary-hover) !important;
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(var(--pulse-primary-rgb), 0.45);
}

.pulse-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--pulse-accent);
    color: white;
    border-radius: var(--pulse-radius-full);
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
    line-height: 1.3;
}


/* ═══════════════════════════════════════════════════════════════
   CONNECTION STATUS
   ═══════════════════════════════════════════════════════════════ */

.pulse-connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--pulse-text-muted);
    border-bottom: 1px solid var(--pulse-border);
    background: var(--pulse-bg-secondary);
}

.pulse-connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.pulse-connection-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px solid var(--pulse-border);
}

.pulse-connection-banner.reconnecting {
    background: rgba(245, 158, 11, 0.1);
    color: var(--pulse-warning);
    border-bottom-color: rgba(245, 158, 11, 0.2);
}

.pulse-connection-banner.disconnected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--pulse-accent);
    border-bottom-color: rgba(239, 68, 68, 0.2);
}

.pulse-connection-status.connected .pulse-connection-dot { background: var(--pulse-success); }
.pulse-connection-status.reconnecting .pulse-connection-dot { background: var(--pulse-warning); animation: pulse-blink 1s infinite; }
.pulse-connection-status.disconnected .pulse-connection-dot { background: var(--pulse-accent); }

/* Reconnecting banner: spin the sync icon so users see the system is working. */
.pulse-connection-banner.reconnecting .pulse-connection-icon {
    display: inline-flex;
    animation: pulse-spin 1.4s linear infinite;
    transform-origin: center;
}

@keyframes pulse-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes pulse-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}


/* ═══════════════════════════════════════════════════════════════
   PRESENCE INDICATORS
   ═══════════════════════════════════════════════════════════════ */
.pulse-presence-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--pulse-bg);
    flex-shrink: 0;
}
.pulse-presence-dot.online  { background: var(--pulse-success); }
.pulse-presence-dot.away    { background: var(--pulse-warning); }
.pulse-presence-dot.dnd     { background: var(--pulse-accent); }
.pulse-presence-dot.offline { background: var(--pulse-text-muted); }

.pulse-dm-avatar .pulse-presence-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
}

.pulse-last-seen {
    font-size: 11px;
    color: var(--pulse-text-muted);
    white-space: nowrap;
}

.pulse-header-status {
    font-size: 12px;
    margin-left: 8px;
    font-weight: 400;
}
.pulse-header-status.online { color: var(--pulse-success); }

/* ═══════════════════════════════════════════════════════════════
   CHANNEL LIST / SIDEBAR
   ═══════════════════════════════════════════════════════════════ */

.pulse-channel-list {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.pulse-channel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--pulse-border);
}

.pulse-channel-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--pulse-text);
    letter-spacing: -0.01em;
}

.pulse-channel-search {
    padding: 8px 12px;
}

.pulse-channel-search input,
.pulse-channel-search .rz-textbox {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-md);
    background: var(--pulse-bg-input);
    color: var(--pulse-text);
    font-size: 13px;
    transition: border-color var(--pulse-transition), box-shadow var(--pulse-transition);
}

.pulse-channel-search input:focus,
.pulse-channel-search .rz-textbox:focus-within {
    border-color: var(--pulse-border-focus);
    box-shadow: 0 0 0 3px rgba(var(--pulse-primary-rgb), 0.1);
    outline: none;
}

.pulse-channels-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.pulse-channel-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    cursor: pointer;
    gap: 10px;
    border-radius: var(--pulse-radius-sm);
    margin: 1px 6px;
    transition: background var(--pulse-transition);
    /* Reset native button styling so the row reads as a row, not a button */
    background: transparent;
    border: none;
    width: calc(100% - 12px);
    text-align: left;
    font: inherit;
    color: inherit;
}

.pulse-channel-item:focus-visible {
    outline: 2px solid var(--pulse-primary);
    outline-offset: -2px;
}

.pulse-channel-item:hover {
    background: var(--pulse-bg-hover);
}

.pulse-channel-item.has-unread {
    background: color-mix(in srgb, var(--pulse-primary) 6%, transparent);
}

.pulse-channel-item.has-unread .pulse-channel-name {
    font-weight: 700;
    color: var(--pulse-text);
}

.pulse-channel-item.has-unread .pulse-channel-preview {
    color: var(--pulse-text-secondary);
    font-weight: 500;
}

.pulse-channel-item.active {
    background: var(--pulse-primary-light);
    color: var(--pulse-primary);
    border-left: 3px solid var(--pulse-primary);
}

.pulse-channel-item.active .pulse-channel-name {
    color: var(--pulse-primary);
    font-weight: 600;
}

.pulse-channel-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: var(--pulse-text-muted);
    flex-shrink: 0;
}

.pulse-channel-item.active .pulse-channel-icon {
    color: var(--pulse-primary);
}

.pulse-channel-dot {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #fff;
    font-weight: 700;
}

.pulse-dm-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    overflow: hidden;
}

/* Self-DM ("Notes to Self") gets a bookmark glyph on a primary-tinted
   circle so it's instantly recognisable in the sidebar. */
.pulse-dm-avatar-self {
    background: var(--pulse-primary-light);
    color: var(--pulse-primary);
}

/* When a real avatar URL is available, render it edge-to-edge inside
   the same circle, regardless of which avatar container it's in. */
.pulse-dm-avatar img,
.pulse-avatar img,
.pulse-member-popover-avatar img,
.pulse-member-avatar img,
.pulse-mention-avatar img,
.pulse-dm-picker-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* And the containers themselves need overflow hidden so the img is clipped. */
.pulse-avatar,
.pulse-member-avatar,
.pulse-mention-avatar,
.pulse-dm-picker-avatar,
.pulse-member-popover-avatar {
    overflow: hidden;
}

.pulse-channel-info {
    flex: 1;
    min-width: 0;
}

.pulse-channel-name {
    display: block;
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--pulse-text);
    line-height: 1.3;
}

.pulse-channel-preview {
    display: block;
    font-size: 12px;
    color: var(--pulse-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.pulse-unread-badge {
    background: var(--pulse-text-muted);
    color: white;
    border-radius: var(--pulse-radius-full);
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
}

.pulse-unread-badge.mention {
    background: var(--pulse-accent);
}


/* ── Tree Structure ── */

.pulse-tree-section-header {
    display: flex;
    align-items: center;
    padding: 14px 12px 8px;
    cursor: pointer;
    gap: 4px;
    user-select: none;
}

.pulse-tree-section-header:hover {
    background: var(--pulse-bg-hover);
}

.pulse-tree-section-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--pulse-text-muted);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-tree-chevron {
    width: 14px;
    font-size: 9px;
    color: var(--pulse-text-muted);
    text-align: center;
    flex-shrink: 0;
}

.pulse-tree-action-btn {
    opacity: 0;
    transition: opacity var(--pulse-transition);
    flex-shrink: 0;
}

.pulse-tree-section-header:hover .pulse-tree-action-btn {
    opacity: 1;
}

.pulse-tree-children .pulse-channel-item {
    padding-left: 28px;
}

/* ── Category sub-grouping inside a workspace ───────────────────── */
/* Visually distinct from the workspace header (less heavy, less
   uppercase) so the hierarchy is obvious at a glance. */
.pulse-tree-category-header {
    display: flex;
    align-items: center;
    padding: 6px 12px 6px 22px;
    cursor: pointer;
    gap: 4px;
    user-select: none;
}

.pulse-tree-category-header:hover {
    background: var(--pulse-bg-hover);
}

.pulse-tree-category-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--pulse-text-secondary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-tree-category-children .pulse-channel-item {
    padding-left: 38px;
}

.pulse-channel-empty-hint {
    padding: 8px 16px 8px 28px;
    font-size: 12px;
    color: var(--pulse-text-muted);
    line-height: 1.4;
}

.pulse-channel-empty-hint-tight {
    padding: 4px 16px 4px 38px;
    font-size: 11px;
}

.pulse-tree-separator {
    height: 1px;
    background: var(--pulse-border);
    margin: 6px 16px;
}


/* ── New DM Picker ── */

.pulse-dm-picker {
    padding: 4px 12px 8px;
    border-bottom: 1px solid var(--pulse-border);
}

.pulse-dm-picker input,
.pulse-dm-picker .rz-textbox {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-sm);
    background: var(--pulse-bg-input);
    color: var(--pulse-text);
    font-size: 13px;
    margin-bottom: 4px;
}

.pulse-dm-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--pulse-radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: background var(--pulse-transition);
}

.pulse-dm-picker-item:hover {
    background: var(--pulse-bg-hover);
}

.pulse-dm-picker-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--pulse-avatar-bg);
    color: var(--pulse-avatar-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.pulse-dm-picker-status {
    font-size: 12px;
    color: var(--pulse-text-muted);
    padding: 4px 8px;
}


/* ═══════════════════════════════════════════════════════════════
   CHAT VIEW
   ═══════════════════════════════════════════════════════════════ */

.pulse-chat-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.pulse-chat-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--pulse-border);
    background: var(--pulse-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pulse-chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.pulse-chat-header-left .pulse-channel-icon {
    font-size: 20px;
    color: var(--pulse-text-muted);
}

.pulse-chat-header-left .pulse-channel-info {
    flex: 1;
    min-width: 0;
}

.pulse-chat-header-right {
    flex-shrink: 0;
}

.pulse-member-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--pulse-bg-secondary);
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-full);
    font-size: 12px;
    color: var(--pulse-text-secondary);
    font-weight: 500;
}

/* ── Member List Popover ── */

.pulse-member-popover {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    width: 280px;
    background: var(--pulse-bg);
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-lg);
    box-shadow: var(--pulse-shadow-lg);
    z-index: 50;
    animation: pulse-fade-in 0.15s ease-out;
    overflow: hidden;
}

.pulse-member-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--pulse-border);
    font-size: 13px;
    font-weight: 700;
    color: var(--pulse-text);
}

.pulse-member-popover-loading {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--pulse-text-muted);
}

.pulse-member-popover-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 4px 0;
}

.pulse-member-popover-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background var(--pulse-transition);
}

.pulse-member-popover-item:hover {
    background: var(--pulse-bg-hover);
}

.pulse-member-popover-item:hover .pulse-member-popover-dm {
    color: var(--pulse-primary) !important;
}

.pulse-member-popover-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}

.pulse-member-popover-info {
    flex: 1;
    min-width: 0;
}

.pulse-member-popover-name {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--pulse-text);
    line-height: 1.3;
}

.pulse-member-popover-role {
    display: block;
    font-size: 11px;
    color: var(--pulse-text-muted);
    text-transform: capitalize;
}

.pulse-member-popover-dm {
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--pulse-transition);
}

.pulse-member-popover-item:hover .pulse-member-popover-dm {
    opacity: 1;
}

.pulse-chat-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.pulse-topic {
    font-size: 12px;
    color: var(--pulse-text-muted);
}

.pulse-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pulse-loading {
    text-align: center;
    color: var(--pulse-text-muted);
    padding: 24px;
    font-size: 14px;
}

/* Sender typeahead popover used in PulseSearchResults */
.pulse-sender-popover {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--pulse-bg);
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-sm);
    box-shadow: var(--pulse-shadow-md);
    z-index: 50;
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
}

.pulse-sender-popover-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--pulse-text);
}

.pulse-sender-popover-item:hover {
    background: var(--pulse-bg-hover);
}

/* Edit footer = counter on the left, Save/Cancel on the right */
.pulse-edit-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    gap: 8px;
}

.pulse-edit-actions {
    display: flex;
    gap: 6px;
}

.pulse-edit-counter {
    font-size: 11px;
    color: var(--pulse-text-muted);
    font-variant-numeric: tabular-nums;
}

.pulse-edit-counter.warn {
    color: var(--pulse-warning);
}

.pulse-edit-counter.over {
    color: var(--pulse-accent);
    font-weight: 600;
}

/* "↓ N new messages" pill that appears when the user is scrolled up
   in a chatty channel and a new message arrives. Click jumps to bottom. */
.pulse-scroll-to-latest {
    position: absolute;
    left: 50%;
    bottom: 80px;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--pulse-primary);
    color: #ffffff;
    border: none;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--pulse-shadow-md);
    z-index: 10;
    animation: pulse-pill-in 0.2s ease-out;
}

.pulse-scroll-to-latest:hover {
    background: var(--pulse-primary-hover);
    transform: translateX(-50%) translateY(-1px);
}

.pulse-scroll-to-latest:focus-visible {
    outline: 2px solid var(--pulse-primary);
    outline-offset: 2px;
}

@keyframes pulse-pill-in {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.pulse-rate-limit-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 12px;
    padding: 10px 14px;
    background: var(--pulse-warning-bg);
    border: 1px solid var(--pulse-warning-border);
    border-radius: 6px;
    color: var(--pulse-warning-text);
    font-size: 13px;
    line-height: 1.4;
}

.pulse-rate-limit-banner span {
    flex: 1;
}


/* ═══════════════════════════════════════════════════════════════
   MESSAGE
   ═══════════════════════════════════════════════════════════════ */

.pulse-message {
    display: flex;
    gap: 12px;
    padding: 8px 8px;
    position: relative;
    border-radius: var(--pulse-radius-md);
    transition: background var(--pulse-transition);
}

.pulse-message:hover {
    background: var(--pulse-bg-hover);
}

.pulse-message.system {
    justify-content: center;
    color: var(--pulse-text-muted);
    font-size: 13px;
    padding: 4px;
}

.pulse-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--pulse-avatar-bg);
    color: var(--pulse-avatar-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    letter-spacing: -0.02em;
}

.pulse-message-body {
    flex: 1;
    min-width: 0;
}

/* Grouped messages (same sender, consecutive) */
.pulse-message-grouped {
    padding-top: 1px;
    padding-bottom: 1px;
}

.pulse-avatar-spacer {
    width: 38px;
    flex-shrink: 0;
}

.pulse-time-inline {
    font-size: 11px;
    color: var(--pulse-text-muted);
    opacity: 0;
    transition: opacity var(--pulse-transition);
    user-select: none;
}

.pulse-message-grouped:hover .pulse-time-inline {
    opacity: 1;
}

.pulse-message-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}

.pulse-sender {
    font-weight: 700;
    font-size: 14px;
    color: var(--pulse-text);
}

.pulse-time {
    font-size: 11px;
    color: var(--pulse-text-muted);
}

.pulse-edited {
    font-size: 11px;
    color: var(--pulse-text-muted);
}

.pulse-pinned-badge,
.pulse-bookmarked-badge {
    font-size: 11px;
    color: var(--pulse-primary);
    font-weight: 500;
}

.pulse-content {
    font-size: 14px;
    line-height: 1.55;
    word-wrap: break-word;
    color: var(--pulse-text);
}

.pulse-content p {
    margin: 0 0 4px 0;
}

.pulse-content p:last-child {
    margin-bottom: 0;
}

.pulse-content code {
    background: var(--pulse-code-inline-bg);
    border: 1px solid var(--pulse-code-inline-border);
    border-radius: 3px;
    padding: 1px 5px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
}

.pulse-content pre {
    background: var(--pulse-code-bg);
    color: var(--pulse-code-text);
    border-radius: var(--pulse-radius-md);
    padding: 14px 16px;
    margin: 8px 0;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid var(--pulse-border);
}

.pulse-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

.pulse-content blockquote {
    border-left: 3px solid var(--pulse-primary);
    margin: 8px 0;
    padding: 4px 12px;
    color: var(--pulse-text-secondary);
}

.pulse-content ul, .pulse-content ol {
    margin: 4px 0;
    padding-left: 20px;
}


/* ── Reply Quote ── */

.pulse-reply-quote {
    border-left: 3px solid var(--pulse-primary);
    padding: 6px 12px;
    margin-bottom: 6px;
    background: var(--pulse-bg-secondary);
    border-radius: 0 var(--pulse-radius-sm) var(--pulse-radius-sm) 0;
    font-size: 13px;
    cursor: pointer;
    transition: background var(--pulse-transition);
}

.pulse-reply-quote:hover {
    background: var(--pulse-bg-tertiary);
}

.pulse-reply-sender {
    font-weight: 600;
    color: var(--pulse-primary);
    margin-right: 6px;
}

.pulse-reply-text {
    color: var(--pulse-text-secondary);
}


/* ── Forwarded Indicator ── */

.pulse-forwarded-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--pulse-text-muted);
    font-style: italic;
    margin-bottom: 2px;
}

/* The arrow prefix is no longer needed — the component now renders a Material
   "forward" icon inline, which reads better than the bare unicode arrow. */


/* ── Attachments ── */

.pulse-attachments {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pulse-attachment {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--pulse-bg-secondary);
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-md);
    font-size: 13px;
    color: var(--pulse-primary);
    text-decoration: none;
    transition: background var(--pulse-transition), border-color var(--pulse-transition);
}

.pulse-attachment:hover {
    background: var(--pulse-bg-tertiary);
    border-color: var(--pulse-border-strong);
}

.pulse-file-size {
    color: var(--pulse-text-muted);
    font-size: 12px;
}

/* ── Voice note "file unavailable" fallback ──
   Hidden by default. PulseVoicePlayer (pulseVoiceRecorder.js) adds the
   .pulse-audio-failed class to the <audio> when the source errors (e.g.
   404 because the upload was never persisted). The sibling rule then
   swaps the broken controls for the message. */

.pulse-audio-unavailable {
    display: none;
    color: var(--pulse-text-muted);
    font-size: 13px;
    font-style: italic;
}

.pulse-audio audio.pulse-audio-failed {
    display: none;
}

.pulse-audio audio.pulse-audio-failed ~ .pulse-audio-unavailable {
    display: inline;
}


/* ── Reactions ── */

.pulse-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.pulse-reaction {
    padding: 2px 8px;
    background: var(--pulse-bg-secondary);
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-full);
    font-size: 13px;
    cursor: pointer;
    transition: background var(--pulse-transition), border-color var(--pulse-transition);
}

.pulse-reaction:hover {
    background: var(--pulse-primary-light);
    border-color: var(--pulse-primary);
}

.pulse-reaction.active {
    background: var(--pulse-primary-light);
    border-color: var(--pulse-primary);
    color: var(--pulse-primary);
}


/* ── Thread Preview ── */

.pulse-thread-preview {
    background: none;
    border: none;
    color: var(--pulse-primary);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 0;
    font-weight: 500;
}

.pulse-thread-preview:hover {
    text-decoration: underline;
}


/* ── Message Actions ── */

.pulse-message-actions {
    display: none;
    position: absolute;
    top: -8px;
    right: 8px;
    background: var(--pulse-bg);
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-md);
    box-shadow: var(--pulse-shadow-md);
    padding: 2px;
    gap: 1px;
}

.pulse-message:hover .pulse-message-actions {
    display: flex;
}

.pulse-message-actions button {
    background: none;
    border: none;
    padding: 5px 7px;
    cursor: pointer;
    font-size: 14px;
    border-radius: var(--pulse-radius-sm);
    color: var(--pulse-text-secondary);
    transition: background var(--pulse-transition), color var(--pulse-transition);
}

.pulse-message-actions button:hover {
    background: var(--pulse-bg-hover);
    color: var(--pulse-text);
}


/* ── Emoji Picker ── */

.pulse-emoji-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 6px;
    background: var(--pulse-bg);
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-md);
    box-shadow: var(--pulse-shadow-md);
    margin-top: 4px;
}

.pulse-emoji-picker button {
    font-size: 18px;
    padding: 4px 6px;
    background: none;
    border: none;
    border-radius: var(--pulse-radius-sm);
    cursor: pointer;
    transition: background var(--pulse-transition);
}

.pulse-emoji-picker button:hover {
    background: var(--pulse-bg-hover);
}


/* ═══════════════════════════════════════════════════════════════
   MESSAGE INPUT
   ═══════════════════════════════════════════════════════════════ */

.pulse-message-input {
    padding: 12px 20px 16px;
    border-top: 1px solid var(--pulse-border);
    background: var(--pulse-bg);
}

.pulse-reply-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--pulse-primary-light);
    border-radius: var(--pulse-radius-sm);
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--pulse-primary);
    font-weight: 500;
    border-left: 3px solid var(--pulse-primary);
}

.pulse-reply-bar-label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-reply-bar-label span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-formatting-toolbar {
    display: flex;
    gap: 2px;
    margin-bottom: 6px;
    padding: 2px;
    background: var(--pulse-bg-secondary);
    border-radius: var(--pulse-radius-sm);
    border: 1px solid var(--pulse-border);
}

.pulse-announcement-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    margin: 8px 16px 16px;
    background: var(--pulse-bg-secondary);
    border: 1px solid var(--pulse-border);
    border-left: 3px solid var(--pulse-primary);
    border-radius: var(--pulse-radius-sm);
    color: var(--pulse-text-secondary);
    font-size: 13px;
    line-height: 1.4;
}

.pulse-announcement-banner .rzi {
    color: var(--pulse-primary);
    flex-shrink: 0;
}

.pulse-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.pulse-input-row textarea,
.pulse-input-row .rz-textarea,
.pulse-chat-textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-md);
    background: var(--pulse-bg-input);
    color: var(--pulse-text);
    font-size: 14px;
    resize: none;
    font-family: var(--pulse-font);
    max-height: 120px;
    transition: border-color var(--pulse-transition), box-shadow var(--pulse-transition);
}

.pulse-input-row textarea:focus,
.pulse-input-row .rz-textarea:focus-within,
.pulse-chat-textarea:focus {
    border-color: var(--pulse-border-focus);
    box-shadow: 0 0 0 3px rgba(var(--pulse-primary-rgb), 0.1);
    outline: none;
}

.pulse-chat-textarea::placeholder {
    color: var(--pulse-text-muted);
}

.pulse-send-btn {
    border-radius: var(--pulse-radius-md) !important;
    font-weight: 600 !important;
    transition: transform var(--pulse-transition) !important;
}

.pulse-send-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.pulse-attach-btn {
    cursor: pointer;
    font-size: 20px;
    padding: 8px;
    display: flex;
    align-items: center;
    color: var(--pulse-text-secondary);
    border-radius: var(--pulse-radius-sm);
    transition: background var(--pulse-transition), color var(--pulse-transition);
}

.pulse-attach-btn:hover {
    background: var(--pulse-bg-hover);
    color: var(--pulse-text);
}

.pulse-mention-popup {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--pulse-bg);
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-md);
    box-shadow: var(--pulse-shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
}

.pulse-mention-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background var(--pulse-transition);
}

.pulse-mention-item:hover,
.pulse-mention-item.selected {
    background: var(--pulse-bg-hover);
}

.pulse-mention-item.selected {
    box-shadow: inset 3px 0 0 var(--pulse-primary);
}

.pulse-mention-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--pulse-avatar-bg);
    color: var(--pulse-avatar-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}


/* ═══════════════════════════════════════════════════════════════
   DATE SEPARATOR
   ═══════════════════════════════════════════════════════════════ */

.pulse-date-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0 8px;
    color: var(--pulse-text-muted);
    font-size: 12px;
    font-weight: 600;
}

.pulse-date-separator::before,
.pulse-date-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--pulse-border);
}


/* ═══════════════════════════════════════════════════════════════
   TYPING INDICATOR
   ═══════════════════════════════════════════════════════════════ */

.pulse-typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    font-size: 13px;
    color: var(--pulse-text-secondary);
}

.pulse-typing-text {
    font-weight: 500;
}

.pulse-typing-dots {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pulse-text-muted);
    animation: pulse-typing-bounce 1.4s ease-in-out infinite;
}

.pulse-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.pulse-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}


/* ── Read Receipts ── */

.pulse-read-receipt {
    display: inline-block;
    font-size: 13px;
    margin-top: 2px;
    letter-spacing: -2px;
    font-weight: 600;
}

.pulse-read-receipt.sent {
    color: var(--pulse-text-muted);
}

.pulse-read-receipt.read {
    color: var(--pulse-primary);
}


/* ═══════════════════════════════════════════════════════════════
   THREAD PANEL
   ═══════════════════════════════════════════════════════════════ */

.pulse-thread-side {
    width: 340px;
    border-left: 1px solid var(--pulse-border);
    flex-shrink: 0;
    display: flex;          /* ensure child panel can flex to full height */
    flex-direction: column;
    min-height: 0;
}

/* ═══════════════════════════════════════════════════════════════
   THREAD PANEL LAYOUT
   ═══════════════════════════════════════════════════════════════
   Column layout: sticky header + scrollable parent/replies +
   sticky composer. Parent message is wrapped in a subtle card so
   it's visually distinct from the replies below the divider.
   ═══════════════════════════════════════════════════════════════ */

.pulse-thread-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background: var(--pulse-bg);
}

.pulse-thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--pulse-border);
    background: var(--pulse-bg);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 5;
}

.pulse-thread-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.pulse-thread-header-title h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: var(--pulse-text);
}

.pulse-thread-header-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 7px;
    border-radius: 9999px;
    background: var(--pulse-primary-light);
    color: var(--pulse-primary);
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.pulse-thread-close {
    flex-shrink: 0;
}

/* ── Scrollable body (parent + divider + replies) ── */

.pulse-thread-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Parent message card ── */

.pulse-thread-parent {
    position: relative;
    background: var(--pulse-bg-secondary);
    border: 1px solid var(--pulse-border);
    border-left: 3px solid var(--pulse-primary);
    border-radius: var(--pulse-radius-md);
    padding: 10px 12px 6px;
}

.pulse-thread-parent-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--pulse-primary);
    margin-bottom: 4px;
}

/* Normalise the inner PulseMessage so it doesn't carry its own
   card chrome on top of ours — looks cleaner nested. */
.pulse-thread-parent .pulse-message {
    padding: 0;
    background: transparent;
}
.pulse-thread-parent .pulse-message:hover {
    background: transparent;
}

/* ── Divider with "N replies" pill ── */

.pulse-thread-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 2px;
}

.pulse-thread-divider-line {
    flex: 1 1 auto;
    height: 1px;
    background: var(--pulse-border);
}

.pulse-thread-divider-label {
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 600;
    color: var(--pulse-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Reply list ── */

.pulse-thread-messages {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pulse-thread-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 12px;
    text-align: center;
}

/* ── Sticky composer ──
   Mirrors the main chat input pattern: small options row on top, then
   an inline row with the textarea and the send button. Pinned to the
   bottom of the thread panel via flex on the ancestors. */

.pulse-thread-input {
    flex-shrink: 0;
    padding: 8px 12px 10px;
    border-top: 1px solid var(--pulse-border);
    background: var(--pulse-bg);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pulse-thread-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.pulse-thread-textarea {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 38px;
    max-height: 140px;
    resize: none;
    background: var(--pulse-bg-input);
    color: var(--pulse-text);
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-md);
    padding: 9px 12px;
    font: inherit;
    font-size: 13px;
    line-height: 1.45;
    outline: none;
    transition: border-color var(--pulse-transition), box-shadow var(--pulse-transition);
}

.pulse-thread-textarea:focus {
    border-color: var(--pulse-border-focus);
    box-shadow: 0 0 0 3px rgba(var(--pulse-primary-rgb), 0.15);
}

.pulse-thread-textarea::placeholder {
    color: var(--pulse-text-muted);
}

.pulse-thread-send-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 9999px !important;
}

/* "Also send to channel" toggle row — small and unobtrusive above the
   input, so it never competes with the send button for space. */
.pulse-thread-show-in-channel {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    color: var(--pulse-text-muted);
    cursor: pointer;
    user-select: none;
    padding: 2px 4px;
    align-self: flex-start;
}

.pulse-thread-show-in-channel span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════ */

.pulse-toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
}

.pulse-toast {
    background: var(--pulse-bg);
    border: 1px solid var(--pulse-border);
    border-left: 4px solid var(--pulse-primary);
    border-radius: var(--pulse-radius-md);
    padding: 12px 16px;
    box-shadow: var(--pulse-shadow-lg);
    animation: pulse-toast-in 0.3s ease-out;
    cursor: pointer;
    transition: border-left-color var(--pulse-transition);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.pulse-toast:hover {
    border-left-color: var(--pulse-primary-hover);
}

.pulse-toast-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(79, 138, 247, 0.12);
}

.pulse-toast-content {
    flex: 1 1 auto;
    min-width: 0;
}

.pulse-toast-header {
    display: flex;
    gap: 6px;
    align-items: baseline;
    margin-bottom: 4px;
}

.pulse-toast-channel {
    font-size: 12px;
    color: var(--pulse-text-muted);
}

.pulse-toast-body {
    font-size: 13px;
    color: var(--pulse-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes pulse-toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}


/* ═══════════════════════════════════════════════════════════════
   CREATE CHANNEL FORM
   ═══════════════════════════════════════════════════════════════ */

.pulse-create-form {
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-bottom: 1px solid var(--pulse-border);
    background: var(--pulse-bg-secondary);
}

.pulse-create-form input,
.pulse-create-form .rz-textbox {
    padding: 7px 10px;
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-sm);
    background: var(--pulse-bg-input);
    color: var(--pulse-text);
    font-size: 13px;
}


/* ═══════════════════════════════════════════════════════════════
   REUSABLE MODAL
   ═══════════════════════════════════════════════════════════════ */

.pulse-modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--pulse-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    animation: pulse-fade-in 0.15s ease-out;
}

@keyframes pulse-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pulse-modal {
    background: var(--pulse-bg);
    border-radius: var(--pulse-radius-lg);
    width: 440px;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--pulse-shadow-lg);
    border: 1px solid var(--pulse-border);
    animation: pulse-modal-in 0.2s ease-out;
    overflow: hidden;
}

@keyframes pulse-modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.pulse-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--pulse-border);
}

.pulse-modal-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.pulse-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.pulse-modal-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--pulse-text-muted);
    margin-bottom: 8px;
}

.pulse-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--pulse-border);
    gap: 8px;
}


/* ── File gallery modal ── */
/* Wider than the default 440px modal so two columns of files fit. */
.pulse-files-modal {
    width: 540px;
}

.pulse-file-gallery {
    display: flex;
    flex-direction: column;
    min-height: 240px;
    max-height: 70vh;
}

.pulse-file-gallery-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--pulse-border);
}

.pulse-file-gallery-head h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.pulse-file-gallery-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 14px 18px 18px;
    overflow-y: auto;
}

.pulse-gallery-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-md);
    color: inherit;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
    min-width: 0;
}

.pulse-gallery-item:hover {
    background: var(--pulse-bg-secondary);
    border-color: var(--pulse-primary);
}

.pulse-gallery-thumb {
    width: 36px;
    height: 36px;
    border-radius: var(--pulse-radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--pulse-bg-secondary);
}

.pulse-gallery-icon {
    font-size: 22px;
    line-height: 1;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pulse-gallery-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    overflow: hidden;
}

.pulse-gallery-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--pulse-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pulse-gallery-type {
    font-size: 11px;
    color: var(--pulse-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pulse-gallery-sep {
    margin: 0 4px;
    opacity: 0.6;
}

@media (max-width: 600px) {
    .pulse-file-gallery-list {
        grid-template-columns: 1fr;
    }
}


/* ── Forward Modal ── */

.pulse-forward-original {
    background: var(--pulse-bg-secondary);
    border-left: 3px solid var(--pulse-primary);
    border-radius: 0 var(--pulse-radius-sm) var(--pulse-radius-sm) 0;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.pulse-forward-original-sender {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--pulse-text);
}

.pulse-forward-original-text {
    font-size: 13px;
    color: var(--pulse-text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
}

.pulse-forward-channel-list {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-md);
}

.pulse-forward-channel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--pulse-transition);
    border-bottom: 1px solid var(--pulse-border);
}

.pulse-forward-channel-item:last-child {
    border-bottom: none;
}

.pulse-forward-channel-item:hover {
    background: var(--pulse-bg-hover);
}

.pulse-forward-channel-icon {
    font-size: 16px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.pulse-forward-channel-name {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

.pulse-forward-channel-members {
    font-size: 12px;
    color: var(--pulse-text-muted);
}


/* ═══════════════════════════════════════════════════════════════
   LOAD MORE / EMPTY STATES / ERRORS
   ═══════════════════════════════════════════════════════════════ */

.pulse-load-more-btn {
    display: block;
    width: 100%;
    padding: 8px;
    background: none;
    border: 1px dashed var(--pulse-border);
    border-radius: var(--pulse-radius-sm);
    color: var(--pulse-primary);
    cursor: pointer;
    font-size: 13px;
    margin-bottom: 8px;
    transition: background var(--pulse-transition);
}

.pulse-load-more-btn:hover {
    background: var(--pulse-primary-light);
}

.pulse-load-more-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

.pulse-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--pulse-text-muted);
    font-size: 14px;
    text-align: center;
}

.pulse-error {
    color: var(--pulse-accent);
    font-size: 13px;
    padding: 6px 0;
}

.pulse-success {
    color: var(--pulse-success);
    font-size: 13px;
    padding: 6px 0;
}


/* ═══════════════════════════════════════════════════════════════
   THEME SWITCHER
   ═══════════════════════════════════════════════════════════════ */

.pulse-theme-switcher {
    display: inline-flex;
    gap: 4px;
    padding: 0;
}

.pulse-theme-btn {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--pulse-border);
    cursor: pointer;
    transition: transform var(--pulse-transition), border-color var(--pulse-transition);
}

.pulse-theme-btn:hover {
    transform: scale(1.15);
}

.pulse-theme-btn.active {
    border-color: var(--pulse-primary);
    box-shadow: 0 0 0 2px rgba(var(--pulse-primary-rgb), 0.3);
}

.pulse-theme-btn[data-theme="light"] { background: #ffffff; }
.pulse-theme-btn[data-theme="dark"] { background: #1e1e2e; }
.pulse-theme-btn[data-theme="midnight"] { background: #0c1222; border-color: #22d3ee; }


/* ═══════════════════════════════════════════════════════════════
   MOBILE BACK BUTTON
   ═══════════════════════════════════════════════════════════════
   Hidden on desktop (where the sidebar is always visible, so a
   "back" affordance doesn't make sense). On smaller viewports the
   media-query block below bumps width/height to 44 px for thumbs.
   ═══════════════════════════════════════════════════════════════ */

.pulse-mobile-back-btn {
    display: none;                       /* hidden by default (desktop) */
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    margin-right: 4px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--pulse-text);
    cursor: pointer;
    transition: background var(--pulse-transition), color var(--pulse-transition);
    flex-shrink: 0;
}

.pulse-mobile-back-btn:hover {
    background: var(--pulse-bg-hover);
    color: var(--pulse-primary);
}

.pulse-mobile-back-btn:focus-visible {
    outline: 2px solid var(--pulse-primary);
    outline-offset: 2px;
}

/* Sized icon slot inside the button */
.pulse-mobile-back-btn .rz-icon {
    font-size: 20px;
    line-height: 1;
}

@media (max-width: 768px) {
    /* Reveal on mobile/narrow viewports */
    .pulse-mobile-back-btn {
        display: inline-flex;
    }
}


/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .pulse-chat-panel.open {
        width: 100vw;
        height: 100vh;
        height: 100dvh; /* dynamic viewport for mobile keyboards */
        max-height: 100dvh;
        border-radius: 0;
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    }

    .pulse-container {
        flex-direction: column;
        height: 100%;
    }

    /* ── Mobile Navigation Mode ──
       When .pulse-mobile-nav is active, show sidebar OR chat — not both.
       Controlled by PulseChatPanel via a CSS class toggle. */
    .pulse-container.pulse-mobile-nav .pulse-sidebar {
        width: 100%;
        max-height: none;
        height: 100%;
        border-right: none;
    }

    .pulse-container.pulse-mobile-nav .pulse-chat-main {
        display: none;
    }

    .pulse-container.pulse-mobile-nav .pulse-thread-side {
        display: none;
    }

    /* When a channel is selected, hide sidebar and show chat */
    .pulse-container.pulse-mobile-nav.pulse-mobile-chat-active .pulse-sidebar {
        display: none;
    }

    .pulse-container.pulse-mobile-nav.pulse-mobile-chat-active .pulse-chat-main {
        display: flex;
        width: 100%;
    }

    /* When thread is active on mobile, show it full-screen */
    .pulse-container.pulse-mobile-nav.pulse-mobile-thread-active .pulse-sidebar {
        display: none;
    }

    .pulse-container.pulse-mobile-nav.pulse-mobile-thread-active .pulse-chat-main {
        display: none;
    }

    .pulse-container.pulse-mobile-nav.pulse-mobile-thread-active .pulse-thread-side {
        display: flex;
        width: 100%;
        border-left: none;
        border-top: none;
    }

    /* Fallback for non-mobile-nav (default stacked layout) */
    .pulse-container:not(.pulse-mobile-nav) .pulse-sidebar {
        width: 100%;
        border-right: none;
        max-height: 40vh;
    }

    .pulse-container:not(.pulse-mobile-nav) .pulse-thread-side {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--pulse-border);
    }

    /* ── Touch Targets ── minimum 44px for mobile accessibility */
    .pulse-channel-item,
    .pulse-dm-item {
        min-height: 44px;
        padding: 10px 12px;
    }

    .pulse-msg-action-btn,
    .pulse-reaction-chip {
        min-width: 44px;
        min-height: 44px;
    }

    .pulse-input-actions .rz-button {
        min-width: 44px;
        min-height: 44px;
    }

    /* ── Mobile Back Button ── */
    /* Visible (via the base rule below the media query) at narrow widths
       only. Bigger touch target here for thumbs. */
    .pulse-mobile-back-btn {
        width: 44px;
        height: 44px;
    }
}

/* ── Extra small screens (phones in portrait) ── */
@media (max-width: 480px) {
    .pulse-msg-content {
        max-width: calc(100vw - 80px);
    }

    .pulse-interactive-card {
        max-width: 100%;
    }

    .pulse-card-fields {
        grid-template-columns: 1fr;
    }

    .pulse-search-results {
        width: 100%;
    }
}


/* ═══════════════════════════════════════════════════════════════
   CONTAINER-QUERY COLLAPSE
   ═══════════════════════════════════════════════════════════════
   Fires when .pulse-chat-panel is narrow, regardless of viewport.
   This is what handles OpexPrime's embedded panel — the viewport
   is full-width but the panel's own container might be 500 px.
   Below ~860 px (sidebar 280 + main 240 + thread 340) the three
   columns can't coexist, so collapse to single-pane mobile-nav
   behavior: show sidebar OR chat OR thread, never all at once.
   ═══════════════════════════════════════════════════════════════ */

@container pulse-panel (max-width: 860px) {
    .pulse-container {
        flex-direction: column;
        height: 100%;
    }

    /* Default: show the sidebar full-width */
    .pulse-container.pulse-mobile-nav .pulse-sidebar {
        width: 100%;
        max-height: none;
        height: 100%;
        border-right: none;
    }

    .pulse-container.pulse-mobile-nav .pulse-chat-main,
    .pulse-container.pulse-mobile-nav .pulse-thread-side {
        display: none;
    }

    /* When a channel is selected, hide the sidebar and show the chat */
    .pulse-container.pulse-mobile-nav.pulse-mobile-chat-active .pulse-sidebar {
        display: none;
    }

    .pulse-container.pulse-mobile-nav.pulse-mobile-chat-active .pulse-chat-main {
        display: flex;
        width: 100%;
        flex: 1 1 auto;
        min-height: 0;
    }

    /* When a thread is open, replace the chat area with the thread */
    .pulse-container.pulse-mobile-nav.pulse-mobile-thread-active .pulse-sidebar,
    .pulse-container.pulse-mobile-nav.pulse-mobile-thread-active .pulse-chat-main {
        display: none;
    }

    /* The thread side must stretch to fill the column so its sticky
       composer actually pins to the bottom — without flex:1 it sizes
       to content and the composer floats in the middle. */
    .pulse-container.pulse-mobile-nav.pulse-mobile-thread-active .pulse-thread-side {
        display: flex;
        width: 100%;
        flex: 1 1 auto;
        min-height: 0;
        border-left: none;
        border-top: none;
    }

    /* Fallback if a host forgets to apply .pulse-mobile-nav — stack
       panes vertically instead of clipping them horizontally. */
    .pulse-container:not(.pulse-mobile-nav) .pulse-sidebar {
        width: 100%;
        border-right: none;
        max-height: 40vh;
    }

    .pulse-container:not(.pulse-mobile-nav) .pulse-thread-side {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--pulse-border);
    }

    /* At this width the back button becomes essential — always show it
       so the user can get from chat back to the channel list. */
    .pulse-mobile-back-btn {
        display: inline-flex;
    }
}


/* ═══════════════════════════════════════════════════════════════
   RADZEN COMPONENT OVERRIDES
   Force Radzen inputs/buttons to respect Pulse theme variables.
   ═══════════════════════════════════════════════════════════════ */

.pulse-chat-panel .rz-textbox,
.pulse-chat-panel .rz-textarea,
.pulse-chat-panel textarea.rz-textarea,
.pulse-chat-panel input.rz-textbox {
    background-color: var(--pulse-bg-input) !important;
    color: var(--pulse-text) !important;
    border-color: var(--pulse-border) !important;
    caret-color: var(--pulse-text);
}

.pulse-chat-panel .rz-textbox:focus,
.pulse-chat-panel .rz-textarea:focus,
.pulse-chat-panel textarea.rz-textarea:focus,
.pulse-chat-panel input.rz-textbox:focus {
    border-color: var(--pulse-border-focus) !important;
    box-shadow: 0 0 0 3px rgba(var(--pulse-primary-rgb), 0.15) !important;
}

.pulse-chat-panel .rz-textbox::placeholder,
.pulse-chat-panel .rz-textarea::placeholder {
    color: var(--pulse-text-muted) !important;
}

/* Radzen button text inherits theme color */
.pulse-chat-panel .rz-button {
    font-family: var(--pulse-font);
}

/* Radzen dropdown overrides */
.pulse-chat-panel .rz-dropdown,
.pulse-chat-panel .rz-dropdown .rz-inputtext {
    background-color: var(--pulse-bg-input) !important;
    color: var(--pulse-text) !important;
    border-color: var(--pulse-border) !important;
}

/* Radzen checkbox label color */
.pulse-chat-panel .rz-chkbox-label {
    color: var(--pulse-text) !important;
}

/* Radzen datepicker */
.pulse-chat-panel .rz-datepicker .rz-inputtext {
    background-color: var(--pulse-bg-input) !important;
    color: var(--pulse-text) !important;
    border-color: var(--pulse-border) !important;
}

/* ── Interactive Card ────────────────────────────────────── */
.pulse-interactive-card {
    max-width: 480px;
    margin: 8px 0;
    border-left: 3px solid var(--pulse-primary);
    background: var(--pulse-bg-secondary);
    border-radius: var(--pulse-radius-md);
}

.pulse-interactive-card .pulse-card-title {
    margin: 0 0 8px 0;
    color: var(--pulse-text);
    font-size: 1rem;
    font-weight: 600;
}

.pulse-interactive-card .pulse-card-description {
    margin: 0 0 8px 0;
    color: var(--pulse-text-secondary);
    font-size: 0.875rem;
}

.pulse-interactive-card .pulse-card-image {
    max-width: 100%;
    max-height: 320px;
    width: 100%;
    object-fit: cover;
    border-radius: var(--pulse-radius-sm);
    margin-bottom: 8px;
    display: block;
}

.pulse-card-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.pulse-card-field {
    font-size: 0.85rem;
    color: var(--pulse-text);
}

.pulse-card-field strong {
    display: block;
    color: var(--pulse-text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pulse-card-field.full-width {
    grid-column: 1 / -1;
}

.pulse-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ═══════════════════════════════════════════════════════════════
   Admin Console — Editorial Operations layout
   Fonts imported at the top of the file (CSS spec requires @import
   to precede all other rules).
   ═══════════════════════════════════════════════════════════════ */

.pulse-admin-dashboard {
    /* Console-scoped tokens; fall back to global theme. */
    --admin-font-display: 'Fraunces', Georgia, serif;
    --admin-font-body: 'DM Sans', var(--pulse-font);
    --admin-font-mono: 'JetBrains Mono', ui-monospace, monospace;

    --admin-rail-w: 220px;
    --admin-rail-w-collapsed: 64px;
    --admin-gutter: 32px;

    --admin-grid-line: color-mix(in srgb, var(--pulse-border) 70%, transparent);
    --admin-surface: var(--pulse-bg);
    --admin-surface-2: var(--pulse-bg-secondary);
    --admin-surface-3: var(--pulse-bg-tertiary);
    --admin-ink: var(--pulse-text);
    --admin-ink-2: var(--pulse-text-secondary);
    --admin-ink-3: var(--pulse-text-muted);

    color: var(--admin-ink);
    font-family: var(--admin-font-body);
    line-height: 1.45;
    /* Subtle vellum: 1px grid lines, almost invisible, lend a "drafting paper" feel. */
    background:
        linear-gradient(var(--admin-grid-line) 1px, transparent 1px) 0 0 / 100% 32px,
        linear-gradient(90deg, var(--admin-grid-line) 1px, transparent 1px) 0 0 / 32px 100%,
        var(--pulse-bg);
    background-attachment: local;
    border-radius: var(--pulse-radius-lg);
    overflow: hidden;
    border: 1px solid var(--pulse-border);
}

/* Reset Radzen card override damage from older revisions. */
.pulse-admin-dashboard h3,
.pulse-admin-dashboard h4,
.pulse-admin-dashboard h5 {
    margin: 0;
    color: var(--admin-ink);
}

/* ── Hero ──────────────────────────────────────────────────── */

.pulse-admin-hero {
    padding: 36px 40px 28px;
    border-bottom: 1px solid var(--pulse-border);
    background:
        radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--pulse-primary) 8%, transparent), transparent 55%),
        var(--admin-surface);
}

.pulse-admin-hero-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.pulse-admin-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--admin-font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--admin-ink-2);
}

/* Scope pill — top-right of the hero, tells users at a glance what
   admin powers they hold. Two flavours: 'system' (gold-ringed) for
   ChatAdmin, 'scoped' (primary-ringed) for Workspace Admin. */
.pulse-admin-scope-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px 5px 10px;
    border-radius: var(--pulse-radius-full);
    font-family: var(--admin-font-body);
    font-size: 12px;
    font-weight: 600;
    border: 1px solid;
    background: var(--admin-surface-2);
    white-space: nowrap;
}

.pulse-admin-scope-pill .rzi {
    font-size: 16px;
}

.pulse-admin-scope-pill-system {
    color: var(--pulse-warning);
    border-color: var(--pulse-warning-border);
    background: var(--pulse-warning-bg);
}

.pulse-admin-scope-pill-scoped {
    color: var(--pulse-primary);
    border-color: color-mix(in srgb, var(--pulse-primary) 35%, transparent);
    background: color-mix(in srgb, var(--pulse-primary) 8%, transparent);
}

/* No-access view rendered in place of the layout when GET /admin/scope
   returns 403 — keeps the chrome but tells users they need a permission
   without showing them empty tables. */
.pulse-admin-no-access {
    text-align: center;
    padding: 80px 24px 96px;
    max-width: 540px;
    margin: 0 auto;
}

.pulse-admin-no-access-mark {
    font-family: var(--admin-font-display);
    font-size: 5rem;
    font-weight: 600;
    font-style: italic;
    color: var(--admin-ink-3);
    line-height: 0.9;
    margin-bottom: 20px;
}

.pulse-admin-no-access h4 {
    font-family: var(--admin-font-display);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 12px !important;
    color: var(--admin-ink);
}

.pulse-admin-no-access p {
    font-size: 14px;
    color: var(--admin-ink-2);
    line-height: 1.6;
    margin: 0;
}

.pulse-admin-no-access strong {
    color: var(--admin-ink);
    font-weight: 600;
}

.pulse-admin-eyebrow-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pulse-success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--pulse-success) 20%, transparent);
    animation: pulse-admin-blink 2.4s ease-in-out infinite;
}

@keyframes pulse-admin-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

.pulse-admin-eyebrow-sep { opacity: 0.4; }

.pulse-admin-eyebrow-time {
    font-variant-numeric: tabular-nums;
    color: var(--admin-ink);
}

.pulse-admin-title {
    font-family: var(--admin-font-display);
    font-size: clamp(2rem, 4.2vw, 3.4rem);
    font-weight: 600;
    font-variation-settings: 'opsz' 144;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 14px !important;
    color: var(--admin-ink);
    /* Two-tone via the first-letter / first-word pseudos isn't supported in
       CSS for "first word", so we accept a single weight here — readable
       through Fraunces' optical sizing without internal contrast. */
}

.pulse-admin-lede {
    font-size: 15px;
    color: var(--admin-ink-2);
    max-width: 60ch;
    margin-bottom: 22px;
}

.pulse-admin-hero-strip {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 14px 0 4px;
    border-top: 1px solid var(--pulse-border);
    margin-top: 8px;
}

.pulse-admin-hero-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 22px 6px 0;
    margin-right: 22px;
    border-right: 1px solid var(--pulse-border);
}

.pulse-admin-hero-stat:last-child {
    border-right: 0;
    margin-right: 0;
}

.pulse-admin-hero-stat-value {
    font-family: var(--admin-font-mono);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--admin-ink);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.pulse-admin-hero-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--admin-ink-3);
    font-weight: 500;
}

/* ── Layout grid: rail + main ──────────────────────────────── */

.pulse-admin-layout {
    display: grid;
    grid-template-columns: var(--admin-rail-w) 1fr;
    min-height: 540px;
}

.pulse-admin-dashboard.is-nav-collapsed .pulse-admin-layout {
    grid-template-columns: var(--admin-rail-w-collapsed) 1fr;
}

@container pulse-panel (max-width: 720px) {
    .pulse-admin-layout {
        grid-template-columns: 1fr;
    }
}

/* ── Left rail ─────────────────────────────────────────────── */

.pulse-admin-nav {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--pulse-border);
    padding: 16px 0 12px;
    background: var(--admin-surface-2);
    position: relative;
}

.pulse-admin-nav-collapse {
    position: absolute;
    top: 12px;
    right: -14px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--admin-surface);
    border: 1px solid var(--pulse-border);
    color: var(--admin-ink-2);
    cursor: pointer;
    z-index: 2;
    transition: all var(--pulse-transition);
    box-shadow: var(--pulse-shadow-sm);
}

.pulse-admin-nav-collapse:hover {
    color: var(--pulse-primary);
    border-color: var(--pulse-primary);
}

.pulse-admin-nav-list {
    list-style: none;
    margin: 0;
    padding: 0 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pulse-admin-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: 0;
    border-radius: var(--pulse-radius-md);
    cursor: pointer;
    color: var(--admin-ink-2);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    transition: all var(--pulse-transition);
    position: relative;
}

.pulse-admin-nav-item:hover {
    background: var(--pulse-bg-hover);
    color: var(--admin-ink);
}

.pulse-admin-nav-item.is-active {
    background: color-mix(in srgb, var(--pulse-primary) 12%, transparent);
    color: var(--pulse-primary);
    font-weight: 600;
}

.pulse-admin-nav-item.is-active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 2px;
    background: var(--pulse-primary);
}

.pulse-admin-nav-item-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.pulse-admin-nav-item-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-admin-nav-item-count {
    font-family: var(--admin-font-mono);
    font-size: 11px;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: var(--pulse-radius-full);
    background: color-mix(in srgb, var(--admin-ink-3) 12%, transparent);
    color: var(--admin-ink-2);
    font-variant-numeric: tabular-nums;
}

.pulse-admin-nav-item.is-active .pulse-admin-nav-item-count {
    background: color-mix(in srgb, var(--pulse-primary) 18%, transparent);
    color: var(--pulse-primary);
}

.is-nav-collapsed .pulse-admin-nav-item-label,
.is-nav-collapsed .pulse-admin-nav-item-count,
.is-nav-collapsed .pulse-admin-nav-footer {
    display: none;
}

.is-nav-collapsed .pulse-admin-nav-item {
    justify-content: center;
    padding: 10px;
}

.pulse-admin-nav-footer {
    margin-top: auto;
    padding: 16px 16px 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--admin-ink-3);
    font-size: 11px;
}

.pulse-admin-kbd {
    font-family: var(--admin-font-mono);
    font-size: 10px;
    padding: 2px 6px;
    border: 1px solid var(--pulse-border);
    border-radius: 4px;
    background: var(--admin-surface);
    color: var(--admin-ink-2);
    box-shadow: 0 1px 0 var(--pulse-border);
}

.pulse-admin-nav-hint {
    margin-left: 4px;
}

/* ── Main column ───────────────────────────────────────────── */

.pulse-admin-main {
    padding: 28px var(--admin-gutter);
    overflow: hidden;
    min-width: 0;
}

.pulse-admin-panel.is-hidden {
    display: none;
}

.pulse-admin-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 20px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--pulse-border);
}

.pulse-admin-panel-eyebrow {
    display: block;
    font-family: var(--admin-font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--admin-ink-3);
    margin-bottom: 8px;
}

.pulse-admin-panel-title {
    font-family: var(--admin-font-display);
    font-size: 1.75rem;
    font-weight: 600;
    font-variation-settings: 'opsz' 96;
    letter-spacing: -0.015em;
    line-height: 1.05;
    margin-bottom: 6px !important;
}

.pulse-admin-panel-lede {
    font-size: 14px;
    color: var(--admin-ink-2);
    max-width: 70ch;
}

.pulse-admin-section-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.pulse-admin-pagination {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 16px;
    padding: 8px 4px;
    color: var(--admin-ink-2);
    font-size: 13px;
}

.pulse-admin-pagination-summary {
    margin-right: auto;
}

/* ── Stat cards ────────────────────────────────────────────── */

.pulse-admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.pulse-stat-card {
    background: var(--admin-surface) !important;
    border: 1px solid var(--pulse-border) !important;
    border-radius: var(--pulse-radius-lg) !important;
    padding: 18px !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px;
    text-align: left !important;
    position: relative;
    overflow: hidden;
}

.pulse-stat-card::after {
    /* corner mark — gives each card a quiet "tag" from across the room. */
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 48px;
    height: 48px;
    background: radial-gradient(circle at top right, color-mix(in srgb, var(--pulse-primary) 10%, transparent), transparent 70%);
    pointer-events: none;
}

.pulse-stat-card > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.pulse-stat-eyebrow {
    font-family: var(--admin-font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--admin-ink-2);
    font-weight: 500;
}

.pulse-stat-trend {
    font-size: 11px;
    font-weight: 500;
    color: var(--admin-ink-3);
    background: var(--admin-surface-3);
    padding: 2px 8px;
    border-radius: var(--pulse-radius-full);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pulse-stat-value {
    font-family: var(--admin-font-mono);
    font-size: 2.4rem;
    font-weight: 600;
    line-height: 1;
    color: var(--admin-ink);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.025em;
    word-break: break-all;
}

.pulse-stat-card > footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
}

.pulse-stat-meta {
    font-size: 12px;
    color: var(--admin-ink-3);
}

/* Skeleton placeholders for loading state. */
.pulse-stat-card-skeleton {
    gap: 14px;
}

.pulse-skel {
    background: linear-gradient(
        90deg,
        var(--admin-surface-3) 0%,
        var(--pulse-bg-hover) 50%,
        var(--admin-surface-3) 100%
    );
    background-size: 200% 100%;
    animation: pulse-skel-shimmer 1.6s ease-in-out infinite;
    border-radius: var(--pulse-radius-sm);
}

.pulse-skel-line {
    height: 12px;
    width: 100%;
}

.pulse-skel-bignum {
    height: 32px;
    width: 70%;
}

.pulse-skel-w50 {
    width: 50%;
}

.pulse-skel-row {
    height: 38px;
    margin: 4px 0;
    border-radius: var(--pulse-radius-md);
}

@keyframes pulse-skel-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.pulse-admin-table-skeleton {
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-md);
    padding: 8px;
}

/* ── Overview cards (recent activity, system health) ───────── */

.pulse-admin-overview-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

@container pulse-panel (max-width: 900px) {
    .pulse-admin-overview-grid {
        grid-template-columns: 1fr;
    }
}

.pulse-admin-card {
    background: var(--admin-surface);
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-lg);
    padding: 20px;
}

.pulse-admin-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.pulse-admin-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--admin-ink);
    letter-spacing: -0.005em;
}

.pulse-admin-card-lede {
    font-size: 12px;
    color: var(--admin-ink-3);
    margin-top: 2px;
}

.pulse-admin-card-link {
    background: transparent;
    border: 0;
    color: var(--pulse-primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--pulse-radius-sm);
    transition: background var(--pulse-transition);
}

.pulse-admin-card-link:hover {
    background: color-mix(in srgb, var(--pulse-primary) 10%, transparent);
}

.pulse-admin-recent {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.pulse-admin-recent-item {
    display: grid;
    grid-template-columns: 56px 180px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-top: 1px dashed var(--pulse-border);
    font-size: 13px;
}

.pulse-admin-recent-item:first-child { border-top: 0; }

.pulse-admin-recent-time {
    font-family: var(--admin-font-mono);
    font-size: 12px;
    color: var(--admin-ink-3);
    font-variant-numeric: tabular-nums;
}

.pulse-admin-recent-action {
    font-family: var(--admin-font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--pulse-primary);
}

.pulse-admin-recent-target {
    font-family: var(--admin-font-mono);
    font-size: 12px;
    color: var(--admin-ink-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-admin-recent-slash { opacity: 0.5; margin: 0 2px; }

.pulse-admin-recent-user {
    font-size: 12px;
    color: var(--admin-ink-2);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

.pulse-admin-recent-empty {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 4px;
    color: var(--admin-ink-3);
    font-size: 13px;
}

.pulse-admin-recent-empty-mark {
    font-family: var(--admin-font-display);
    font-size: 1.4rem;
    color: var(--admin-ink-3);
}

.pulse-admin-health {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.pulse-admin-health li {
    display: grid;
    grid-template-columns: 14px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 8px 0;
    border-top: 1px dashed var(--pulse-border);
    font-size: 13px;
}

.pulse-admin-health li:first-child { border-top: 0; }

.pulse-admin-health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--admin-ink-3);
}

.pulse-admin-health-dot.is-ok {
    background: var(--pulse-success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--pulse-success) 15%, transparent);
}

.pulse-admin-health-dot.is-warn {
    background: var(--rz-warning, #f59e0b);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--rz-warning, #f59e0b) 15%, transparent);
}

.pulse-admin-health-dot.is-err {
    background: var(--rz-danger, #ef4444);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--rz-danger, #ef4444) 15%, transparent);
}

.pulse-webhook-token {
    display: block;
    margin-top: 8px;
    padding: 8px 10px;
    background: var(--admin-surface-3, var(--pulse-bg-secondary));
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-sm);
    font-family: var(--admin-font-mono, monospace);
    font-size: 12px;
    word-break: break-all;
    user-select: all;
}

.pulse-admin-health-state {
    font-family: var(--admin-font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--admin-ink-3);
}

/* ── Toolbar / search input ────────────────────────────────── */

.pulse-admin-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.pulse-admin-toolbar-search {
    flex: 1;
    min-width: 240px;
    position: relative;
    display: flex;
    align-items: center;
}

.pulse-admin-toolbar-search-grow { flex: 1; }

.pulse-admin-toolbar-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--admin-ink-3);
    font-size: 18px;
    pointer-events: none;
    z-index: 1;
}

.pulse-admin-toolbar-search .rz-textbox,
.pulse-admin-toolbar-search input.pulse-admin-filter-input {
    padding-left: 36px !important;
    width: 100%;
}

.pulse-admin-filter-input {
    flex: 1;
    min-width: 200px;
}

.pulse-admin-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--admin-ink-2);
    cursor: pointer;
}

/* ── Tables ────────────────────────────────────────────────── */

.pulse-admin-table {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-md);
    overflow: hidden;
    max-height: 540px;
    overflow-y: auto;
    background: var(--admin-surface);
}

.pulse-admin-table-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--admin-surface-2);
    border-bottom: 1px solid var(--pulse-border);
    font-family: var(--admin-font-mono);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--admin-ink-3);
    position: sticky;
    top: 0;
    z-index: 1;
}

.pulse-admin-th {
    background: transparent;
    border: 0;
    padding: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.pulse-admin-th:hover {
    color: var(--admin-ink);
}

.pulse-admin-th-sort {
    color: var(--admin-ink-3);
    font-size: 10px;
}

.pulse-admin-table-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--pulse-border);
    font-size: 13px;
    transition: background 80ms ease;
}

.pulse-admin-table-row:hover {
    background: var(--pulse-bg-hover);
}

.pulse-admin-table-row-clickable {
    cursor: pointer;
}

.pulse-admin-table-row-clickable:focus-visible {
    outline: 2px solid var(--pulse-primary);
    outline-offset: -2px;
    background: var(--pulse-bg-hover);
}

.pulse-admin-row-archived {
    opacity: 0.55;
}

.pulse-admin-row-archived:hover {
    opacity: 0.85;
}

.pulse-admin-col-check { width: 30px; flex-shrink: 0; }
.pulse-admin-col-name {
    flex: 2;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    font-weight: 500;
}
.pulse-admin-col-type { width: 100px; flex-shrink: 0; }
.pulse-admin-col-members { width: 84px; flex-shrink: 0; text-align: center; }
.pulse-admin-col-activity { width: 140px; flex-shrink: 0; font-size: 12px; color: var(--admin-ink-3); }
.pulse-admin-col-status { width: 96px; flex-shrink: 0; }
.pulse-admin-col-actions { width: 130px; flex-shrink: 0; display: flex; gap: 2px; justify-content: flex-end; }

.pulse-admin-mono {
    font-family: var(--admin-font-mono);
    font-variant-numeric: tabular-nums;
}

.pulse-admin-channel-icon {
    font-size: 14px;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
    color: var(--admin-ink-2);
}

.pulse-admin-channel-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-admin-ws-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--pulse-primary) 15%, transparent);
    color: var(--pulse-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--admin-font-display);
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.pulse-admin-ws-stack {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pulse-admin-ws-stack strong {
    font-weight: 600;
    color: var(--admin-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-admin-ws-desc {
    font-size: 12px;
    color: var(--admin-ink-3);
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 280px;
}

/* ── Pills ─────────────────────────────────────────────────── */

.pulse-admin-pill {
    display: inline-flex;
    align-items: center;
    font-family: var(--admin-font-mono);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: var(--pulse-radius-full);
    background: var(--admin-surface-3);
    color: var(--admin-ink-2);
    border: 1px solid transparent;
}

.pulse-admin-pill-active {
    background: color-mix(in srgb, var(--pulse-success) 12%, transparent);
    color: var(--pulse-success);
}

.pulse-admin-pill-archived {
    background: color-mix(in srgb, var(--pulse-accent) 10%, transparent);
    color: var(--pulse-accent);
}

.pulse-admin-pill-public      { background: color-mix(in srgb, var(--pulse-info) 12%, transparent); color: var(--pulse-info); }
.pulse-admin-pill-private     { background: color-mix(in srgb, var(--pulse-warning) 14%, transparent); color: var(--pulse-warning-text); }
.pulse-admin-pill-directmessage { background: color-mix(in srgb, var(--pulse-primary) 12%, transparent); color: var(--pulse-primary); }
.pulse-admin-pill-groupchat    { background: color-mix(in srgb, var(--pulse-primary) 16%, transparent); color: var(--pulse-primary); }

/* ── Workspace create form (markup contract preserved) ─────── */

.pulse-admin-create-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    margin-bottom: 20px;
    background: var(--admin-surface-2);
    border: 1px solid var(--pulse-border);
    border-left: 3px solid var(--pulse-primary);
    border-radius: var(--pulse-radius-md);
}

.pulse-admin-create-form-head h5 {
    font-family: var(--admin-font-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px !important;
}

.pulse-admin-create-form-head p {
    font-size: 12px;
    color: var(--admin-ink-3);
    margin: 0;
}

.pulse-admin-create-form .rz-textbox {
    width: 100%;
}

.pulse-admin-create-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

/* ── Retention form ────────────────────────────────────────── */

.pulse-admin-form {
    display: grid;
    gap: 14px;
    padding: 20px;
    background: var(--admin-surface-2);
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-md);
    max-width: 640px;
}

.pulse-admin-retention-form {
    grid-template-columns: 1fr 1fr;
    align-items: end;
}

.pulse-admin-retention-pinned {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--pulse-radius-md);
    background: color-mix(in srgb, var(--pulse-primary) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--pulse-primary) 25%, transparent);
    color: var(--pulse-primary);
    font-weight: 600;
    font-size: 13px;
}

.pulse-admin-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pulse-admin-field label {
    font-size: 12px;
    font-weight: 500;
    color: var(--admin-ink-2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: var(--admin-font-mono);
}

.pulse-admin-field-checkbox {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    grid-column: 1 / -1;
}

.pulse-admin-field-checkbox label {
    text-transform: none;
    letter-spacing: 0;
    font-family: inherit;
    font-size: 13px;
    color: var(--admin-ink);
}

.pulse-admin-field-action {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: flex-end;
    margin-top: 4px;
}

@container pulse-panel (max-width: 720px) {
    .pulse-admin-retention-form { grid-template-columns: 1fr; }
}

/* ── Moderation ────────────────────────────────────────────── */

.pulse-moderation-search {
    display: flex;
    gap: 10px;
    align-items: stretch;
    margin-bottom: 18px;
}

.pulse-moderation-search .pulse-admin-toolbar-search {
    min-width: 0;
}

.pulse-moderation-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pulse-moderation-item {
    display: grid;
    grid-template-columns: 200px 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 14px 16px;
    background: var(--admin-surface);
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-md);
    transition: border-color var(--pulse-transition);
}

.pulse-moderation-item:hover {
    border-color: var(--pulse-border-strong);
}

.pulse-moderation-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.pulse-moderation-sender {
    font-weight: 600;
    font-size: 13px;
    color: var(--admin-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-moderation-time {
    font-size: 11px;
    color: var(--admin-ink-3);
    font-family: var(--admin-font-mono);
    font-variant-numeric: tabular-nums;
}

.pulse-moderation-content {
    font-size: 13px;
    color: var(--admin-ink-2);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.5;
    white-space: normal;
}

.pulse-moderation-actions { flex-shrink: 0; }

/* ── Audit log ─────────────────────────────────────────────── */

.pulse-audit-filters {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.pulse-audit-log {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-md);
    overflow: hidden;
}

.pulse-audit-log-head {
    display: grid;
    grid-template-columns: 200px 1fr 180px 160px;
    gap: 16px;
    padding: 10px 14px;
    background: var(--admin-surface-2);
    border-bottom: 1px solid var(--pulse-border);
    font-family: var(--admin-font-mono);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--admin-ink-3);
}

.pulse-audit-entry {
    display: grid;
    grid-template-columns: 200px 1fr 180px 160px;
    gap: 16px;
    align-items: center;
    padding: 10px 14px;
    border-top: 1px solid var(--pulse-border);
    font-size: 13px;
    background: var(--admin-surface);
    transition: background var(--pulse-transition);
}

.pulse-audit-entry:nth-child(even) {
    background: var(--admin-surface-2);
}

.pulse-audit-entry:hover {
    background: var(--pulse-bg-hover);
}

.pulse-audit-action {
    font-weight: 600;
    color: var(--pulse-primary);
    font-family: var(--admin-font-mono);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-audit-target {
    color: var(--admin-ink-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--admin-font-mono);
    font-size: 12px;
}

.pulse-audit-slash { opacity: 0.5; margin: 0 1px; }

.pulse-audit-user {
    color: var(--admin-ink);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-audit-time {
    color: var(--admin-ink-3);
    text-align: right;
    font-size: 12px;
    font-family: var(--admin-font-mono);
    font-variant-numeric: tabular-nums;
}

.pulse-admin-load-more {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

/* ── Empty states ──────────────────────────────────────────── */

.pulse-admin-empty {
    text-align: center;
    padding: 56px 24px;
    border: 1px dashed var(--pulse-border);
    border-radius: var(--pulse-radius-md);
    background: var(--admin-surface-2);
}

.pulse-admin-empty-mark {
    font-family: var(--admin-font-display);
    font-size: 3rem;
    font-weight: 600;
    font-style: italic;
    color: var(--admin-ink-3);
    line-height: 1;
    margin-bottom: 12px;
}

.pulse-admin-empty h5 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px !important;
}

.pulse-admin-empty p {
    font-size: 13px;
    color: var(--admin-ink-3);
    max-width: 36ch;
    margin: 0 auto;
}

.pulse-admin-empty-tight {
    padding: 32px 24px;
}

.pulse-admin-empty-tight p { color: var(--admin-ink-2); }

/* ── Flash messages ────────────────────────────────────────── */

.pulse-admin-flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-top: 14px;
    border-radius: var(--pulse-radius-md);
    font-size: 13px;
    border-left: 3px solid;
}

.pulse-admin-flash-success {
    background: color-mix(in srgb, var(--pulse-success) 8%, transparent);
    border-left-color: var(--pulse-success);
    color: var(--pulse-success);
}

.pulse-admin-flash-error {
    background: color-mix(in srgb, var(--pulse-accent) 8%, transparent);
    border-left-color: var(--pulse-accent);
    color: var(--pulse-accent);
}

/* ── Floating bulk-action bar ──────────────────────────────── */

.pulse-admin-bulk {
    position: sticky;
    bottom: 16px;
    margin: 16px var(--admin-gutter) 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 18px;
    background: var(--admin-ink);
    color: var(--pulse-bg);
    border-radius: var(--pulse-radius-lg);
    box-shadow: var(--pulse-shadow-lg);
    z-index: 10;
    animation: pulse-admin-bulk-in 200ms ease;
}

@keyframes pulse-admin-bulk-in {
    from { transform: translateY(8px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.pulse-admin-bulk-count {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 13px;
}

.pulse-admin-bulk-count .pulse-admin-mono {
    font-size: 1.1rem;
    font-weight: 600;
}

.pulse-admin-bulk-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pulse-admin-bulk-clear {
    background: transparent;
    border: 1px solid color-mix(in srgb, var(--pulse-bg) 30%, transparent);
    color: var(--pulse-bg);
    padding: 6px 12px;
    border-radius: var(--pulse-radius-md);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--pulse-transition);
}

.pulse-admin-bulk-clear:hover {
    background: color-mix(in srgb, var(--pulse-bg) 12%, transparent);
}

/* ── Responsive collapse to top-strip nav at narrow widths ─── */

@container pulse-panel (max-width: 720px) {
    .pulse-admin-hero { padding: 24px 20px 18px; }
    .pulse-admin-main { padding: 20px; }
    .pulse-admin-hero-strip { flex-wrap: wrap; }
    .pulse-admin-hero-stat { padding: 4px 14px 4px 0; margin-right: 14px; }

    .pulse-admin-nav {
        border-right: 0;
        border-bottom: 1px solid var(--pulse-border);
        padding: 12px;
    }

    .pulse-admin-nav-collapse { display: none; }

    .pulse-admin-nav-list {
        flex-direction: row;
        overflow-x: auto;
        padding: 0;
        gap: 4px;
    }

    .pulse-admin-nav-item {
        white-space: nowrap;
        flex-direction: row;
        padding: 8px 12px;
    }

    .pulse-admin-nav-footer { display: none; }
    .pulse-admin-nav-item.is-active::before { display: none; }
    .pulse-admin-nav-item.is-active { box-shadow: inset 0 -2px 0 var(--pulse-primary); border-radius: var(--pulse-radius-md) var(--pulse-radius-md) 0 0; }

    .pulse-moderation-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .pulse-moderation-actions { justify-self: end; }

    .pulse-audit-log-head,
    .pulse-audit-entry {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}

/* Backwards-compatible alias — older tests / call-sites still in tree. */
.pulse-empty-state {
    color: var(--admin-ink-3);
    font-size: 13px;
    text-align: center;
    padding: 24px;
}

/* ── Channel Settings ── */

.pulse-channel-settings {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    max-height: calc(85vh - 20px);
}

.pulse-channel-settings h4 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
    color: var(--pulse-text);
}

.pulse-channel-settings h5 {
    margin: 8px 0 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--pulse-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pulse-setting-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pulse-setting-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--pulse-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pulse-setting-group .rz-textbox,
.pulse-setting-group .rz-textarea {
    width: 100%;
}

.pulse-setting-toggle .pulse-setting-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--pulse-text-primary);
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}

.pulse-setting-help {
    margin: 0;
    font-size: 12px;
    color: var(--pulse-text-secondary);
    line-height: 1.4;
}

.pulse-members-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--pulse-radius-md);
    cursor: pointer;
    transition: background var(--pulse-transition);
}

.pulse-members-row:hover {
    background: var(--pulse-bg-hover);
}

.pulse-members-row-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--pulse-text);
}

.pulse-members-row-label .rzi {
    font-size: 18px;
    color: var(--pulse-text-secondary);
}

.pulse-members-row-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--pulse-text-muted);
    background: var(--pulse-bg-tertiary);
    padding: 2px 10px;
    border-radius: var(--pulse-radius-full);
    min-width: 24px;
    text-align: center;
}

.pulse-members-row-chevron {
    font-size: 18px;
    color: var(--pulse-text-muted);
}

/* ── Members Dialog ── */

.pulse-members-overlay {
    z-index: 1200;
}

.pulse-members-modal {
    width: 480px;
    max-height: 70vh;
}

.pulse-members-modal .pulse-modal-header {
    flex-shrink: 0;
}

.pulse-members-modal .pulse-modal-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.pulse-members-modal .pulse-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.pulse-members-filter {
    flex-shrink: 0;
}

.pulse-members-filter-input {
    width: 100%;
}

.pulse-member-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--pulse-radius-full);
    background: var(--pulse-avatar-bg);
    color: var(--pulse-avatar-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
}

.pulse-add-member {
    position: relative;
    flex-shrink: 0;
}

.pulse-add-member .rz-textbox {
    width: 100%;
}

.pulse-member-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--pulse-bg);
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-md);
    box-shadow: var(--pulse-shadow-md);
    z-index: 10;
    max-height: 200px;
    overflow-y: auto;
}

.pulse-member-search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: background var(--pulse-transition);
}

.pulse-member-search-item:hover {
    background: var(--pulse-bg-hover);
}

.pulse-add-icon {
    color: var(--pulse-primary);
    font-weight: 700;
    font-size: 16px;
}

.pulse-member-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.pulse-member-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--pulse-radius-sm);
    font-size: 14px;
    min-height: 36px;
    transition: background var(--pulse-transition);
}

.pulse-member-item:hover {
    background: var(--pulse-bg-hover);
}

.pulse-member-item > span:first-child {
    flex: 1;
    font-weight: 500;
    color: var(--pulse-text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-member-role {
    font-size: 11px;
    font-weight: 600;
    color: var(--pulse-text-muted);
    background: var(--pulse-bg-tertiary);
    padding: 2px 8px;
    border-radius: var(--pulse-radius-full);
    text-transform: capitalize;
}

.pulse-btn-primary {
    align-self: flex-start;
}

.pulse-btn-remove {
    flex-shrink: 0;
}

.pulse-channel-settings .pulse-error {
    color: var(--pulse-accent);
    font-size: 13px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.08);
    border-radius: var(--pulse-radius-sm);
}

.pulse-channel-settings .pulse-success {
    color: var(--pulse-success);
    font-size: 13px;
    padding: 8px 12px;
    background: rgba(34, 197, 94, 0.08);
    border-radius: var(--pulse-radius-sm);
}

.pulse-settings-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 4px;
}

.pulse-settings-divider {
    height: 1px;
    background: var(--pulse-border);
    margin: 4px 0;
}

.pulse-archive-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: rgba(239, 68, 68, 0.04);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: var(--pulse-radius-md);
}

.pulse-archive-section p {
    margin: 0;
    font-size: 12px;
    color: var(--pulse-text-secondary);
    line-height: 1.4;
}

/* ── PulseUserSearchCard ─────────────────────────────────────────────── */

.pulse-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: var(--pulse-radius-md);
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
    min-width: 0;
    position: relative;
    border: 1px solid transparent;
}

.pulse-user-card-clickable {
    cursor: pointer;
}

.pulse-user-card-clickable:hover {
    background: var(--pulse-bg-hover);
    border-color: var(--pulse-border);
}

.pulse-user-card-clickable:focus-visible {
    outline: 2px solid var(--pulse-primary);
    outline-offset: 2px;
    background: var(--pulse-bg-hover);
}

.pulse-user-card-clickable:hover .pulse-user-card-cta {
    color: var(--pulse-primary);
    transform: translateX(2px);
}

.pulse-user-card-avatar {
    /* --pulse-user-card-hue is set inline per-user from a hash of the userId.
       We mix in a calm desaturated gradient so backgrounds stay theme-aware
       and never get blindingly saturated, even on the lightest theme. */
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    background:
        linear-gradient(
            135deg,
            hsl(var(--pulse-user-card-hue, 220deg) 55% 55%) 0%,
            hsl(calc(var(--pulse-user-card-hue, 220deg) + 30deg) 55% 45%) 100%
        );
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.pulse-user-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pulse-user-card-avatar-initials {
    user-select: none;
}

.pulse-user-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.pulse-user-card-name {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
}

.pulse-user-card-display-name {
    font-weight: 600;
    color: var(--pulse-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 0 1 auto;
    min-width: 0;
}

.pulse-user-card-known-as {
    color: var(--pulse-text-muted);
    font-size: 0.85rem;
    font-weight: 400;
    font-style: italic;
    flex-shrink: 0;
}

.pulse-user-card-job,
.pulse-user-card-location {
    font-size: 0.8rem;
    color: var(--pulse-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.pulse-user-card-location {
    color: var(--pulse-text-muted);
    font-size: 0.75rem;
}

.pulse-user-card-sep {
    color: var(--pulse-text-muted);
    opacity: 0.5;
    flex-shrink: 0;
}

.pulse-user-card-job-title {
    font-weight: 500;
    color: var(--pulse-text);
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

.pulse-user-card-bu {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

.pulse-user-card-cta {
    flex-shrink: 0;
    color: var(--pulse-text-muted);
    opacity: 0.55;
    transition: color 120ms ease, transform 120ms ease, opacity 120ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
}

/* Compact variant — for @-mention typeahead. Avatar shrinks, BU collapses
   into a small mono-cased chip on the right edge. */
.pulse-user-card-compact {
    padding: 5px 8px;
    gap: 8px;
}

.pulse-user-card-compact .pulse-user-card-avatar {
    width: 26px;
    height: 26px;
    font-size: 0.7rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.pulse-user-card-compact .pulse-user-card-display-name {
    font-weight: 500;
    font-size: 0.875rem;
}

.pulse-user-card-bu-chip {
    margin-left: auto;
    font-family: ui-monospace, SFMono-Regular, 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: var(--pulse-radius-full);
    background: var(--pulse-bg-tertiary);
    color: var(--pulse-text-secondary);
    flex-shrink: 0;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.6;
    border: 1px solid var(--pulse-border);
}

.pulse-user-card-compact .pulse-user-card-body {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.pulse-user-card-compact .pulse-user-card-cta { display: none; }

/* Expanded variant — global search results. Spacious, elevated, with a
   subtle accent left-edge that hints at the user's avatar hue. */
.pulse-user-card-expanded {
    padding: 14px 16px;
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-lg);
    background: var(--pulse-bg);
    box-shadow: var(--pulse-shadow-sm);
    gap: 14px;
    position: relative;
}

.pulse-user-card-expanded::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 2px;
    background: hsl(var(--pulse-user-card-hue, 220deg) 60% 55%);
    opacity: 0.85;
}

.pulse-user-card-expanded .pulse-user-card-avatar {
    width: 52px;
    height: 52px;
    font-size: 1.05rem;
}

.pulse-user-card-expanded.pulse-user-card-clickable:hover {
    border-color: var(--pulse-border-strong);
    box-shadow: var(--pulse-shadow-md);
    transform: translateY(-1px);
}

.pulse-user-card-expanded .pulse-user-card-display-name {
    font-size: 1.05rem;
}

/* ── PulseWorkspaceDetail (admin drawer) ───────────────────────────── */

.pulse-ws-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: var(--pulse-overlay);
    z-index: 1100;
    backdrop-filter: blur(2px);
    animation: pulse-ws-fade-in 180ms ease;
}

.pulse-ws-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(560px, 100vw);
    background: var(--pulse-bg);
    border-left: 1px solid var(--pulse-border);
    box-shadow: var(--pulse-shadow-lg);
    z-index: 1101;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    font-family: 'DM Sans', var(--pulse-font);
    animation: pulse-ws-slide-in 240ms cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes pulse-ws-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes pulse-ws-slide-in {
    from { transform: translateX(24px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.pulse-ws-drawer-head {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 16px;
    align-items: start;
    padding: 24px 24px 18px;
    border-bottom: 1px solid var(--pulse-border);
}

.pulse-ws-drawer-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--pulse-primary) 14%, transparent);
    color: var(--pulse-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-size: 1.6rem;
}

.pulse-ws-drawer-titles {
    min-width: 0;
}

.pulse-ws-drawer-eyebrow {
    display: block;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--pulse-text-muted);
    margin-bottom: 4px;
}

.pulse-ws-drawer-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.6rem;
    font-weight: 600;
    font-variation-settings: 'opsz' 96;
    letter-spacing: -0.015em;
    line-height: 1.1;
    color: var(--pulse-text);
    margin: 0 !important;
}

.pulse-ws-drawer-desc {
    font-size: 13px;
    color: var(--pulse-text-secondary);
    margin: 6px 0 0;
    line-height: 1.45;
}

.pulse-ws-drawer-close {
    background: transparent;
    border: 1px solid var(--pulse-border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--pulse-text-secondary);
    transition: all var(--pulse-transition);
    flex-shrink: 0;
}

.pulse-ws-drawer-close:hover {
    color: var(--pulse-text);
    border-color: var(--pulse-border-strong);
    background: var(--pulse-bg-hover);
}

.pulse-ws-drawer-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid var(--pulse-border);
}

.pulse-ws-drawer-stats > div {
    padding: 14px 24px;
    border-right: 1px solid var(--pulse-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pulse-ws-drawer-stats > div:last-child {
    border-right: 0;
}

.pulse-ws-drawer-stat-label {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--pulse-text-muted);
}

.pulse-ws-drawer-stat-value {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--pulse-text);
    font-variant-numeric: tabular-nums;
}

.pulse-ws-drawer-stats > div:last-child .pulse-ws-drawer-stat-value {
    font-family: 'DM Sans', var(--pulse-font);
    font-size: 12px;
    font-weight: 500;
    align-self: flex-start;
}

.pulse-ws-drawer-section {
    padding: 22px 24px 32px;
    flex: 1;
    min-height: 0;
}

.pulse-ws-drawer-section-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
}

.pulse-ws-drawer-section-head h5 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--pulse-text);
    margin: 0;
}

.pulse-ws-drawer-count {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
    color: var(--pulse-text-muted);
    padding: 2px 8px;
    border-radius: var(--pulse-radius-full);
    background: var(--pulse-bg-tertiary);
}

.pulse-ws-drawer-add {
    margin-bottom: 16px;
    position: relative;
}

.pulse-ws-drawer-add-results {
    margin-top: 8px;
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-md);
    background: var(--pulse-bg);
    overflow: hidden;
    max-height: 320px;
    overflow-y: auto;
}

.pulse-ws-drawer-add-results .pulse-user-card {
    border-radius: 0;
    border-bottom: 1px solid var(--pulse-border);
}
.pulse-ws-drawer-add-results .pulse-user-card:last-child {
    border-bottom: 0;
}

.pulse-ws-drawer-filter {
    margin-bottom: 12px;
}

.pulse-ws-drawer-members {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* ── Categories list inside workspace drawer ─────────────────── */
.pulse-ws-drawer-categories {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pulse-ws-drawer-category {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid var(--pulse-border);
    border-radius: var(--pulse-radius-sm);
    background: var(--pulse-bg);
}

.pulse-ws-drawer-category-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--pulse-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-ws-drawer-member {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--pulse-border);
}

.pulse-ws-drawer-member:first-child { border-top: 0; }

.pulse-ws-drawer-member-card {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.pulse-ws-drawer-member-card .pulse-user-card-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.pulse-ws-drawer-member-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pulse-ws-drawer-member-name {
    font-weight: 600;
    color: var(--pulse-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-ws-drawer-member-meta {
    font-size: 11px;
    color: var(--pulse-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.pulse-ws-drawer-member-meta-sep {
    opacity: 0.5;
}

.pulse-ws-drawer-member-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.pulse-ws-drawer-member-actions .rz-dropdown {
    min-width: 110px;
    font-size: 12px;
}

@media (max-width: 640px) {
    .pulse-ws-drawer {
        width: 100vw;
    }
    .pulse-ws-drawer-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    .pulse-ws-drawer-stats > div {
        padding: 12px;
    }
}
