/* Jenn AI - The Thinking Canvas */

:root {
    --primary: #0D7377;
    --primary-hover: #0A5C5F;
    --primary-rgb: 13, 115, 119;
    --accent: #D97706;
    --accent-hover: #B45309;
    --accent-rgb: 217, 119, 6;
    --bg: #FAFAF7;
    --surface: #ffffff;
    --text: #1C1917;
    --text-muted: #78716C;
    --border: #E7E5E4;
    --error: #DC2626;
    --error-bg: #fef2f2;
    --success: #22c55e;
    --success-bg: #F0FDF4;
    --warning: #D97706;
    --warning-bg: #FFFBEB;
    --info: #3b82f6;
    --info-bg: #EFF6FF;
    --msg-user: #0D7377;
    --msg-user-text: #ffffff;
    --msg-assistant: #ffffff;
    --msg-system: #F0FDF4;
    --sidebar-width: 280px;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --radius-pill: 9999px;
    --shadow: 0 1px 3px rgba(28, 25, 23, 0.08);
    --shadow-md: 0 4px 12px rgba(28, 25, 23, 0.1);
    --shadow-lg: 0 10px 25px rgba(28, 25, 23, 0.15);
    --surface-2: #f5f5f4;
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --font-heading: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", "Fira Mono", Menlo, monospace;
}

/* Dark theme */
html[data-theme="dark"] {
    --bg: #0f1117;
    --surface: #1a1d27;
    --text: #e4e4e7;
    --text-muted: #8b8fa3;
    --border: #2a2d3a;
    --error-bg: rgba(220, 38, 38, 0.15);
    --success-bg: rgba(34, 197, 94, 0.15);
    --warning-bg: rgba(217, 119, 6, 0.15);
    --info-bg: rgba(59, 130, 246, 0.15);
    --msg-assistant: #1a1d27;
    --msg-system: rgba(13, 115, 119, 0.1);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --surface-2: #232736;
    color-scheme: dark;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Screen-reader only (visually hidden) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}

.login-logo {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.login-byline {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

.login-byline .magneto {
    font-family: 'Audiowide', 'Magneto', sans-serif;
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--primary);
}

.login-build-number {
    position: fixed;
    bottom: 0.75rem;
    right: 1rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    opacity: 0.6;
}

.login-tagline {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-style: italic;
    margin-top: 0.5rem;
    line-height: 1.4;
}

.error-message {
    background: var(--error-bg);
    color: var(--error);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
}

.form-group input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-secondary:hover {
    background: var(--bg);
}

.btn-sm {
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.btn-icon:hover {
    background: var(--bg);
    color: var(--text);
}

.btn-icon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Chat Layout with Sidebar */
.chat-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.chat-sidebar {
    width: 0;
    min-width: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.25s ease, min-width 0.25s ease;
}

.chat-sidebar.open {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 0.9375rem;
    font-weight: 600;
}

.sidebar-search {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-search input {
    width: 100%;
    padding: 0.375rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    outline: none;
}

.sidebar-search input:focus {
    border-color: var(--primary);
}

.sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.25rem 0;
}

.sidebar-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* Project Sidebar Sections */
.sidebar-section {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.25rem;
}

.sidebar-section-label {
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.sidebar-project-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0.75rem;
    cursor: pointer;
    font-size: 0.8125rem;
    transition: background 0.1s;
    position: relative;
}

.sidebar-project-item:hover {
    background: var(--bg-secondary, #f3f4f6);
}

.sidebar-project-item.project-active {
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    font-weight: 600;
}

.sidebar-project-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sidebar-project-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-project-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-project-chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    transition: transform 0.2s;
    color: var(--text-muted);
}

.sidebar-project-chevron.expanded {
    transform: rotate(90deg);
}

.sidebar-project-pin {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0;
    cursor: pointer;
    color: var(--text-muted);
    transition: opacity 0.15s, color 0.15s;
}

.sidebar-project-item:hover .sidebar-project-pin {
    opacity: 0.6;
}

.sidebar-project-pin:hover {
    opacity: 1 !important;
    color: var(--primary);
}

.sidebar-project-pin.pinned {
    opacity: 1;
    color: var(--primary);
}

.sidebar-conv-tree {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.sidebar-conv-tree.expanded {
    max-height: 500px;
}

.sidebar-conv-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0.75rem 4px 2.25rem;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: background 0.1s, color 0.1s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-conv-item:hover {
    background: var(--bg-secondary, #f3f4f6);
    color: var(--text);
}

.sidebar-create-form {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary, #f9fafb);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-form-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8125rem;
    background: var(--bg);
    color: var(--text);
    box-sizing: border-box;
}

.sidebar-form-input:focus {
    outline: none;
    border-color: var(--primary);
}

.sidebar-create-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.sidebar-create-color-row {
    margin: 4px 0;
}

.history-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.history-item:hover {
    background: var(--bg);
}

.history-role {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.history-user .history-role {
    color: var(--primary);
}

.history-assistant .history-role {
    color: var(--text-muted);
}

.history-content {
    font-size: 0.8125rem;
    color: var(--text);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-time {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* Chat Page */
.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100vh;
    min-width: 0;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-header h1 {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-info {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Project Context Banner */
.project-context-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 16px;
    background: var(--bg-secondary, #f9fafb);
    border-bottom: 2px solid var(--primary);
    font-size: 0.8125rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.project-banner-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.project-banner-meta {
    margin-left: auto;
}

.project-banner-btn {
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.project-banner-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Presence indicators in context banner */
.project-banner-presence {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 8px;
}

.presence-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 600;
    color: #fff;
    border: 2px solid var(--surface);
    margin-left: -6px;
    cursor: default;
}

.presence-dot:first-child {
    margin-left: 0;
}

.presence-overflow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 2px solid var(--surface);
    margin-left: -6px;
    cursor: default;
}

/* Project Onboarding Tooltip */
.project-onboarding-tip {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 260px;
    padding: 10px 12px;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    font-size: 0.8125rem;
    line-height: 1.4;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.project-onboarding-tip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 16px;
    width: 12px;
    height: 12px;
    background: var(--primary);
    transform: rotate(45deg);
}

.project-onboarding-dismiss {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 10px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    background: transparent;
    color: #fff;
    font-size: 0.75rem;
    cursor: pointer;
}

.project-onboarding-dismiss:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Project Share/Settings Overlay */
.project-share-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
}
.project-share-panel {
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    width: 440px;
    max-width: 92vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.project-share-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border, #e2e8f0);
    font-weight: 600;
    font-size: 0.9rem;
}
.project-share-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-secondary, #64748b);
    padding: 0 4px;
    line-height: 1;
}
.project-share-close:hover {
    color: var(--text-primary, #1e293b);
}
.project-share-body {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}
.project-share-add-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.project-share-input {
    flex: 1;
    min-width: 100px;
    padding: 6px 10px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #1e293b);
}
.project-share-add-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    background: var(--primary, #3b82f6);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}
.project-share-add-btn:hover {
    opacity: 0.9;
}
.project-share-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.project-share-table th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    color: var(--text-secondary, #64748b);
    font-weight: 500;
}
.project-share-table td {
    padding: 6px 8px;
    border-bottom: 1px solid color-mix(in srgb, var(--border, #e2e8f0) 50%, transparent);
}
.project-share-role-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 9999px;
    background: color-mix(in srgb, var(--primary, #3b82f6) 12%, transparent);
    color: var(--primary, #3b82f6);
    font-size: 0.75rem;
    font-weight: 500;
}
.project-share-remove-btn {
    background: none;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.75rem;
    cursor: pointer;
    color: var(--text-secondary, #64748b);
}
.project-share-remove-btn:hover {
    border-color: var(--error, #ef4444);
    color: var(--error, #ef4444);
}

/* Project Settings */
.project-settings-label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    color: var(--text-primary, #1e293b);
}
.project-settings-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #1e293b);
}
.project-color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.project-create-color-row {
    margin: 4px 0;
}
.project-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}
.project-color-swatch:hover {
    transform: scale(1.15);
}
.color-swatch-active {
    border-color: var(--text-primary, #1e293b);
    box-shadow: 0 0 0 2px var(--bg-primary, #fff), 0 0 0 4px var(--text-primary, #1e293b);
}

/* Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    scroll-behavior: smooth;
}

.message-row {
    display: flex;
    align-items: flex-end;
    gap: 0.625rem;
    padding: 0.25rem 0;
}

.message-row-user {
    justify-content: flex-end;
}

.message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    transition: box-shadow 0.3s, transform 0.15s;
}

/* Avatar states — applied to .message-avatar or .response-card-avatar */
.avatar-thinking {
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.3), 0 1px 3px rgba(0, 0, 0, 0.12);
    animation: avatar-think-glow 2s ease-in-out infinite;
}

@keyframes avatar-think-glow {
    0%, 100% { box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.2), 0 1px 3px rgba(0, 0, 0, 0.12); }
    50% { box-shadow: 0 0 0 5px rgba(var(--accent-rgb), 0.35), 0 1px 3px rgba(0, 0, 0, 0.12); }
}

.avatar-speaking {
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.3), 0 1px 3px rgba(0, 0, 0, 0.12);
    animation: avatar-speak-pulse 1s ease-in-out infinite;
}

@keyframes avatar-speak-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.avatar-amused {
    animation: avatar-amused-tilt 0.4s ease-out 1;
}

@keyframes avatar-amused-tilt {
    0% { transform: rotate(0deg); }
    30% { transform: rotate(3deg); }
    70% { transform: rotate(-1deg); }
    100% { transform: rotate(0deg); }
}

.avatar-oops {
    animation: avatar-shake 0.3s ease-out 1;
}

@keyframes avatar-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
}

@media (prefers-reduced-motion: reduce) {
    .avatar-thinking,
    .avatar-speaking,
    .avatar-amused,
    .avatar-oops {
        animation: none;
    }
}

.message {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.6;
    word-wrap: break-word;
}

.message-user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: var(--msg-user-text);
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 4px rgba(var(--primary-rgb), 0.25);
}

.message-assistant {
    align-self: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.message-assistant.streaming {
    /* Subtle pulse animation while streaming */
    animation: streaming-pulse 1.5s ease-in-out infinite;
}

@keyframes streaming-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.system-message {
    align-self: center;
    background: var(--msg-system);
    color: var(--text-muted);
    font-size: 0.8125rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    text-align: center;
}

.message-error {
    align-self: center;
    background: var(--error-bg);
    color: var(--error);
    font-size: 0.8125rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
}

/* ── Response Cards ───────────────────────────────────────────── */
.response-card {
    max-width: 75%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: card-appear 0.3s ease-out;
}

@keyframes card-appear {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .response-card { animation: none; }
}

.response-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.response-card-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
}

.response-card-name {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text);
    font-size: 0.8125rem;
}

.response-card-meta {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-left: auto;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.response-card-meta .card-state {
    font-family: var(--font-heading);
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.04em;
    font-size: 0.5625rem;
    padding: 0.1rem 0.375rem;
    border-radius: 3px;
    background: var(--bg);
}

.response-card-quip {
    font-style: italic;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* Card tab bar */
.response-card-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.response-card-tab {
    flex: 1;
    padding: 0.4375rem 0.75rem;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    text-align: center;
}

.response-card-tab:hover {
    color: var(--text);
}

.response-card-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.response-card-tab.disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.response-card-tab-count {
    font-size: 0.625rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

/* Card content panels */
.response-card-body {
    padding: 0.75rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.6;
    word-wrap: break-word;
    transition: max-height 0.25s ease-out;
    overflow: hidden;
}

.response-card-panel {
    display: none;
}

.response-card-panel.active {
    display: block;
    transition: opacity 150ms ease-out;
}

/* Card footer */
.response-card-footer {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.875rem;
    border-top: 1px solid var(--border);
}

.response-card-footer .card-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 4px;
    background: none;
    color: var(--text-muted);
    font-size: 0.6875rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.response-card-footer .card-action-btn:hover {
    background: var(--bg);
    color: var(--text);
}

.response-card-footer .card-action-btn.selected {
    color: var(--primary);
}

/* Compact card (short responses, no tabs) */
.response-card.compact .response-card-tabs {
    display: none;
}

.response-card.compact .response-card-body {
    padding: 0.625rem 0.875rem;
}

/* Streaming card */
.response-card.streaming .response-card-tab:not(.active) {
    opacity: 0.3;
    pointer-events: none;
}

.response-card.streaming .response-card-body {
    animation: streaming-pulse 1.5s ease-in-out infinite;
}

/* Self-correction indicator */
.response-card.recovered {
    border-left: 3px solid var(--accent);
}

/* ── Skeleton Card ───────────────────────────────────────────── */
.response-card.skeleton .skeleton-body {
    padding: 1rem 0.875rem;
}

.skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--border) 25%, #f0eeec 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 2s ease-in-out infinite;
    margin-bottom: 0.625rem;
}

.skeleton-line:last-child {
    margin-bottom: 0;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Content Crossfade (non-destructive clear) ───────────────── */
.content-clearing {
    opacity: 0.3;
    transition: opacity 150ms ease-out;
}

/* ── Tool-Working State ──────────────────────────────────────── */
.response-card.tool-working .response-card-panel.active {
    opacity: 0.5;
    transition: opacity 200ms ease;
}

.response-card.tool-working::after {
    content: 'Working with tools\2026';
    display: block;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    font-family: var(--font-heading);
    color: var(--accent);
    font-weight: 500;
    animation: tool-dots 1.5s steps(3, end) infinite;
}

@keyframes tool-dots {
    0% { content: 'Working with tools.'; }
    33% { content: 'Working with tools..'; }
    66% { content: 'Working with tools\2026'; }
}

/* ── In-Card Error State ─────────────────────────────────────── */
.response-card.error-state {
    border-left: 3px solid var(--error, #DC2626);
}

.response-card.error-state .response-card-tabs {
    display: none;
}

.card-error-icon {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.card-error-message {
    color: var(--text);
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0 0 0.75rem;
}

.card-retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-family: var(--font-heading);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.card-retry-btn:hover {
    background: var(--primary-hover);
}

/* ── Partial Response Preservation (Phase 4C) ───────────────── */
.partial-response-details {
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.partial-response-details summary {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: var(--surface-alt, #f9f8f7);
    user-select: none;
}

.partial-response-details summary:hover {
    color: var(--text);
}

.partial-response-content {
    padding: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    max-height: 300px;
    overflow-y: auto;
    border-top: 1px solid var(--border);
}

/* ── Streaming Cursor (thin pipe, like Claude) ──────────────── */
.streaming-cursor::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: var(--primary);
    vertical-align: text-bottom;
    animation: cursor-blink 1s step-end infinite;
    margin-left: 2px;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}


/* ── Phase Ribbon (5-dot Thinking Canvas) ────────────────────── */
.phase-ribbon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0.375rem 0.875rem;
    border-bottom: 1px solid var(--border);
}

.phase-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: transparent;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.phase-dot.active {
    background: var(--accent, #D97706);
    border-color: var(--accent, #D97706);
    box-shadow: 0 0 8px rgba(217, 119, 6, 0.5);
    transform: scale(1.2);
}

.phase-dot.completed {
    background: var(--primary, #0D7377);
    border-color: var(--primary, #0D7377);
}

.phase-dot.error {
    background: var(--error, #DC2626);
    border-color: var(--error, #DC2626);
    animation: phase-error-pulse 1s ease-in-out infinite;
}

@keyframes phase-error-pulse {
    0%, 100% { box-shadow: 0 0 4px rgba(220, 38, 38, 0.3); }
    50% { box-shadow: 0 0 10px rgba(220, 38, 38, 0.6); }
}

.phase-connector {
    width: 16px;
    height: 1.5px;
    background: var(--border);
    transition: background 0.25s ease;
    flex-shrink: 0;
}

.phase-connector.completed {
    background: var(--primary, #0D7377);
}

/* Code in messages */
.message pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 0.875rem 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5rem 0;
    font-size: 0.8125rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.message code {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8125rem;
    font-family: var(--font-mono);
}

.message-user code {
    background: rgba(255, 255, 255, 0.18);
}

.message pre code {
    background: none;
    padding: 0;
}

/* Typography refinements for assistant messages */
.message-assistant h1,
.message-assistant h2,
.message-assistant h3 {
    font-family: var(--font-heading);
    margin-top: 0.75rem;
    margin-bottom: 0.375rem;
    line-height: 1.3;
    color: var(--text);
}

.message-assistant h1 { font-size: 1.125rem; font-weight: 700; }
.message-assistant h2 { font-size: 1rem; font-weight: 700; }
.message-assistant h3 { font-size: 0.9375rem; font-weight: 500; }

.message-assistant ul,
.message-assistant ol {
    padding-left: 1.25rem;
    margin: 0.375rem 0;
}

.message-assistant li {
    margin-bottom: 0.25rem;
}

.message-assistant p + p {
    margin-top: 0.5rem;
}

.message-assistant a {
    color: var(--primary);
    text-decoration: none;
}

.message-assistant a:hover {
    text-decoration: underline;
}

/* Loading indicator */
.loading-indicator {
    padding: 0.5rem 1.25rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.loading-dots {
    display: inline-flex;
    gap: 3px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: dot-pulse 1.2s infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dot-pulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* Input area */
.chat-input-area {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    align-items: flex-end;
    flex-shrink: 0;
}

.chat-input-area textarea {
    flex: 1;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 0.875rem;
    resize: none;
    outline: none;
    max-height: 120px;
    line-height: 1.4;
    background: var(--surface);
}

.chat-input-area textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.chat-input-area .btn-primary {
    width: auto;
    flex-shrink: 0;
}

/* ── Status Footer ─────────────────────────────────────────────── */
.status-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 1.25rem;
    background: var(--bg);
    border-top: 1px solid var(--border);
    font-size: 0.6875rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.status-footer-brand {
    font-family: var(--font-heading);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.status-footer-stats {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.status-footer-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.status-footer-stat .dot-online {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}

.status-footer-stat .dot-warning {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

/* ── Ecosystem Health Strip ────────────────────────────────────── */
.sidebar-ecosystem {
    border-top: 1px solid var(--border);
    margin-top: auto;
    padding-top: 0.5rem;
}
.sidebar-ecosystem-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.sidebar-ecosystem-summary {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-weight: 400;
}
.sidebar-ecosystem-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding: 0.25rem 0;
}
.eco-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    cursor: default;
    transition: transform 0.15s ease;
}
.eco-dot:hover {
    transform: scale(1.4);
}
.eco-dot.online  { background: var(--primary); }
.eco-dot.stale   { background: var(--accent); }
.eco-dot.offline { background: var(--text-muted); opacity: 0.5; }

/* Agent mode badge */
.agent-mode-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #fff;
    background: var(--text-muted, #888);
    vertical-align: middle;
}

.mode-idle    { background: var(--text-muted, #888); }
.mode-intake  { background: #3b82f6; }
.mode-plan    { background: #8b5cf6; }
.mode-execute { background: #f59e0b; }
.mode-reflect { background: #14b8a6; }
.mode-respond { background: #22c55e; }
.mode-recover { background: var(--error, #e53e3e); }
.mode-escalate { background: #eab308; color: #1a1a1a; }
.mode-learn   { background: #6b7280; }
.mode-brown   { background: var(--error, #e53e3e); animation: brown-pulse 1s ease-in-out infinite; }

@keyframes brown-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ── Agent State Ribbon ─────────────────────────────────────────── */
.agent-ribbon {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.375rem 1rem 0.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.agent-ribbon-track {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    max-width: 480px;
    position: relative;
}

.agent-ribbon-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    z-index: 1;
}

.agent-ribbon-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: transparent;
    transition: all 0.3s ease-out;
    position: relative;
}

.agent-ribbon-step.completed .agent-ribbon-dot {
    background: var(--primary);
    border-color: var(--primary);
}

.agent-ribbon-step.active .agent-ribbon-dot {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.2);
    animation: ribbon-glow 2s ease-in-out infinite;
}

.agent-ribbon-step.recover .agent-ribbon-dot {
    background: var(--error);
    border-color: var(--error);
    animation: ribbon-recover-pulse 0.6s ease-in-out 3;
}

@keyframes ribbon-glow {
    0%, 100% { box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.2); }
    50% { box-shadow: 0 0 0 6px rgba(var(--accent-rgb), 0.3); }
}

@keyframes ribbon-recover-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

.agent-ribbon-label {
    font-family: var(--font-heading);
    font-size: 0.5625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-top: 0.25rem;
    transition: color 0.3s;
}

.agent-ribbon-step.active .agent-ribbon-label {
    color: var(--accent);
    font-weight: 700;
}

.agent-ribbon-step.completed .agent-ribbon-label {
    color: var(--primary);
}

/* Connecting lines between dots */
.agent-ribbon-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin: 0 -2px;
    position: relative;
    top: -0.625rem; /* align with dots vertically */
    z-index: 0;
    transition: background 0.3s ease-out;
}

.agent-ribbon-line.completed {
    background: var(--primary);
}

.agent-ribbon-line.active {
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
}

/* Quip text below ribbon */
.agent-ribbon-quip {
    font-size: 0.75rem;
    font-style: italic;
    color: var(--text-muted);
    margin-top: 0.125rem;
    min-height: 1.125rem;
    transition: opacity 0.15s;
    text-align: center;
}

/* Idle state: ribbon is quiet */
.agent-ribbon.idle .agent-ribbon-dot {
    border-color: var(--border);
    background: transparent;
    box-shadow: none;
}

.agent-ribbon.idle .agent-ribbon-label {
    color: var(--border);
}

.agent-ribbon.idle .agent-ribbon-quip {
    opacity: 0;
}

/* Mobile: collapse to single line */
@media (max-width: 768px) {
    .agent-ribbon-track {
        display: none;
    }
    .agent-ribbon {
        flex-direction: row;
        gap: 0.5rem;
        padding: 0.25rem 0.75rem;
        justify-content: center;
    }
    .agent-ribbon-mobile {
        display: flex;
        align-items: center;
        gap: 0.375rem;
        font-size: 0.75rem;
    }
    .agent-ribbon-mobile-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--text-muted);
    }
    .agent-ribbon-mobile-dot.active {
        background: var(--accent);
        box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.2);
    }
    .agent-ribbon-mobile-state {
        font-family: var(--font-heading);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text);
        font-size: 0.6875rem;
    }
    .agent-ribbon-mobile-quip {
        font-style: italic;
        color: var(--text-muted);
    }
}

@media (min-width: 769px) {
    .agent-ribbon-mobile {
        display: none;
    }
}

/* ── Reduced motion ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .agent-ribbon-step.active .agent-ribbon-dot {
        animation: none;
    }
    .agent-ribbon-step.recover .agent-ribbon-dot {
        animation: none;
    }
}

/* Stop button */
.btn-stop {
    flex-shrink: 0;
    background: var(--error);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
}

.btn-stop:hover {
    opacity: 0.9;
}

/* Voice button */
.btn-voice {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.btn-voice:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.btn-voice.recording {
    background: var(--error);
    color: #fff;
    border-color: var(--error);
    animation: pulse-recording 1.5s ease-in-out infinite;
}

@keyframes pulse-recording {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

/* Voice active speaking state — green pulse when speech detected */
.btn-voice.recording.voice-speaking {
    background: #16a34a;
    border-color: #16a34a;
    animation: pulse-speaking 0.8s ease-in-out infinite;
}

@keyframes pulse-speaking {
    0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
}

/* Voice playing TTS response — blue pulse */
.btn-voice.voice-playing {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    animation: pulse-playing 1s ease-in-out infinite;
}

@keyframes pulse-playing {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.85; }
}

/* Hands-free active state — teal glow on mic button */
.btn-voice.hands-free-active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 115, 119, 0.2);
}

/* Recording while hands-free: red pulse overrides teal */
.btn-voice.hands-free-active.recording {
    background: var(--error);
    border-color: var(--error);
    box-shadow: none;
}

/* Locked text input during hands-free mode */
.hands-free-locked {
    opacity: 0.4;
    cursor: not-allowed !important;
    background: var(--bg-secondary) !important;
    pointer-events: none;
}

/* Speaking indicator — pulsing dot when TTS is active */
.speaking-indicator {
    display: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    margin-left: 0.25rem;
    flex-shrink: 0;
}

.speaking-indicator.active {
    display: inline-block;
    animation: pulse-speaking 1.2s ease-in-out infinite;
}

@keyframes pulse-speaking {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

/* Stop speaking button */
.btn-stop-speaking {
    color: var(--muted);
    cursor: pointer;
    padding: 0.25rem;
    border: none;
    background: none;
    border-radius: 4px;
    transition: color 0.15s;
}

.btn-stop-speaking:hover {
    color: var(--danger, #ef4444);
}

/* Voice level indicator bar */
.voice-level-indicator {
    display: none;
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.voice-level-indicator::after {
    content: '';
    display: block;
    height: 100%;
    width: var(--voice-level, 0%);
    background: #16a34a;
    border-radius: 2px;
    transition: width 0.1s ease-out;
}

/* Voice button container needs relative positioning for level indicator */
.btn-voice {
    position: relative;
}

/* Attach file button */
.btn-attach {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.btn-attach:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.btn-attach.uploading {
    opacity: 0.5;
    pointer-events: none;
}

.file-upload-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
}

.file-upload-status .file-name {
    font-weight: 500;
    color: var(--text);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-upload-status .file-remove {
    cursor: pointer;
    color: var(--text-muted);
    margin-left: auto;
    font-size: 1rem;
    line-height: 1;
}

.file-upload-status .file-remove:hover {
    color: var(--error);
}

/* Document download cards in chat messages */
.document-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.document-card-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #eff6ff;
}

.document-icon-pptx { background: #fff1f2; }
.document-icon-docx { background: #eff6ff; }
.document-icon-xlsx { background: #f0fdf4; }
.document-icon-pdf  { background: #fef2f2; }
.document-icon-png  { background: #fefce8; }
.document-icon-csv  { background: #f0fdf4; }

.document-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.document-card-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-card-type {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.document-card-download {
    flex-shrink: 0;
    padding: 0.375rem 0.75rem;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: background 0.15s;
}

.document-card-download:hover {
    background: var(--primary-hover, var(--primary));
    opacity: 0.9;
}

/* Search Result Cards */
.search-results-container {
    margin: 0.75rem 0;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.search-results-header {
    padding: 0.625rem 1rem;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border-bottom: 2px solid var(--primary);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.01em;
}

.search-results-header strong {
    color: var(--primary);
}

.search-result-card {
    display: flex;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    margin: 0;
    border: 1px solid var(--border);
    border-top: none;
    background: var(--bg);
    transition: background 0.15s;
}

.search-result-card:last-child {
    border-radius: 0 0 var(--radius) var(--radius);
}

.search-result-card:hover {
    background: var(--surface);
}

.search-result-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-result-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.search-result-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.15s;
}

.search-result-title:hover {
    color: var(--primary-hover, var(--primary));
    text-decoration: underline;
}

.search-result-url {
    font-size: 0.75rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-snippet {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 500;
    border-radius: 3px;
    text-transform: lowercase;
    background: var(--surface);
    color: var(--text-muted);
}

.search-result-badge.badge-web {
    background: #ccfbf1;
    color: var(--primary);
}

.search-result-badge.badge-knowledge_base {
    background: #f5f3ff;
    color: #7c3aed;
}

.search-result-badge.badge-conversation {
    background: #fef3c7;
    color: #b45309;
}

.search-result-badge.badge-document {
    background: #f3e8ff;
    color: #a855f7;
}

.search-result-badge.badge-duckduckgo {
    background: #fef3c7;
    color: #d97706;
}

.search-result-badge.badge-conversation_history {
    background: #fef3c7;
    color: #b45309;
}

/* Highlight card when citation link is clicked */
.search-result-card:target {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 59, 130, 246), 0.2);
}

/* Citation superscript links */
.citation-link {
    font-size: 0.7rem;
    color: var(--primary);
    text-decoration: none;
    vertical-align: super;
    font-weight: 600;
    padding: 0 1px;
}

.citation-link:hover {
    text-decoration: underline;
}

/* SSO Buttons */
.sso-divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.sso-divider::before,
.sso-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.sso-divider span {
    padding: 0 0.75rem;
}

.btn-sso {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.625rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-sso:hover {
    background: var(--bg);
    border-color: var(--text-muted);
}

.btn-microsoft svg {
    flex-shrink: 0;
}

/* ── Focus-Visible Styles ─────────────────────────────────────── */
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-sm:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-icon:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius);
}

.btn-stop:focus-visible,
.btn-voice:focus-visible,
.btn-attach:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.admin-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.response-card-tab:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    border-radius: 2px;
}

.card-action-btn:focus-visible,
.card-feedback-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.sidebar-project-item:focus-visible,
.sidebar-conv-item:focus-visible,
.history-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    border-radius: 4px;
}

.admin-dropdown a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    background: var(--bg);
}

.message-assistant a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ── Comprehensive Reduced-Motion ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .message-assistant.streaming {
        animation: none;
    }
    .response-card.streaming .response-card-body {
        animation: none;
    }
    .btn-voice.recording,
    .btn-voice.recording.voice-speaking,
    .btn-voice.voice-playing {
        animation: none;
    }
    .badge-pending {
        animation: none;
    }
    .response-card-tab,
    .chat-sidebar,
    .btn-icon,
    .btn-primary,
    .btn-secondary {
        transition: none;
    }
    .eco-dot {
        transition: none;
    }
    /* Skeleton & phase ribbon */
    .skeleton-line {
        animation: none;
        background: var(--border);
    }
    .phase-dot {
        transition: none;
    }
    .phase-dot.active {
        box-shadow: none;
        transform: none;
    }
    .phase-dot.error {
        animation: none;
    }
    .phase-connector {
        transition: none;
    }
    .streaming-cursor::after {
        animation: none;
        opacity: 1;
    }
    .content-clearing {
        transition: none;
        opacity: 0;
    }
    .response-card-body {
        transition: none;
    }
    .response-card-panel {
        transition: none;
    }
    .response-card.tool-working .response-card-panel.active {
        transition: none;
    }
    .card-retry-btn {
        transition: none;
    }
    .chat-messages {
        scroll-behavior: auto;
    }
}

/* ── Responsive: Tablet (768px) ──────────────────────────────── */
@media (max-width: 768px) {
    .chat-sidebar.open {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 100;
        width: 80vw;
        min-width: 80vw;
        max-width: 320px;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
    }

    .message {
        max-width: 90%;
    }

    .response-card {
        max-width: 92%;
    }

    .response-card-tab {
        font-size: 0.6875rem;
        padding: 0.5rem 0.375rem;
        min-height: 44px;
    }

    .chat-header {
        padding: 0.625rem 0.75rem;
    }

    .chat-messages {
        padding: 0.75rem;
    }

    .chat-input-area {
        padding: 0.625rem 0.75rem;
    }

    .status-footer {
        font-size: 0.625rem;
        padding: 0.375rem 0.75rem;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .sidebar-ecosystem-dots {
        gap: 0.25rem;
    }

    .eco-dot {
        width: 12px;
        height: 12px;
    }
}

/* ── Responsive: Small Phone (480px) ─────────────────────────── */
@media (max-width: 480px) {
    .user-info {
        display: none;
    }

    .header-right {
        gap: 0.25rem;
    }

    .chat-header h1 {
        font-size: 1rem;
    }

    .message {
        max-width: 95%;
        font-size: 0.8125rem;
    }

    .response-card {
        max-width: 98%;
    }

    .response-card-header {
        padding: 0.5rem 0.625rem;
    }

    .response-card-body {
        padding: 0.5rem 0.625rem;
    }

    .response-card-tabs {
        overflow-x: auto;
    }

    .response-card-tab {
        white-space: nowrap;
        flex: 0 0 auto;
    }

    .response-card-footer {
        padding: 0.375rem 0.625rem;
    }

    .status-footer {
        font-size: 0.5625rem;
    }
}

/* ── Admin Panel ─────────────────────────────────────────────────── */

/* Admin Menu Dropdown */
.admin-menu-wrapper {
    position: relative;
}

.admin-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 200;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    padding: 0.25rem 0;
    margin-top: 0.25rem;
}

.admin-dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
}

.admin-dropdown a:hover {
    background: var(--bg);
}

/* ── Admin Accordion Categories ── */

.admin-category {
    border-top: 1px solid var(--border);
}

.admin-category:first-of-type {
    border-top: none;
}

.admin-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.admin-category-header:hover {
    background: var(--bg);
    color: var(--text);
}

.admin-category-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.admin-category.expanded .admin-category-chevron {
    transform: rotate(180deg);
}

.admin-category-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.admin-category.expanded .admin-category-items {
    max-height: 500px;
}

/* ── Notification Bell & Dropdown ── */

.notification-wrapper {
    position: relative;
}

.notification-bell {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--error, #dc2626);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    border: 2px solid var(--surface, #fff);
    pointer-events: none;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 200;
    width: 340px;
    max-height: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    margin-top: 0.35rem;
    display: flex;
    flex-direction: column;
}

.notification-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.875rem;
}

.notification-dropdown-header .btn-link {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
}

.notification-dropdown-header .btn-link:hover {
    text-decoration: underline;
}

.notification-list {
    overflow-y: auto;
    flex: 1;
    max-height: 360px;
}

.notification-item {
    display: flex;
    gap: 0.65rem;
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: var(--bg, #f8fafc);
}

.notification-item.unread {
    background: #f0f7ff;
}

.notification-item.unread:hover {
    background: #e0efff;
}

.notification-item-indicator {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
}

.notification-item-body {
    flex: 1;
    min-width: 0;
}

.notification-item-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-item-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.notification-item-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.notification-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* Severity indicators */
.severity-info    { background: var(--primary, #2563eb); }
.severity-warning { background: #f59e0b; }
.severity-error   { background: var(--error, #dc2626); }
.severity-critical {
    background: var(--error, #dc2626);
    animation: brown-pulse 1s ease-in-out infinite;
}

/* Severity left borders on items */
.notification-item.sev-info    { border-left-color: var(--primary, #2563eb); }
.notification-item.sev-warning { border-left-color: #f59e0b; }
.notification-item.sev-error   { border-left-color: var(--error, #dc2626); }
.notification-item.sev-critical { border-left-color: var(--error, #dc2626); }

/* Slide-Out Panel */
.admin-panel {
    width: 0;
    min-width: 0;
    overflow: hidden;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, min-width 0.3s ease;
}

.admin-panel.open {
    width: 420px;
    min-width: 420px;
}

.admin-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--primary);
    color: #fff;
    flex-shrink: 0;
}

.admin-panel-header h2 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
}

.admin-panel-header .btn-icon {
    color: #fff;
    font-size: 1.25rem;
}

.admin-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.admin-installer-card {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 1px solid #86efac;
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

/* Panel Content Styles */
.admin-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.admin-stat-card {
    background: var(--bg);
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.admin-stat-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.admin-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

/* Admin Tables */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.admin-table th {
    text-align: left;
    padding: 0.5rem 0.375rem;
    border-bottom: 2px solid var(--border);
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.admin-table td {
    padding: 0.5rem 0.375rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.admin-table tr:hover {
    background: var(--bg);
}

/* Badges */
.admin-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
    animation: pending-pulse 2s ease-in-out infinite;
}

.badge-suspended {
    background: #fef3c7;
    color: #92400e;
}

.badge-revoked {
    background: #fee2e2;
    color: #991b1b;
}

.badge-disabled {
    background: #f1f5f9;
    color: #475569;
}

.badge-reachable {
    background: #ccfbf1;
    color: var(--primary);
}

.badge-mesh {
    background: #dbeafe;
    color: #1e40af;
}

.badge-offgrid {
    background: #ede9fe;
    color: #5b21b6;
}

.badge-stale {
    background: #fff7ed;
    color: #9a3412;
}

.badge-owner {
    background: #ede9fe;
    color: #5b21b6;
}

.badge-admin {
    background: #ccfbf1;
    color: var(--primary);
}

.badge-user {
    background: #f1f5f9;
    color: #475569;
}

/* ── Fleet Panel Redesign (R1-R6) ──────────────────────────────────── */

/* R1: Deploy dropdown */
.fleet-deploy-dropdown {
    position: relative;
    display: inline-block;
}

.fleet-deploy-dropdown .fleet-deploy-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.25rem);
    z-index: 50;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    min-width: 320px;
    padding: 0.75rem;
}

.fleet-deploy-dropdown.open .fleet-deploy-menu {
    display: block;
}

.fleet-deploy-section {
    padding: 0.5rem 0;
}

.fleet-deploy-section + .fleet-deploy-section {
    border-top: 1px solid var(--border);
}

.fleet-deploy-section .deploy-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.375rem;
}

/* R2: Compact status bar */
.fleet-status-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
}

.fleet-status-segment {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    transition: background 0.15s;
}

.fleet-status-segment:hover {
    background: var(--border);
}

.fleet-status-segment.active {
    background: var(--border);
    font-weight: 600;
}

.fleet-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.fleet-status-segment .fleet-status-count {
    font-weight: 700;
}

/* R3: Card-based device rows */
.fleet-device-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.fleet-device-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.fleet-device-card:hover {
    border-color: var(--primary);
    box-shadow: 0 1px 4px rgba(13, 115, 119, 0.08);
}

.fleet-device-card.expanded {
    border-color: var(--primary);
}

.fleet-device-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fleet-device-card-header .device-name {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fleet-device-card-header .device-name small {
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

.fleet-device-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    padding-left: 1.375rem;
}

.fleet-device-card-meta span {
    white-space: nowrap;
}

/* R4: Expandable device detail */
.fleet-device-expand {
    display: none;
    margin-top: 0.625rem;
    padding-top: 0.625rem;
    border-top: 1px solid var(--border);
}

.fleet-device-card.expanded .fleet-device-expand {
    display: block;
}

.fleet-device-expand-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.375rem 1rem;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.fleet-device-expand-grid dt {
    color: var(--text-muted);
    font-size: 0.6875rem;
}

.fleet-device-expand-grid dd {
    margin: 0;
    color: var(--text);
    font-weight: 500;
}

.fleet-device-actions {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* R5: Filter bar */
.fleet-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.625rem;
    flex-wrap: wrap;
}

.fleet-filter-bar input[type="text"] {
    flex: 1;
    min-width: 120px;
    padding: 0.375rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 0.8125rem;
}

.fleet-filter-bar input[type="text"]::placeholder {
    color: var(--text-muted);
}

.fleet-filter-pills {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.fleet-filter-pill {
    padding: 0.1875rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.6875rem;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.fleet-filter-pill:hover {
    border-color: var(--primary);
    color: var(--text);
}

.fleet-filter-pill.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* R6: Heartbeat source indicators */
.fleet-heartbeat-sources {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.6875rem;
    margin-top: 0.375rem;
}

.fleet-heartbeat-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.fleet-heartbeat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.fleet-heartbeat-dot.active { background: #16a34a; }
.fleet-heartbeat-dot.inactive { background: #d1d5db; }
.fleet-heartbeat-dot.warning { background: #f59e0b; }

.fleet-chevron {
    transition: transform 0.2s;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.fleet-device-card.expanded .fleet-chevron {
    transform: rotate(180deg);
}

@keyframes pending-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(1rem); }
    to { opacity: 1; transform: translateX(0); }
}

/* Admin Buttons */
.admin-btn {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-size: 0.75rem;
    cursor: pointer;
    background: var(--surface);
    line-height: 1.2;
}

.admin-btn:hover {
    background: var(--bg);
}

.admin-btn-approve {
    color: var(--primary);
    border-color: var(--primary);
}

.admin-btn-approve:hover {
    background: #ccfbf1;
}

.admin-btn-danger {
    color: #991b1b;
    border-color: #ef4444;
}

.admin-btn-danger:hover {
    background: #fee2e2;
}

.admin-btn-success {
    color: #166534;
    border-color: var(--success);
}

.admin-btn-success:hover {
    background: #dcfce7;
}

.admin-btn-sm {
    padding: 0.125rem 0.375rem;
    font-size: 0.6875rem;
}

.admin-btn-warn {
    color: #92400e;
    border-color: var(--accent);
}

.admin-btn-warn:hover {
    background: #fef3c7;
}

.admin-btn-primary {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.admin-btn-primary:hover {
    background: var(--primary-hover);
}

.admin-form-search {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8125rem;
    margin-bottom: 0.25rem;
}

.admin-form-search:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.15);
}

/* Section Headers */
.admin-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin: 1rem 0 0.5rem;
    letter-spacing: 0.025em;
}

/* Audit Filter Bar */
.admin-filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.admin-filter-bar select {
    padding: 0.375rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    background: var(--surface);
}

/* Loading State */
.admin-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}
.admin-loading::before {
    content: '';
    display: block;
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-color, #2a2d3a);
    border-top-color: var(--primary, #0D7377);
    border-radius: 50%;
    margin: 0 auto 0.75rem;
    animation: admin-spin 0.8s linear infinite;
}
@keyframes admin-spin {
    to { transform: rotate(360deg); }
}

/* Error State */
.admin-error {
    text-align: center;
    padding: 1.5rem;
    color: #ef4444;
    font-size: 0.875rem;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 8px;
    margin: 1rem 0;
    white-space: pre-wrap;
}

/* Empty State */
.admin-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Recent Events List */
.admin-event-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-event-item {
    display: flex;
    justify-content: space-between;
    padding: 0.375rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.8125rem;
}

.admin-event-type {
    font-weight: 500;
}

.admin-event-time {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .admin-panel.open {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        width: 100vw;
        min-width: 100vw;
        box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
    }

    .admin-stat-grid {
        grid-template-columns: 1fr;
    }

    .admin-dropdown {
        right: -1rem;
    }
}

/* ── Preview Panel (slide-out) ────────────────────────────────────── */

.preview-panel {
    width: 0;
    min-width: 0;
    overflow: hidden;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, min-width 0.3s ease;
}

.preview-panel.open {
    width: 480px;
    min-width: 480px;
}

.preview-panel.fullscreen {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    min-width: 100vw;
    z-index: 200;
    border-left: none;
}

.preview-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--primary);
    color: #fff;
    flex-shrink: 0;
}

.preview-panel-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    overflow: hidden;
}

.preview-panel-header-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.preview-panel-header h2 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-panel-header .btn-icon {
    color: #fff;
    font-size: 1.25rem;
}

.preview-panel-type-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.preview-panel-type-badge {
    font-size: 0.65rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    flex-shrink: 0;
}

.preview-panel-new-badge {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: preview-badge-pulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes preview-badge-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.preview-panel-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
}

.preview-panel-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

/* Preview Overlay (mobile backdrop) */
.preview-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
}

.preview-overlay.visible {
    display: block;
}

/* Preview: Markdown Content */
.preview-panel-body h1 { font-size: 1.5rem; margin: 0 0 0.75rem; color: var(--text); }
.preview-panel-body h2 { font-size: 1.25rem; margin: 1rem 0 0.5rem; color: var(--text); }
.preview-panel-body h3 { font-size: 1.1rem; margin: 0.75rem 0 0.5rem; color: var(--text); }
.preview-panel-body p { margin: 0 0 0.75rem; line-height: 1.6; }
.preview-panel-body ul,
.preview-panel-body ol { margin: 0 0 0.75rem; padding-left: 1.5rem; }
.preview-panel-body li { margin-bottom: 0.25rem; }
.preview-panel-body blockquote {
    border-left: 3px solid var(--primary);
    margin: 0 0 0.75rem;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    background: var(--bg);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.preview-panel-body a {
    color: var(--primary);
    text-decoration: underline;
}

/* Preview: Code blocks (highlight.js integration) */
.preview-panel-body pre {
    margin: 0 0 0.75rem;
    border-radius: var(--radius);
    overflow-x: auto;
}

.preview-panel-body pre code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    display: block;
    padding: 1rem;
}

.preview-panel-body code:not(pre code) {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    background: var(--bg);
    padding: 0.15em 0.35em;
    border-radius: 3px;
    color: var(--primary);
}

/* Preview: Data Table */
.preview-data-table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    margin: 0 0 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.preview-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    white-space: nowrap;
}

.preview-data-table th {
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 1;
    font-weight: 600;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid var(--primary);
    cursor: pointer;
    user-select: none;
}

.preview-data-table th:hover {
    background: color-mix(in srgb, var(--primary) 10%, var(--bg));
}

.preview-data-table th .sort-indicator {
    margin-left: 0.25rem;
    opacity: 0.5;
}

.preview-data-table td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--border);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-data-table tr:nth-child(even) td {
    background: var(--bg);
}

.preview-data-table tr:hover td {
    background: color-mix(in srgb, var(--primary) 5%, var(--surface));
}

.preview-table-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.5rem;
    text-align: center;
}

.preview-table-load-all {
    display: block;
    width: 100%;
    padding: 0.5rem;
    text-align: center;
    background: var(--bg);
    border: none;
    border-top: 1px solid var(--border);
    color: var(--primary);
    cursor: pointer;
    font-size: 0.8rem;
}

.preview-table-load-all:hover {
    background: color-mix(in srgb, var(--primary) 10%, var(--bg));
}

/* Preview: JSON Tree */
.json-tree {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    padding: 0.5rem;
}

.json-tree-line {
    padding-left: 1.25em;
    position: relative;
}

.json-tree-toggle {
    cursor: pointer;
    user-select: none;
    color: var(--text-muted);
    display: inline-block;
    width: 1em;
    text-align: center;
    margin-right: 0.25em;
}

.json-tree-toggle:hover {
    color: var(--primary);
}

.json-tree-key {
    color: var(--primary);
    font-weight: 500;
}

.json-tree-string { color: #22c55e; }
.json-tree-number { color: #3b82f6; }
.json-tree-boolean { color: var(--accent); }
.json-tree-null { color: var(--text-muted); font-style: italic; }

.json-tree-collapsed {
    color: var(--text-muted);
    font-style: italic;
}

/* Preview: Image */
.preview-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.preview-image-container img {
    max-width: 100%;
    max-height: calc(100vh - 200px);
    object-fit: contain;
    border-radius: var(--radius);
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

.preview-image-container img.zoomed {
    cursor: zoom-out;
    max-width: none;
    max-height: none;
}

/* Preview: Document Card (for non-inline-viewable types) */
.preview-doc-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.preview-doc-card-icon {
    font-size: 3rem;
}

.preview-doc-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-all;
}

.preview-doc-card-type {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Preview: Extracted document content (DOCX/PPTX/XLSX) */
.preview-extracted-doc {
    padding: 1rem 1.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
    overflow-y: auto;
}
.preview-extracted-doc h1 { font-size: 1.5rem; margin: 1.25rem 0 0.5rem; font-weight: 700; }
.preview-extracted-doc h2 { font-size: 1.25rem; margin: 1rem 0 0.4rem; font-weight: 600; }
.preview-extracted-doc h3 { font-size: 1.1rem; margin: 0.75rem 0 0.3rem; font-weight: 600; }
.preview-extracted-doc p { margin: 0.4rem 0; }
.preview-extracted-doc ul, .preview-extracted-doc ol { margin: 0.4rem 0 0.4rem 1.5rem; }
.preview-extracted-doc li { margin: 0.15rem 0; }
.preview-extracted-doc table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
    font-size: 0.85rem;
}
.preview-extracted-doc th, .preview-extracted-doc td {
    border: 1px solid var(--border);
    padding: 0.4rem 0.6rem;
    text-align: left;
}
.preview-extracted-doc th {
    background: var(--bg-secondary);
    font-weight: 600;
}
.preview-extracted-doc hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}

/* Preview: PDF iframe */
.preview-pdf-frame {
    width: 100%;
    height: calc(100vh - 200px);
    border: none;
    border-radius: var(--radius);
}

/* Document Card: Preview button */
.document-card-preview {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.15s ease;
}

.document-card-preview:hover {
    background: color-mix(in srgb, var(--primary) 10%, var(--bg));
}

/* Preview Panel: Accessibility */
.preview-panel :focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.preview-panel-body :focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .preview-panel {
        transition: none;
    }
    .preview-panel-new-badge {
        animation: none;
    }
}

/* Preview Panel: Mobile */
@media (max-width: 768px) {
    .preview-panel.open {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        width: 100vw;
        min-width: 100vw;
        box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
    }
}

/* ── User Functions Menu & Panel ──────────────────────────────────── */

.user-menu-wrapper {
    position: relative;
}

.user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 200;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    padding: 0.25rem 0;
    margin-top: 0.25rem;
}

.user-menu-dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
}

.user-menu-dropdown a:hover {
    background: var(--bg);
}

/* User Functions Panel (slide-out) */
.user-panel {
    width: 0;
    min-width: 0;
    overflow: hidden;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, min-width 0.3s ease;
}

.user-panel.open {
    width: 400px;
    min-width: 400px;
}

.user-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--primary);
    color: #fff;
    flex-shrink: 0;
}

.user-panel-header h2 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
}

.user-panel-header .btn-icon {
    color: #fff;
    font-size: 1.25rem;
}

.user-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* User Panel Content Styles */
.user-panel-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.user-panel-stat-card {
    background: var(--bg);
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.user-panel-stat-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.user-panel-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.user-panel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.user-panel-table th {
    text-align: left;
    padding: 0.5rem 0.375rem;
    border-bottom: 2px solid var(--border);
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.user-panel-table td {
    padding: 0.5rem 0.375rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.user-panel-table tr:hover {
    background: var(--bg);
}

.user-panel-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
}

.user-panel-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.user-panel-card-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.user-panel-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-panel-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.user-panel-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.user-panel-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin: 1rem 0 0.5rem;
    letter-spacing: 0.025em;
}

.user-panel-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.user-panel-toggle-label {
    font-size: 0.875rem;
}

.user-panel-toggle {
    position: relative;
    width: 36px;
    height: 20px;
}

.user-panel-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.user-panel-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border);
    border-radius: 10px;
    transition: 0.2s;
}

.user-panel-toggle-slider:before {
    content: "";
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
}

.user-panel-toggle input:checked + .user-panel-toggle-slider {
    background: var(--primary);
}

.user-panel-toggle input:checked + .user-panel-toggle-slider:before {
    transform: translateX(16px);
}

.user-panel-btn {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-size: 0.75rem;
    cursor: pointer;
    background: var(--surface);
    line-height: 1.2;
}

.user-panel-btn:hover {
    background: var(--bg);
}

.user-panel-input {
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8125rem;
    background: var(--bg);
    color: var(--fg);
}

.user-panel-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ── Message Feedback Buttons ────────────────────────────────────── */

.message-feedback {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.message-row:hover .message-feedback,
.message-feedback.has-selection {
    opacity: 1;
}

.message-feedback-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 0.125rem 0.375rem;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    line-height: 1;
}

.message-feedback-btn:hover {
    border-color: var(--border);
    color: var(--text);
}

.message-feedback-btn.selected {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

@media (max-width: 768px) {
    .user-panel.open {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        width: 100vw;
        min-width: 100vw;
        box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
    }

    .user-panel-stat-grid {
        grid-template-columns: 1fr;
    }

    .user-menu-dropdown {
        right: -1rem;
    }

    .message-feedback {
        opacity: 1;
    }
}

/* ── JENNHelp Full-Page Chat ──────────────────────────────────────── */

.jennhelp-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg);
}

.jennhelp-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: var(--primary);
    color: #fff;
    flex-shrink: 0;
}

.jennhelp-back {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.85rem;
    margin-right: 0.25rem;
}

.jennhelp-back:hover {
    color: #fff;
}

.jennhelp-header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.jennhelp-header h1 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.jennhelp-user {
    font-size: 0.8rem;
    opacity: 0.85;
}

/* ── Welcome Screen ──────────────────────────────────────────────── */

.jennhelp-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
    flex: 1;
}

.jennhelp-welcome-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    margin-bottom: 1.25rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.jennhelp-welcome h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.5rem;
}

.jennhelp-welcome p {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 420px;
    margin: 0 0 1.5rem;
    line-height: 1.5;
}

.jennhelp-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    max-width: 500px;
}

.jennhelp-suggestion {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.jennhelp-suggestion:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ── Messages Area ───────────────────────────────────────────────── */

.jennhelp-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.help-chat-row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
}

.help-chat-row-user {
    justify-content: flex-end;
}

.help-chat-row-assistant {
    justify-content: flex-start;
}

.help-chat-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
}

.help-chat-msg {
    padding: 0.65rem 0.9rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    line-height: 1.55;
    max-width: 80%;
    word-wrap: break-word;
}

.help-chat-msg-user {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}

.help-chat-msg-assistant {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-bottom-left-radius: 0.25rem;
}

.help-chat-msg-assistant.streaming::after {
    content: '\25CF';
    animation: blink 1s infinite;
    margin-left: 2px;
    color: var(--primary);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.help-chat-msg-assistant pre {
    background: var(--bg);
    padding: 0.6rem;
    border-radius: 0.375rem;
    overflow-x: auto;
    margin: 0.4rem 0;
    font-size: 0.8rem;
}

.help-chat-msg-assistant code {
    font-size: 0.82rem;
}

.help-chat-msg-assistant a {
    color: var(--primary);
    text-decoration: underline;
}

.help-chat-msg-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    max-width: 720px;
    margin: 0 auto;
}

/* ── Input Footer ────────────────────────────────────────────────── */

.jennhelp-input-area {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.jennhelp-input-area textarea {
    flex: 1;
    resize: none;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    line-height: 1.4;
    max-height: 120px;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
}

.jennhelp-input-area textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.jennhelp-input-area button {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.jennhelp-input-area button:hover {
    opacity: 0.85;
}

.jennhelp-input-area button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.jennhelp-input-area button svg {
    width: 18px;
    height: 18px;
}

/* ── JENNHelp Responsive ─────────────────────────────────────────── */

@media (max-width: 768px) {
    .jennhelp-header {
        padding: 0.6rem 1rem;
    }

    .jennhelp-welcome {
        padding: 2rem 1rem;
    }

    .jennhelp-welcome-avatar {
        width: 56px;
        height: 56px;
    }

    .jennhelp-welcome h2 {
        font-size: 1.2rem;
    }

    .jennhelp-suggestions {
        flex-direction: column;
        align-items: center;
    }

    .help-chat-msg {
        max-width: 90%;
    }

    .jennhelp-input-area {
        padding: 0.5rem 0.75rem;
    }
}

/* --- Usage Widget --- */
.usage-widget {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.375rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s;
}
.usage-widget:hover {
    background: var(--msg-assistant);
}
.usage-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.6875rem;
    white-space: nowrap;
}
.usage-pill-value {
    font-weight: 600;
    color: var(--text);
}

/* --- User Settings Panel --- */
.user-settings-panel {
    width: 0;
    min-width: 0;
    overflow: hidden;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, min-width 0.3s ease;
}
.user-settings-panel.open {
    width: 340px;
    min-width: 340px;
}
.user-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--primary);
    color: white;
}
.user-settings-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}
.user-settings-header .btn-icon {
    color: white;
}
.user-settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}
.settings-group {
    margin-bottom: 1.25rem;
}
.settings-group-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.settings-row:last-child {
    border-bottom: none;
}
.settings-label {
    font-size: 0.8125rem;
    color: var(--text);
}
.settings-input select,
.settings-input input[type="checkbox"] {
    accent-color: var(--primary);
}
.settings-input select {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    background: var(--surface);
}
.settings-feedback {
    font-size: 0.75rem;
    color: #16a34a;
    margin-top: 0.5rem;
    text-align: center;
}

/* --- Sidebar Actions --- */
.sidebar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ── Improv Mode ──────────────────────────────────────────────── */

/* Header accent when improv is active */
.chat-header.improv-active {
    border-bottom: 3px solid #a855f7;
}
.chat-header.improv-active h1 {
    color: #a855f7;
}

/* Improv mode button active state */
#improv-mode-btn.improv-active {
    color: #a855f7;
    background: #faf5ff;
}

/* Stage info bar */
.improv-stage {
    background: linear-gradient(135deg, #faf5ff, #fdf2f8);
    border-bottom: 1px solid #e9d5ff;
    padding: 0.5rem 1.25rem;
    flex-shrink: 0;
}
.improv-stage-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.improv-stage-premise {
    flex: 1;
    font-size: 0.8125rem;
    font-weight: 500;
    font-style: italic;
    color: #7c3aed;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.improv-stage-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.improv-character-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: #ede9fe;
    color: #6d28d9;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
}
.improv-turn-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Yes-and score gauge */
.improv-score-gauge {
    width: 60px;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}
.improv-score-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease, background 0.3s ease;
    width: 0%;
    background: var(--success);
}
.improv-score-fill.score-low { background: var(--error); }
.improv-score-fill.score-mid { background: var(--accent); }
.improv-score-fill.score-high { background: var(--success); }

/* Expandable stage details */
.improv-stage-details {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e9d5ff;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    font-size: 0.75rem;
}
.improv-facts-panel,
.improv-callbacks-panel {
    max-height: 120px;
    overflow-y: auto;
}
.improv-detail-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.375rem;
}
.improv-fact-item,
.improv-callback-item {
    margin: 0.25rem 0;
    padding: 0.25rem 0.375rem;
    border-radius: 4px;
    font-size: 0.75rem;
}
.improv-fact-item {
    background: #f5f3ff;
}
.improv-fact-category {
    font-size: 0.625rem;
    color: #6b7280;
    text-transform: uppercase;
    margin-right: 0.25rem;
}
.improv-callback-item {
    background: #fef3c7;
}
.improv-callback-meta {
    font-size: 0.625rem;
    color: #6b7280;
}

/* Controls bar */
.improv-controls {
    display: flex;
    gap: 0.5rem;
    padding: 0.375rem 1.25rem;
    background: var(--bg);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.improv-ctrl-btn {
    padding: 0.25rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.75rem;
    background: var(--surface);
    cursor: pointer;
    transition: background 0.15s;
}
.improv-ctrl-btn:hover {
    background: var(--bg);
}
.improv-ctrl-danger {
    color: #991b1b;
    border-color: #fca5a5;
}
.improv-ctrl-danger:hover {
    background: #fef2f2;
}
.improv-ctrl-exit {
    margin-left: auto;
    color: var(--text-muted);
}

/* Character labels on messages */
.improv-character-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
}
.improv-character-label.role-user {
    color: #059669;
    text-align: right;
}
.improv-character-label.role-agent {
    color: #7c3aed;
}

/* Yes-and score badge */
.improv-score-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    border-radius: 999px;
    font-size: 0.625rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

/* Setup overlay */
.improv-setup-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
}
.improv-setup-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    margin: 1rem;
}
.improv-setup-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #7c3aed;
    margin: 0 0 1rem 0;
}
.improv-setup-card label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.375rem;
}
.improv-setup-card input,
.improv-setup-card textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.improv-setup-card input:focus,
.improv-setup-card textarea:focus {
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}
.improv-setup-field {
    margin-bottom: 1rem;
}
.improv-setup-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.25rem;
}
.improv-setup-actions .btn-primary {
    flex: 1;
    background: #7c3aed;
}
.improv-setup-actions .btn-primary:hover {
    background: #6d28d9;
}
.improv-setup-divider {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 1rem 0;
}
.improv-resume-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.375rem;
    font-size: 0.8125rem;
}
.improv-resume-premise {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 0.5rem;
}
.improv-resume-btn {
    padding: 0.25rem 0.5rem;
    background: #ede9fe;
    color: #6d28d9;
    border: none;
    border-radius: var(--radius);
    font-size: 0.6875rem;
    font-weight: 600;
    cursor: pointer;
}
.improv-resume-btn:hover {
    background: #ddd6fe;
}

/* Scene ended state */
.improv-ended-banner {
    text-align: center;
    padding: 0.75rem;
    background: #f5f3ff;
    border-radius: var(--radius);
    margin: 0.5rem 1rem;
    font-size: 0.8125rem;
    color: #7c3aed;
}
.improv-export-links {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}
.improv-export-link {
    padding: 0.25rem 0.5rem;
    border: 1px solid #e9d5ff;
    border-radius: var(--radius);
    font-size: 0.6875rem;
    color: #7c3aed;
    text-decoration: none;
    cursor: pointer;
}
.improv-export-link:hover {
    background: #ede9fe;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .improv-stage-details {
        grid-template-columns: 1fr;
    }
    .improv-controls {
        flex-wrap: wrap;
    }
    .improv-ctrl-exit {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }
    .improv-setup-card {
        margin: 0.5rem;
        padding: 1.5rem;
    }
}

/* ── Flexbox gap fallback for Safari < 14.1 ──────────────────────────
   Safari 14.0 lacks flex gap AND inset. Safari 14.1+ supports both.
   This block only applies in browsers that lack the inset property,
   providing margin-based spacing as a substitute for flex gap.        */
@supports not (inset: 0px) {
    /* Row-direction flex containers */
    .header-left > * + *,
    .header-right > * + *,
    .message-row > * + *,
    .loading-indicator > * + *,
    .chat-input-area > * + *,
    .file-upload-status > * + *,
    .document-card > * + *,
    .search-result-card > * + *,
    .btn-sso > * + *,
    .notification-item > * + *,
    .jennhelp-header > * + *,
    .help-chat-row > * + *,
    .jennhelp-input-area > * + *,
    .usage-widget > * + *,
    .improv-stage-header > * + *,
    .improv-stage-meta > * + *,
    .improv-controls > * + *,
    .improv-setup-actions > * + *,
    .improv-export-links > * + * { margin-left: 0.5rem; }

    .loading-dots > * + * { margin-left: 3px; }
    .message-feedback > * + *,
    .message-feedback-btn > * + *,
    .usage-pill > * + *,
    .sidebar-actions > * + * { margin-left: 0.25rem; }
    .document-card > * + *,
    .search-result-card > * + *,
    .btn-sso > * + *,
    .notification-item > * + *,
    .jennhelp-header > * + *,
    .usage-widget > * + *,
    .improv-stage-header > * + * { margin-left: 0.75rem; }
    .help-chat-row > * + * { margin-left: 0.6rem; }

    /* Column-direction flex containers */
    .history-item > * + * { margin-top: 0.125rem; }
    .chat-messages > * + *,
    .jennhelp-messages > * + * { margin-top: 0.75rem; }
    .search-result-content > * + * { margin-top: 0.375rem; }

    /* Flex-wrap containers (both axes) */
    .admin-filter-bar { margin: -0.25rem; }
    .admin-filter-bar > * { margin: 0.25rem; }
    .jennhelp-suggestions { margin: -0.25rem; }
    .jennhelp-suggestions > * { margin: 0.25rem; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Ecosystem Monitor
   ═══════════════════════════════════════════════════════════════════════════ */

/* SVG constellation container */
.eco-svg-container {
    display: flex;
    justify-content: center;
    margin: 0.75rem 0;
}
.eco-svg-container svg { max-width: 100%; height: auto; }

/* Interactive nodes */
.eco-node { cursor: pointer; transition: opacity 0.2s; }
.eco-node:hover { opacity: 0.8; }

/* Connection lines by presence */
.eco-connection-online  { stroke: var(--success); stroke-width: 1.5; }
.eco-connection-mesh    { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 6 3; }
.eco-connection-offgrid { stroke: #6b7280; stroke-width: 1;   stroke-dasharray: 4 4; }
.eco-connection-offline { stroke: var(--error); stroke-width: 0.8; opacity: 0.45; }

/* Hub glow pulse */
.eco-hub-glow {
    animation: eco-pulse 2s ease-in-out infinite;
}
@keyframes eco-pulse {
    0%, 100% { opacity: 0.25; }
    50%      { opacity: 0.55; }
}

/* Node fills by health */
.eco-fill-healthy  { fill: var(--success); }
.eco-fill-degraded { fill: var(--accent); }
.eco-fill-unhealthy{ fill: #dc2626; }
.eco-fill-unknown  { fill: #94a3b8; }

/* Legend */
.eco-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}
.eco-legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.eco-legend-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Detail view */
.eco-detail-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.eco-detail-back {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.eco-detail-back:hover { background: var(--bg-secondary); }

.eco-detail-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}
.eco-detail-card h4 {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* Badges */
.eco-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.eco-badge-healthy  { background: #dcfce7; color: #166534; }
.eco-badge-degraded { background: #fef3c7; color: #92400e; }
.eco-badge-unhealthy{ background: #fee2e2; color: #991b1b; }
.eco-badge-unknown  { background: #f1f5f9; color: #475569; }
.eco-badge-online   { background: #dcfce7; color: #166534; }
.eco-badge-offline  { background: #fee2e2; color: #991b1b; }

/* Detail meta table */
.eco-detail-meta {
    width: 100%;
    font-size: 0.78rem;
    border-collapse: collapse;
}
.eco-detail-meta td {
    padding: 0.25rem 0.4rem;
    border-bottom: 1px solid var(--border);
}
.eco-detail-meta td:first-child {
    color: var(--text-secondary);
    white-space: nowrap;
    width: 40%;
}

/* Status flash animation for SSE transitions */
@keyframes eco-flash {
    0%   { stroke-width: 2; opacity: 1; }
    100% { stroke-width: 0; opacity: 0; }
}


/* ═══════════════════════════════════════════════════════════════════════════
   MQTT Mesh Inbox & Thread Views
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Inbox Status Bar ─────────────────────────────────────────────── */
.mesh-inbox-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.8125rem;
}

/* ── Inbox Filter Tabs ────────────────────────────────────────────── */
.mesh-inbox-filters {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}
.mesh-filter-active {
    background: var(--primary) !important;
    color: #fff !important;
}

/* ── Inbox Message List ───────────────────────────────────────────── */
.mesh-inbox-list {
    display: flex;
    flex-direction: column;
}
.mesh-inbox-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}
.mesh-inbox-item:hover {
    background: var(--bg);
}
.mesh-inbox-unread {
    background: rgba(37, 99, 235, 0.04);
    border-left-color: var(--primary);
}
.mesh-inbox-item-icon {
    flex-shrink: 0;
    width: 24px;
    text-align: center;
    padding-top: 0.1rem;
}
.mesh-inbox-item-body {
    flex: 1;
    min-width: 0;
}
.mesh-inbox-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}
.mesh-inbox-item-device {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mesh-inbox-item-time {
    font-size: 0.6875rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.mesh-inbox-item-preview {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.125rem;
}
.mesh-inbox-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    margin-top: 0.4rem;
}
.mesh-inbox-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ── Mesh Inbox Badge (in menu) ───────────────────────────────────── */
#mesh-inbox-badge {
    position: relative;
    top: -1px;
    display: inline-block;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--error, #dc2626);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    margin-left: 0.25rem;
}

/* ── Thread Header ────────────────────────────────────────────────── */
.mesh-thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.mesh-thread-device-name {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text);
    flex: 1;
    text-align: center;
    font-family: monospace;
}

/* ── Thread Body (Scrollable) ─────────────────────────────────────── */
.mesh-thread-body {
    flex: 1;
    overflow-y: auto;
    max-height: calc(100vh - 280px);
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ── Chat Bubbles ─────────────────────────────────────────────────── */
.mesh-thread-row {
    display: flex;
    align-items: flex-end;
}
.mesh-thread-row-outbound {
    justify-content: flex-end;
}
.mesh-thread-row-inbound {
    justify-content: flex-start;
}
.mesh-thread-bubble {
    max-width: 80%;
    padding: 0.5rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    word-wrap: break-word;
}
.mesh-thread-outbound {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}
.mesh-thread-inbound {
    background: var(--bg, #f1f5f9);
    color: var(--text);
    border: 1px solid var(--border);
    border-bottom-left-radius: 0.25rem;
}
.mesh-thread-bubble-header {
    font-size: 0.6875rem;
    margin-bottom: 0.25rem;
    opacity: 0.85;
}
.mesh-thread-outbound .mesh-thread-bubble-header {
    color: rgba(255, 255, 255, 0.85);
}
.mesh-thread-bubble-content {
    font-size: 0.8125rem;
}
.mesh-thread-bubble-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.25rem;
    gap: 0.5rem;
}
.mesh-thread-bubble-time {
    font-size: 0.625rem;
    opacity: 0.7;
}
.mesh-thread-bubble-status {
    font-size: 0.7rem;
}

/* ── Thread Quick Actions Bar ─────────────────────────────────────── */
.mesh-thread-actions {
    display: flex;
    gap: 0.375rem;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border);
    align-items: center;
}
.mesh-thread-input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius, 6px);
    font-size: 0.8125rem;
    background: var(--surface);
    color: var(--text);
    outline: none;
}
.mesh-thread-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Deliberative Reasoning — Trace Disclosure & Strategy Badges
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Strategy Badge ─────────────────────────────────────────────── */
.reasoning-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}
.reasoning-badge-react      { background: #ccfbf1; color: var(--primary); }
.reasoning-badge-tot         { background: #fce7f3; color: #9d174d; }
.reasoning-badge-pec         { background: #d1fae5; color: #065f46; }
.reasoning-badge-scratchpad  { background: #fef3c7; color: #92400e; }
.reasoning-badge-gcs         { background: #ede9fe; color: #5b21b6; }
.reasoning-badge-none        { background: var(--bg); color: var(--text-muted); }
.reasoning-badge-open        { opacity: 0.5; text-decoration: line-through; }

/* ── Strategy List (Panel) ──────────────────────────────────────── */
.reasoning-strategy-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.reasoning-strategy-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}
.reasoning-failures {
    font-size: 0.6875rem;
    color: var(--text-muted);
}
.reasoning-circuit-open {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--error);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ── Trace Toggle (on messages) ─────────────────────────────────── */
.reasoning-trace-toggle {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    margin-top: 0.375rem;
    cursor: pointer;
    border-radius: var(--radius, 6px);
    transition: background 0.15s;
    -webkit-user-select: none;
    user-select: none;
}
.reasoning-trace-toggle:hover {
    background: rgba(0, 0, 0, 0.04);
}
.reasoning-trace-meta {
    font-size: 0.6875rem;
    color: var(--text-muted);
}
.reasoning-confidence {
    font-size: 0.625rem;
    color: var(--text-muted);
}

/* ── Trace Panel (collapsible) ──────────────────────────────────── */
.reasoning-trace-panel {
    display: none;
    flex-direction: column;
    gap: 0.375rem;
    padding: 0.5rem;
    margin-top: 0.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius, 6px);
    background: var(--bg);
    max-height: 400px;
    overflow-y: auto;
}
.reasoning-trace-panel.open {
    display: flex;
}

/* ── Individual Step ────────────────────────────────────────────── */
.reasoning-step {
    padding: 0.375rem 0.5rem;
    border-left: 3px solid var(--border);
    border-radius: 0 4px 4px 0;
    font-size: 0.75rem;
    line-height: 1.5;
}
.reasoning-step strong {
    font-size: 0.625rem;
    letter-spacing: 0.04em;
    opacity: 0.7;
}
.reasoning-step-content {
    margin-top: 0.125rem;
    white-space: pre-wrap;
    word-break: break-word;
}
.reasoning-step-thought     { border-left-color: #3b82f6; }
.reasoning-step-action      { border-left-color: #f59e0b; }
.reasoning-step-observation  { border-left-color: #10b981; }
.reasoning-step-critique     { border-left-color: #ef4444; }
.reasoning-step-plan         { border-left-color: #8b5cf6; }
.reasoning-step-branch       { border-left-color: #ec4899; }
.reasoning-step-goal         { border-left-color: #6366f1; }
.reasoning-step-answer {
    border-left-color: #059669;
    background: rgba(16, 185, 129, 0.06);
}

/* ── Model Import Pipeline (P1) ──────────────────────────────────── */

.model-import-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.model-import-form .admin-form-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.model-import-form .admin-form-row label {
    min-width: 140px;
    font-weight: 500;
}
.model-import-form .admin-form-row input,
.model-import-form .admin-form-row select {
    flex: 1;
}

/* Import Status Badges */
.import-status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}
.import-status-badge.submitted {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}
.import-status-badge.processing {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    animation: importPulse 2s ease-in-out infinite;
}
.import-status-badge.pending-approval {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}
.import-status-badge.approved {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}
.import-status-badge.rejected {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}
.import-status-badge.failed {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.import-status-badge.cancelled {
    background: rgba(148, 163, 184, 0.1);
    color: #64748b;
    text-decoration: line-through;
}

@keyframes importPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Version Stage Badges */
.version-stage-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.version-stage-badge.dev {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}
.version-stage-badge.staging {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}
.version-stage-badge.production {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}
.version-stage-badge.retired {
    background: rgba(148, 163, 184, 0.1);
    color: #64748b;
}

/* Import Pipeline Progress Bar (for detail view) */
.import-pipeline-progress {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 1rem 0;
}
.import-pipeline-step {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.7rem;
    border-radius: 6px;
    position: relative;
}
.import-pipeline-step.completed {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}
.import-pipeline-step.current {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    animation: importPulse 2s ease-in-out infinite;
}
.import-pipeline-step.pending {
    background: rgba(148, 163, 184, 0.08);
    color: #475569;
}
.import-pipeline-step.failed {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* ── Fleet Rebaseline Panel (Phase 4) ───────────────────────────── */

/* Reusable status badge (same style as import-status-badge) */
.import-status {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}
.import-status.pending {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}
.import-status.rolling_out,
.import-status.canary_active {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    animation: importPulse 2s ease-in-out infinite;
}
.import-status.monitoring {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}
.import-status.completed,
.import-status.approved,
.import-status.synced {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}
.import-status.rolled_back,
.import-status.rejected,
.import-status.critical {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}
.import-status.failed {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.import-status.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}
.import-status.pending_update {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

/* Rebaseline progress bar */
.rebaseline-progress {
    width: 100%;
    height: 8px;
    background: rgba(148, 163, 184, 0.15);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.25rem;
}
.rebaseline-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 4px;
    transition: width 0.6s ease;
    min-width: 0;
}

/* Rebaseline wizard styling */
#rebaseline-wizard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
#rebaseline-wizard label {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 0.25rem;
    display: block;
}
#rebaseline-canary-group {
    grid-column: 1 / -1;
}

/* ── Startup Warning Banner ── */
.startup-warning-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    background: rgba(217, 119, 6, 0.1);
    border-left: 3px solid var(--accent, #D97706);
    color: var(--text, #1C1917);
    font-size: 0.875rem;
    line-height: 1.4;
}
.startup-warning-icon {
    font-size: 1.25rem;
    color: var(--accent, #D97706);
    flex-shrink: 0;
}
.startup-warning-body {
    flex: 1;
    min-width: 0;
}
.startup-warning-fix {
    display: block;
    margin-top: 0.25rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    color: var(--text-muted, #78716C);
}
.startup-warning-dismiss {
    flex-shrink: 0;
    font-size: 1.25rem;
    line-height: 1;
    opacity: 0.6;
}
.startup-warning-dismiss:hover {
    opacity: 1;
}
@media (max-width: 480px) {
    .startup-warning-banner {
        font-size: 0.8125rem;
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }
    .startup-warning-fix {
        font-size: 0.75rem;
    }
}
@media (prefers-reduced-motion: reduce) {
    .startup-warning-banner { transition: none; }
}

/* ── Now Playing Bar ────────────────────────────────────────────────── */
.now-playing-bar {
    padding: 0 1rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.now-playing-bar.media-panel-footer {
    flex-shrink: 0;
}
.now-playing-bar .now-playing-embed {
    max-width: 100%;
    border: none;
    border-radius: 0;
    padding: 0.5rem 0;
}

/* ── Media Panel (slide-out) ────────────────────────────────────────── */
.media-panel {
    width: 0;
    min-width: 0;
    overflow: hidden;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, min-width 0.3s ease;
}
.media-panel.open {
    width: 420px;
    min-width: 420px;
}
.media-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--primary);
    color: #fff;
    flex-shrink: 0;
}
.media-panel-header h2 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
}
.media-panel-header .btn-icon {
    color: #fff;
    font-size: 1.25rem;
}
.media-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}
.media-search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.media-search-bar input[type="text"] {
    flex: 1;
    min-width: 120px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--bg);
    color: var(--text);
}
.media-search-bar input[type="text"]:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
}
.media-search-bar select {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8rem;
    background: var(--bg);
    color: var(--text);
}
.media-results {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.media-results-empty {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    padding: 2rem 0;
}
.media-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s ease;
}
.media-result-item:hover {
    background: var(--bg);
}
.media-result-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.media-result-art {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    background: var(--border);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}
.media-result-info {
    min-width: 0;
    flex: 1;
}
.media-result-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.media-result-artist {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.media-result-play {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.media-result-play:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.media-result-queue {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.media-result-queue:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
@media (max-width: 768px) {
    .media-panel.open {
        width: 100%;
        min-width: 100%;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
    }
}
@media (prefers-reduced-motion: reduce) {
    .media-panel { transition: none; }
    .media-result-item { transition: none; }
}

/* ── Media Panel Tabs ─────────────────────────────────────────── */
.media-panel-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.media-panel-tabs::-webkit-scrollbar { display: none; }
.media-tab {
    flex: 1;
    padding: 0.6rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.media-tab:hover { color: var(--text); }
.media-tab.active,
.media-tab[aria-selected="true"] {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}
.media-tab:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}
.media-tabpanel { padding: 0; }
@media (prefers-reduced-motion: reduce) {
    .media-tab { transition: none; }
}

/* ── Media Back Button ───────────────────────────────────── */
.media-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--primary);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
}
.media-back-btn:hover { text-decoration: underline; }
.media-back-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ── Queue Current Track ────────────────────────────────── */
.media-queue-current {
    background: rgba(13, 115, 119, 0.08);
    border-left: 3px solid var(--primary);
}
.media-queue-number {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

/* ── Browse Section ─────────────────────────────────────── */
.media-browse-section { margin-bottom: 1.25rem; }
.media-browse-heading {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.5rem 0;
}
.media-browse-scroll {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
}
.media-browse-card {
    flex-shrink: 0;
    width: 120px;
    cursor: pointer;
    text-align: center;
}
.media-browse-card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 8px;
}
.media-browse-card-art {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    background: var(--border);
    background-size: cover;
    background-position: center;
    margin-bottom: 0.35rem;
}
.media-browse-card:hover .media-browse-card-art {
    opacity: 0.85;
}
.media-browse-card-name {
    font-size: 0.75rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.media-browse-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.media-browse-chip {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.media-browse-chip:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.media-browse-chip:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ── Embedded Media Player ────────────────────────────────────── */
.media-player-embed {
    border-top: 1px solid var(--border);
    padding: 0.75rem 0;
    margin-top: 0.5rem;
}
.media-player-frame {
    width: 100%;
    border-radius: var(--radius, 8px);
    overflow: hidden;
    background: #000;
    min-height: 80px;
}
.media-player-frame iframe {
    width: 100%;
    border: none;
    display: block;
}
.media-player-notice {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.5rem;
}

/* ── Unified Jenn Player (Phase 1) ────────────────────────────── */
.jenn-player-section {
    background: linear-gradient(180deg, #0f1117 0%, #1a1d27 100%);
    border-top: 1px solid rgba(13, 115, 119, 0.2);
    padding: 0;
    flex-shrink: 0;
    flex-grow: 0;
    color: #e4e4e7;
    overflow-y: auto;
    max-height: 50vh;
}
.jenn-visualizer-wrap {
    position: relative;
    width: 100%;
    height: 120px;
    overflow: hidden;
}
.jenn-visualizer-wrap canvas {
    width: 100%;
    height: 100%;
    display: block;
}
.jenn-player-art-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 2px solid rgba(13, 115, 119, 0.6);
    box-shadow: 0 0 20px rgba(13, 115, 119, 0.3);
    display: none;
}
.jenn-player-track-info {
    text-align: center;
    padding: 0.75rem 1rem 0.25rem;
}
.jenn-player-title {
    font-size: 0.925rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #e4e4e7;
}
.jenn-player-artist {
    font-size: 0.8rem;
    color: #78716C;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.jenn-player-progress-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
}
.jenn-player-time {
    font-size: 0.7rem;
    color: #78716C;
    min-width: 2.5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.jenn-player-progress-track {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
    cursor: pointer;
}
.jenn-player-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary, #0D7377);
    border-radius: 2px;
    transition: width 3s linear;
}
.jenn-player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.25rem 1rem;
}
.jenn-player-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #e4e4e7;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background 0.15s ease;
}
.jenn-player-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}
.jenn-player-btn:focus-visible {
    outline: 2px solid var(--primary, #0D7377);
    outline-offset: 2px;
}
.jenn-player-btn-sm {
    width: 32px;
    height: 32px;
    color: #78716C;
}
.jenn-player-btn-play {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary, #0D7377);
    color: #fff;
    box-shadow: 0 2px 12px rgba(13, 115, 119, 0.4);
}
.jenn-player-btn-play:hover {
    background: var(--primary-dark, #0A5C5F);
    transform: scale(1.05);
}
.jenn-player-volume {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 1.5rem 0.5rem;
    color: #78716C;
}
.jenn-player-volume input[type="range"] {
    flex: 1;
    accent-color: var(--primary, #0D7377);
    height: 4px;
}
.jenn-player-volume input[type="range"]:focus-visible {
    outline: 2px solid var(--primary, #0D7377);
    outline-offset: 2px;
}
.jenn-player-actions {
    display: flex;
    justify-content: center;
    padding: 0 1rem 0.75rem;
}
.jenn-player-action-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: #78716C;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 0.3rem 0.75rem;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.jenn-player-action-btn:hover {
    color: var(--primary, #0D7377);
    border-color: var(--primary, #0D7377);
}
.jenn-player-action-btn:focus-visible {
    outline: 2px solid var(--primary, #0D7377);
    outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    .jenn-player-btn-play:hover { transform: none; }
    .jenn-player-progress-fill { transition: none; }
    .jenn-visualizer-wrap canvas { display: none; }
}
