:root {
    /* Premium Business Theme (Linear/Notion inspired) */
    --bg-app: #ffffff;
    --bg-sidebar: #f7f9fb;
    /* Very subtle grey for differentiation */
    --bg-panel: #ffffff;
    --bg-header: #ffffff;
    --bg-item-hover: #eff2f5;

    --text-primary: #1a1f2c;
    /* Near black */
    --text-secondary: #64748b;
    /* Slate 500 */
    --text-tertiary: #94a3b8;

    --border-color: #e2e8f0;
    /* Slate 200 - Subtle Borders */
    --accent-color: #0f172a;
    /* Slate 900 - Professional Dark Brand */
    --accent-rgb: 15, 23, 42;
    --accent-text: #ffffff;

    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Input vars */
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --input-focus: #0f172a;
    --input-focus-border: #0f172a;
}

body.dark-theme {
    --bg-app: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-panel: #0f172a;
    --bg-header: #1e293b;
    --bg-item-hover: #334155;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;

    --border-color: #334155;
    --accent-color: #38bdf8;
    /* Sky blue for dark mode accent */
    --accent-rgb: 56, 189, 248;
    --accent-text: #0f172a;

    --input-bg: #1e293b;
    --input-border: #475569;
    --input-focus: #38bdf8;
    --input-focus-border: #38bdf8;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-app);
    color: var(--text-primary);
    margin: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Main Layout Grid */
.app-container {
    display: grid;
    /* Sidebar | Chat | Resizer | Artifacts */
    --sidebar-width: 220px;
    --artifact-width: 450px;
    --top-header-height: 48px;

    /* Grid with top header row spanning all columns */
    grid-template-columns: var(--sidebar-width) 1fr 12px var(--artifact-width);
    grid-template-rows: var(--top-header-height) 1fr;
    grid-template-areas:
        "header header header header"
        "sidebar chat resizer artifacts";
    height: 100vh;
    width: 100vw;
}

/* Top Header Bar */
.app-top-header {
    grid-area: header;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.header-logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-logo-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.header-logo-text {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* Assign grid areas to columns */
.sidebar {
    grid-area: sidebar;
}

.chat-interface {
    grid-area: chat;
}

.resizer {
    grid-area: resizer;
}

.artifact-panel {
    grid-area: artifacts;
}

/* Resizers */
.resizer {
    background-color: transparent;
    /* Invisible hit area */
    cursor: col-resize;
    z-index: 100;
    /* Ensure it's on top */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* The visible line inside the large hit area */
.resizer::after {
    content: "";
    width: 1px;
    height: 100%;
    background-color: transparent;
    transition: background-color 0.2s;
}

.resizer:hover::after,
.resizer.resizing::after {
    background-color: var(--accent-color);
    width: 4px;
    /* Thicker on hover */
}

/* 1. Sidebar (Navigation) */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1rem 0.5rem;
    gap: 0.5rem;
    overflow: hidden;
    /* Hide content when collapsed */
    white-space: nowrap;
}

/* Sidebar Toggle at Top */
.sidebar-toggle-top {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
    margin-bottom: 0.25rem;
}

.sidebar-toggle-top:hover {
    color: var(--text-primary);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .profile-section {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 0 0 1rem 0;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.5rem;
}

/* Collapsed sidebar - user profile section */
.sidebar.collapsed .user-profile-trigger {
    justify-content: center;
    padding: 0.5rem;
}

.sidebar.collapsed .user-name,
.sidebar.collapsed .user-menu-chevron {
    display: none;
}

.sidebar-header {
    padding: 0 0.75rem 1rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--accent-color);
    color: var(--accent-text);
    border-radius: 6px;
    font-size: 14px;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

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

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

.nav-item i {
    width: 18px;
    text-align: center;
    font-style: normal;
}

.nav-item .archive-btn {
    opacity: 0.4;
}

.nav-item:hover .archive-btn {
    opacity: 0.7 !important;
}

.nav-item .archive-btn:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.1);
}

.profile-section {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* 2. Chat Interface (Frequency Center) */
.chat-interface {
    background-color: var(--bg-app);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
    /* Ensures internal .chat-messages scrolls properly within grid */
}

.chat-header {
    height: 56px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    font-weight: 600;
    font-size: 0.95rem;
}

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

.empty-state {
    margin: auto;
    text-align: center;
    color: var(--text-secondary);
    max-width: 400px;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.message {
    display: flex;
    gap: 1rem;
    max-width: 860px;
    margin: 0 auto;
    width: 100%;
    animation: fadeIn 0.2s ease-out;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    /* Circle for humans/business */
    background: var(--bg-item-hover);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}

.avatar.user {
    background: #f1f5f9;
    /* Slate 100 */
}

.message-content {
    flex: 1;
}

.message-header {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-weight: 400;
}

.message-body {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.input-area-wrapper {
    padding: 1.5rem 2rem 2rem 2rem;
    background: var(--bg-app);
}

.chat-input-container {
    max-width: 860px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    background: var(--input-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.chat-input-container:focus-within {
    border-color: var(--input-focus);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* General disabled context - works on any element */
.disabled-context {
    opacity: 0.6;
    pointer-events: none;
    cursor: not-allowed;
}

.disabled-context * {
    pointer-events: none !important;
}

textarea {
    width: 100%;
    border: none;
    padding: 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    background: transparent;
    color: var(--text-primary);
    resize: none;
    outline: none;
    min-height: 60px;
}

.input-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0 0.5rem 0.5rem 0.5rem;
}

.send-btn {
    background: var(--accent-color);
    color: var(--accent-text);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.send-btn:hover {
    opacity: 0.9;
}


/* Document Paper aesthetic for the editor */
#artifactEditor {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    min-height: 100%;
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    /* Paper-like */
    padding: 3rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    font-family: var(--font-main);
    /* Default to sans-serif for content */
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
    border: none;
    outline: none;
    resize: none;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-app);
    color: var(--text-primary);
    width: 100% !important;
    max-width: 520px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-content.small {
    max-width: 400px !important;
}

.modal-content.medium {
    max-width: 700px !important;
}

.text-center {
    text-align: center;
}

.primary-btn.danger {
    background: #ef4444;
}

.primary-btn.danger:hover {
    background: #dc2626;
}

#profileModal .modal-content,
#profileModal.modal .modal-content,
.modal#profileModal .modal-content {
    max-width: 850px !important;
    width: 850px !important;
}

/* 3. Artifact Panel (Document View) */
.artifact-panel {
    background-color: var(--bg-panel);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    /* Ensures internal .artifact-content-area scrolls properly within grid */
}

.artifact-header {
    height: 56px;
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.artifact-tabs {
    display: flex;
    gap: 1.5rem;
}

.tab {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 1rem 0;
    border-bottom: 2px solid transparent;
    position: relative;
    top: 1px;
}

.tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-color);
}

.artifact-content-area {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background-color: #f8fafc;
    /* Slight contrast for document paper feel */
}

/* Scoped Artifact UI Library */
.artifact-container {
    max-width: 950px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Standardized Button for Artifact Actions */
.artifact-action-btn {
    width: 100%;
    padding: 1.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: var(--accent-color);
    color: var(--accent-text);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s ease, background 0.2s ease;
}

.artifact-action-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.artifact-action-btn:active {
    transform: translateY(0);
}

.artifact-action-btn:disabled {
    opacity: 0.7;
    cursor: default;
    background: #64748b;
    pointer-events: none;
}

/* Footer for Artifact Actions (End of Content) */
.artifact-fixed-footer {
    background: transparent;
    padding: 2rem 0 1rem 0;
    z-index: 100;
}

.artifact-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.artifact-title {
    color: #0f172a;
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 1rem 0;
    letter-spacing: -0.02em;
}

.artifact-section-title {
    color: #334155;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 2rem 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.selection-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.selection-card:hover {
    border-color: #94a3b8;
    background: #f8fafc;
    transform: translateY(-1px);
}

.selection-card.selected {
    border-color: var(--accent-color);
    background: rgba(var(--accent-rgb), 0.04);
    box-shadow: 0 0 0 1px var(--accent-color);
}

.recommendation-card,
.pick {
    border-color: var(--accent-color);
    background: rgba(var(--accent-rgb), 0.02);
    border-width: 1.5px;
}

.agent-badge {
    position: absolute;
    top: -10px;
    right: 12px;
    background: #0f172a;
    color: #ffffff;
    font-size: 9px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.05em;
    z-index: 20;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.artifact-stat-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    margin: 1.5rem 0;
}

.artifact-stat-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1rem;
    text-align: center;
}

.artifact-stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.artifact-stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
}

.artifact-details-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
}

.artifact-details-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.artifact-details-label {
    text-transform: uppercase;
    color: #94a3b8;
    font-size: 0.65rem;
}

.artifact-details-value {
    color: #475569;
    line-height: 1.4;
}

body.dark-theme .artifact-card,
body.dark-theme .selection-card {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}

body.dark-theme .artifact-title,
body.dark-theme .artifact-stat-value {
    color: #f8fafc;
}

body.dark-theme .artifact-stat-item {
    background: #0f172a;
    border-color: #334155;
}

/* Artifact Reference ID Footer */
.artifact-id-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-color);
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.artifact-id-label {
    font-weight: 600;
    margin-right: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.artifact-id-value {
    background: rgba(0, 0, 0, 0.04);
    padding: 2px 8px;
    border-radius: 4px;
    user-select: all;
    cursor: text;
}

body.dark-theme .artifact-id-value {
    background: rgba(255, 255, 255, 0.08);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Modal Tabs */
.modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-sidebar);
    padding: 0 1rem;
}

.tab-btn {
    padding: 1rem 1.5rem;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

/* User management table */
.modern-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.modern-table th {
    text-align: left;
    padding: 1rem;
    background: var(--bg-sidebar);
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.modern-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.modern-table tr:last-child td {
    border-bottom: none;
}

.close {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: color 0.2s;
}

.close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

/* Forms inside Modals */
.profile-form {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-form input,
.profile-form textarea {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
}

.profile-form input:focus,
.profile-form textarea:focus {
    outline: none;
    border-color: var(--input-focus);
}

.profile-form label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-section {
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-app);
}

.form-section-header {
    background: var(--bg-sidebar);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.form-section-header:hover {
    background: var(--bg-item-hover);
}

.form-section-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--accent-color);
}

.form-section-content {
    padding: 1.5rem;
}

.form-section.collapsed .form-section-content {
    display: none;
}

.form-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.25rem !important;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.secondary-btn:hover {
    background: var(--bg-item-hover);
}

.primary-btn {
    background: var(--accent-color);
    color: var(--accent-text);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

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

.action-btn-large {
    background: linear-gradient(135deg, var(--accent-color) 0%, #1e293b 100%);
    color: white;
    border: none;
    padding: 1.25rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
}

.action-btn-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    filter: brightness(1.1);
}

.action-btn-large i {
    font-size: 1.25rem;
}

/* Accordion in Modals */
.accordion-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.accordion-header {
    background: var(--bg-sidebar);
    padding: 0.75rem;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
}

.accordion-content {
    padding: 1rem;
    background: var(--bg-app);
}

.modal-content.small {
    max-width: 400px;
}

.primary-btn.danger {
    background: #dc3545;
    color: white;
}

.primary-btn.danger:hover {
    background: #c82333;
}

.accordion-content.collapsed {
    display: none;
}

/* Profile List Items */
.profile-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.profile-item button {
    background: white;
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-primary);
}

/* Utilities */
.hidden {
    display: none;
}

/* Team Promotional Modal Styles */
.modal-content.large {
    max-width: 900px;
    width: 90%;
}

.modal-intro {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.agent-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    padding: 0.5rem;
}

.agent-promo-card {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.agent-promo-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
}

.agent-avatar-container {
    position: relative;
    margin-bottom: 1rem;
}

.agent-avatar-placeholder {
    width: 64px;
    height: 64px;
    background: var(--accent-color);
    color: var(--accent-text);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-sidebar);
}

.status-dot.online {
    background-color: #10b981;
    /* Green-500 */
}

.agent-promo-card h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.agent-role {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-color);
    margin: 0.25rem 0 0.75rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.agent-bio {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1.25rem;
    flex-grow: 1;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.skill-tag {
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: help;
    transition: all 0.2s ease;
}

.skill-tag:hover {
    background: var(--accent-color);
    color: var(--accent-text);
    border-color: var(--accent-color);
}

.team-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.team-motto {
    font-size: 1rem;
    font-style: italic;
    color: var(--text-secondary);
    font-weight: 500;
}

body.dark-theme .agent-promo-card {
    background: #1e293b;
}

body.dark-theme .skill-tag {
    background: #0f172a;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.agent-promo-card {
    animation: fadeIn 0.4s ease-out backwards;
}

.agent-promo-card:nth-child(2) {
    animation-delay: 0.1s;
}

.agent-promo-card:nth-child(3) {
    animation-delay: 0.2s;
}

.agent-promo-card:nth-child(4) {
    animation-delay: 0.3s;
}

.agent-promo-card:nth-child(5) {
    animation-delay: 0.4s;
}

.agent-promo-card:nth-child(6) {
    animation-delay: 0.5s;
}

.agent-promo-card:nth-child(7) {
    animation-delay: 0.6s;
}

/* Responsive */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 200px 1fr 400px;
    }
}

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 100%;
    }

    .sidebar,
    .artifact-panel {
        display: none;
    }
}

/* Sidebar Updates */
.nav-section-header {
    padding: 1rem 0.75rem 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-tertiary);
    letter-spacing: 0.05em;
}

.profile-widget {
    margin: 0.5rem 0.75rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-app);
    cursor: pointer;
}

.profile-widget:hover {
    border-color: var(--text-tertiary);
}

.profile-header {
    margin-bottom: 0.25rem;
}

.profile-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.status-dot.attention {
    background-color: #f97316;
    /* Orange */
}

.status-dot.completed {
    background-color: #22c55e;
    /* Green */
}

.sidebar-footer {
    margin-top: auto;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border-color);
}

/* Advanced Accordion Sidebar */
.sidebar-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.5rem;
}

.group-header {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.2s;
}

.group-header:hover {
    color: var(--text-primary);
    background-color: var(--bg-item-hover);
    border-radius: 6px;
}

.group-title {
    flex: 1;
    margin-left: 0.5rem;
}

.chevron {
    width: 12px;
    height: 12px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    font-style: normal;
}

/* Expanded State */
.sidebar-group.expanded .chevron,
.form-section:not(.collapsed) .chevron {
    transform: rotate(90deg);
}

.group-content {
    display: none;
    flex-direction: column;
    /* padding-left: 1rem; Indent content? Optional based on design */
}

.sidebar-group.expanded .group-content {
    display: flex;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modern Working Indicator */
.ack-container {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out;
}

.modern-working-indicator {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
}

.pulse-container {
    position: relative;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-core {
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
    z-index: 2;
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(var(--accent-rgb), 0.2);
    border-radius: 50%;
    opacity: 0;
}

.modern-working-indicator.thinking .pulse-ring {
    animation: pulseLoop 2s infinite ease-out;
}

.modern-working-indicator.done .pulse-core {
    background: #10b981;
    /* Success green */
    display: flex;
    align-items: center;
    justify-content: center;
}

.modern-working-indicator.done .pulse-core::after {
    content: '✓';
    color: white;
    font-size: 6px;
    font-weight: 900;
}

.working-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
}

.working-text::after {
    content: '';
    display: inline-block;
    width: 1.25em;
    text-align: left;
}

.modern-working-indicator.thinking .working-text::after {
    animation: ellipsis 1.5s steps(4) infinite;
}

.modern-working-indicator.done .working-text {
    color: var(--text-tertiary);
}

.modern-working-indicator.done .est-tag {
    display: none;
}

.est-tag {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    background: rgba(var(--accent-rgb), 0.05);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

@keyframes pulseLoop {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes ellipsis {
    0% {
        content: '';
    }

    25% {
        content: '.';
    }

    50% {
        content: '..';
    }

    75% {
        content: '...';
    }

    100% {
        content: '';
    }
}


.group-action {
    opacity: 0;
    transition: opacity 0.2s;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 4px;
}

.group-header:hover .group-action {
    opacity: 1;
}

.group-action:hover {
    color: var(--text-primary);
}

/* Profile Row Actions */
.profile-row {
    position: relative;
    padding-right: 2rem;
    /* Space for action */
}

/* Searchable Profile Selector UI */
.profile-selector-ui {
    margin-top: 1rem;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 100%;
}

.selector-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.selector-search-input {
    width: 100%;
    padding: 0.6rem 0.75rem 0.6rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-app);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.selector-search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.profile-list-scroll {
    max-height: 250px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 4px;
}

.profile-option-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.profile-option-row:hover {
    background: var(--bg-item-hover);
}

.profile-option-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.profile-option-info {
    display: flex;
    flex-direction: column;
}

.profile-option-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.profile-option-meta {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.selector-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    margin-top: 0.25rem;
}

.selected-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.profile-action {
    position: absolute;
    right: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-tertiary);
    padding: 2px;
}

.profile-row:hover .profile-action {
    opacity: 1;
}

.profile-action:hover {
    color: var(--text-primary);
}

/* Header Icons (Default State) */
.header-icon {
    display: none;
    /* Hidden when expanded, usually? Or we can show them always. User said "change headlines into icons when closed", implies swap. */
    font-style: normal;
    font-size: 1.1rem;
}

/* Collapsed Sidebar overrides */
.sidebar.collapsed .group-title,
.sidebar.collapsed .chevron,
.sidebar.collapsed .group-action,
.sidebar.collapsed .status-dot+span,
/* Hide project names */
.sidebar.collapsed .nav-item span:not(.logo-text) {
    /* Hide all nav text */
    display: none;
}

.sidebar.collapsed .header-icon {
    display: block;
    margin: 0 auto;
}

.sidebar.collapsed .group-header {
    justify-content: center;
    padding: 0.5rem;
}

.sidebar.collapsed .sidebar-group {
    align-items: center;
    /* Center content */
}

/* HIDE sub-items (group content) when collapsed */
.sidebar.collapsed .group-content {
    display: none !important;
}

/* Center items in collapsed mode */
.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.5rem;
}

.sidebar.collapsed .profile-row i,
.sidebar.collapsed .nav-item i {
    margin: 0;
}

/* Artifact Panel Controls */
.icon-btn.xs {
    width: 24px;
    height: 24px;
    font-size: 1.1rem;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: var(--text-secondary);
}

.icon-btn.xs:hover {
    background-color: var(--bg-item-hover);
    color: var(--text-primary);
}

.icon-btn.xs:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: transparent;
}

/* Selection Lists (Radio Buttons in Chat) */
.selection-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--bg-sidebar);
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-top: 10px;
}

.selection-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    transition: background 0.2s;
    cursor: pointer;
}

.selection-item:hover {
    background: var(--bg-item-hover);
}

.selection-item input[type="radio"] {
    margin: 0;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.selection-item label {
    cursor: pointer;
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Natural Artifact Mentions */
.artifact-mention {
    color: var(--accent-color);
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
    background: rgba(15, 23, 42, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
    display: inline-block;
}

.artifact-mention:hover {
    background: var(--accent-color);
    color: var(--accent-text);
    text-decoration: none;
}

/* Topic Selector Styles */
.topic-selector-container .selection-item {
    border-radius: 8px;
    transition: transform 0.2s, border-color 0.2s, background-color 0.2s;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.topic-selector-container .selection-item:hover {
    border-color: var(--accent-color);
    background-color: rgba(15, 23, 42, 0.02);
    transform: translateY(-1px);
}

.topic-selector-container .selection-item input[type="radio"]:checked+label {
    color: var(--accent-color);
}

.topic-selector-container .selection-item:has(input[type="radio"]:checked) {
    border-color: var(--accent-color);
    background-color: rgba(59, 130, 246, 0.05);
}

.recommendation-badge {
    position: relative;
    overflow: hidden;
}

.recommendation-badge::after {
    content: "RILEY'S CHOICE";
    position: absolute;
    top: 10px;
    right: -20px;
    background: var(--accent-color);
    color: white;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 25px;
    transform: rotate(45deg);
}

/* Artifact Content Styling */
.artifact-container {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.artifact-card {
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.artifact-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    color: var(--accent-color);
}

.artifact-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.artifact-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.artifact-stat-item {
    background: var(--bg-sidebar);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.artifact-stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.artifact-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-color);
}

.artifact-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.artifact-list-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.artifact-list-item:last-child {
    border-bottom: none;
}

.artifact-list-icon {
    font-size: 1.1rem;
    opacity: 0.7;
}

.artifact-markdown-content {
    background: var(--bg-app);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.artifact-markdown-content h1,
.artifact-markdown-content h2,
.artifact-markdown-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.artifact-markdown-content p {
    margin-bottom: 1rem;
}

/* Quality Report Specifics */
.quality-score-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 auto 1rem auto;
}

.quality-check-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    background: var(--bg-sidebar);
}

.quality-check-pass {
    color: #22c55e;
}

.quality-check-fail {
    color: #ef4444;
}

/* Visual Plan Grid */
.visual-plan-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.visual-card {
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.visual-preview {
    width: 100%;
    aspect-ratio: 16/9;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.visual-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.visual-details {
    padding: 1rem;
}

/* Dark Mode Overrides for Artifacts */
body.dark-theme .artifact-stat-item,
body.dark-theme .quality-check-item {
    background: #1e293b;
}

body.dark-theme .artifact-markdown-content {
    background: #0f172a;
}

/* Educational Content & Pillar Cards */
.educational-box {
    background-color: rgba(var(--accent-rgb), 0.03);
    border-left: 4px solid var(--accent-color);
    padding: 1.5rem;
    border-radius: 0 12px 12px 0;
    margin-bottom: 2rem;
}

.educational-box h3 {
    margin-top: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 0.75rem;
}

.educational-box p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

.pillar-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.pillar-card {
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.pillar-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    background: var(--bg-sidebar);
    transform: translateY(-2px);
}

.pillar-card.static {
    cursor: default;
    pointer-events: none;
}

.pillar-card.selected {
    border-color: var(--accent-color);
    background: rgba(var(--accent-rgb), 0.04);
    box-shadow: 0 0 0 2px var(--accent-color);
}

.pillar-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.pillar-card-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.pillar-card-label {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.pillar-card.selected .pillar-card-label {
    color: var(--accent-color);
}

/* Professional Typography for Rendered Markdown articles in Artifacts */
.rendered-article {
    max-width: 700px;
    margin: 0 auto;
    font-family: var(--font-main);
    color: var(--text-primary);
    line-height: 1.8;
}

.rendered-article h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--accent-color);
}

.rendered-article h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.rendered-article h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.rendered-article p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.rendered-article blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1.5rem;
    font-style: italic;
    color: var(--text-secondary);
    margin: 2rem 0;
}

.rendered-article ul,
.rendered-article ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.rendered-article li {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.rendered-article strong {
    font-weight: 700;
}

.rendered-article em {
    font-style: italic;
}

/* Ensure images/placeholders fit */
.rendered-article .artifact-card {
    margin: 2.5rem 0;
}

/* Hero Section Style for Rendered Article */
.article-hero {
    text-align: center;
    padding: 0 0 3rem 0;
    margin-bottom: 3rem;
    border-bottom: 2px solid var(--border-color);
}

.article-hero h1 {
    margin-bottom: 0;
}

/* Dark Mode Overrides for Rendered Article */
body.dark-theme .rendered-article {
    color: var(--text-primary);
}

body.dark-theme .rendered-article h2 {
    border-bottom-color: var(--border-color);
}

body.dark-theme .rendered-article blockquote {
    border-left-color: var(--accent-color);
    color: var(--text-secondary);
}

/* Social Media Connect Buttons (Inspired by GHL) */
.social-auth-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.social-connect-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 140px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.social-connect-btn:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.social-connect-btn:active {
    transform: translateY(0);
    background: #f1f5f9;
}

.social-connect-btn .platform-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-connect-btn.connected {
    border-color: #10b981;
    background: #ecfdf5;
}

/* Beacon Onboarding UI */
.modal-intro {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.tab-scroller {
    display: flex;
    gap: 1.5rem;
    margin: -1.5rem -1.5rem 1.5rem -1.5rem;
    padding: 0 1.5rem;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: -2rem;
    z-index: 100;
}

.tab-item {
    padding: 1rem 0;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-item:hover {
    color: var(--text-primary);
}

.tab-item.active {
    color: var(--accent-color) !important;
    border-bottom-color: var(--accent-color) !important;
}

.required {
    color: #ef4444;
    margin-left: 2px;
}

/* Onboarding Suite Premium Styles */
.onboarding-suite {
    max-width: 600px !important;
    border-radius: 16px !important;
    border: 1px solid rgba(var(--accent-rgb), 0.1);
}

.onboarding-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white !important;
    padding: 2rem !important;
    border-bottom: none !important;
}

.onboarding-header h2 {
    color: white !important;
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.header-main {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.header-subtitle {
    font-size: 0.85rem;
    opacity: 0.7;
    margin: 0;
}

.beacon-pulse-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.5rem;
    position: relative;
    box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.4);
}

.beacon-pulse-icon::after {
    content: "";
    position: absolute;
    inset: -4px;
    border: 2px solid var(--accent-color);
    border-radius: 16px;
    opacity: 0.5;
    animation: pulseBeacon 2s infinite;
}

@keyframes pulseBeacon {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.15);
        opacity: 0;
    }
}

.onboarding-section {
    padding: 1.5rem;
    background: rgba(var(--accent-rgb), 0.02);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px dashed var(--border-color);
}

.section-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    background: var(--bg-sidebar);
    padding: 4px 10px;
    border-radius: 4px;
    margin-bottom: 1.25rem;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 12px;
    font-size: 0.9rem;
    opacity: 0.5;
    font-style: normal;
}

.input-with-icon input {
    padding-left: 2.5rem !important;
}

.strategic-context {
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.section-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-style: italic;
}

.social-input-hint {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin-bottom: 6px;
}

.onboarding-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.grounding-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.ready {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.grounding-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.75rem 1.5rem !important;
    border-radius: 10px !important;
}

/* Beacon Button Fix & Input Modernization */
.action-btn-beacon {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
}

.action-btn-beacon:hover {
    background: var(--bg-sidebar) !important;
    border-color: var(--accent-color) !important;
}

.onboarding-suite .form-group label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
}

.onboarding-suite input[type="text"],
.onboarding-suite input[type="url"],
.onboarding-suite textarea {
    padding: 1rem 1.25rem !important;
    font-size: 1rem !important;
    border-radius: 12px !important;
    border: 1px solid var(--input-border) !important;
    background-color: var(--input-bg) !important;
    width: 100% !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.onboarding-suite input:focus,
.onboarding-suite textarea:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.1) !important;
    outline: none !important;
}

.onboarding-suite .input-with-icon i {
    font-size: 1.1rem !important;
    left: 16px !important;
}

.onboarding-suite .input-with-icon input {
    padding-left: 3.25rem !important;
}

/* Strategic Context Section Polish */
.strategic-context {
    background: #ffffff !important;
    padding: 1.5rem !important;
    border-radius: 16px !important;
    border: 1px solid var(--border-color) !important;
}

/* --- Modern Draft Profile Artifact Styles --- */

.hero-style {
    background: linear-gradient(135deg, var(--accent-color), #2d3748);
    color: white;
    padding: 2.5rem;
    border: none;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.brand-hero {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.brand-glyph {
    width: 60px;
    height: 60px;
    background: white;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    border-radius: 12px;
}

.brand-name-display {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.02em;
    color: white;
}

.hero-mission {
    background: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-text {
    background: transparent !important;
    color: white !important;
    font-size: 1.1rem !important;
    font-weight: 500 !important;
    min-height: 100px !important;
}

.modern-textarea {
    width: 100%;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    transition: all 0.2s;
    min-height: 80px;
    resize: vertical;
}

.modern-textarea:focus {
    background: white;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}

.modern-input {
    width: 100%;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

.modern-input:focus {
    background: white;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}

.modern-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.category-cloud {
    background: var(--bg-sidebar);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.tag-input {
    font-weight: 600;
    color: var(--accent-color);
    letter-spacing: 0.02em;
}

.sitemap-explorer {
    margin-top: 2rem;
}

.subsection-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    margin: 0;
}

.modern-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sitemap-node {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    position: relative;
    transition: transform 0.2s;
}

.sitemap-node:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.node-icon {
    font-size: 1.5rem;
    opacity: 0.5;
}

.node-details {
    flex: 1;
}

.node-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    opacity: 0.5;
}

.node-remove:hover {
    opacity: 1;
    color: #ef4444;
}

.modern-input.compact {
    padding: 0.25rem 0;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.modern-textarea.compact {
    padding: 0.25rem 0;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    min-height: 40px !important;
    font-size: 0.85rem;
}

.foundation-card {
    padding: 0;
    overflow: hidden;
}

.foundation-header {
    padding: 1.5rem 2rem;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.status-pill {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-pill.success {
    background: #dcfce7;
    color: #166534;
}

.document-paper {
    padding: 2rem;
    background: #fff;
    background-image: linear-gradient(var(--border-color) 1px, transparent 1px);
    background-size: 100% 2.5rem;
}

.paper-textarea {
    width: 100%;
    min-height: 400px;
    border: none;
    background: transparent;
    font-family: var(--font-mono);
    font-size: 1rem;
    line-height: 2.5rem;
    color: #334155;
    resize: none;
    outline: none;
}

.stat-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-card-modern {
    padding: 1.5rem;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
}

.bold-text {
    font-weight: 800;
}

.center-text {
    text-align: center;
}

.accent-text {
    color: var(--accent-color);
}

.small-text {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.social-input-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.social-group {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--bg-sidebar);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.social-icon {
    font-size: 1.5rem;
}

.social-field {
    flex: 1;
}

.social-field label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-tertiary);
    font-weight: 700;
    margin-bottom: 2px;
}

.modern-input.transparent {
    background: transparent;
    border: none;
    padding: 0;
    font-weight: 600;
    color: var(--text-primary);
}

.artifact-action-footer {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 1.5rem 0 0 0;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.pulse-on-hover:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(var(--accent-rgb), 0.3);
}

/* Premium Article Container */
.rendered-article {
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.85;
    /* Professional breathing room */
    color: #334155;
    /* Slate 700 */
    font-size: 1.125rem;
}

/* Headings */
.article-section-header {
    margin-top: 3.5rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
    color: var(--accent-color);
    font-weight: 800;
}

/* Internal Benefit-Driven Links */
.artifact-internal-link {
    color: var(--accent-color);
    background: rgba(var(--accent-rgb), 0.08);
    padding: 0 4px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.3);
    transition: all 0.2s;
}

.artifact-internal-link:hover {
    background: var(--accent-color);
    color: white;
}

/* Blockquotes for Case Studies/Quotes */
.rendered-article blockquote {
    border-left: 4px solid var(--accent-color);
    background: #f8fafc;
    padding: 1.5rem;
    margin: 2.5rem 0;
    font-style: italic;
    font-size: 1.25rem;
    color: #475569;
}

/* Table Wrapper for Scannability */
.artifact-table-wrapper {
    overflow-x: auto;
    margin: 2.5rem 0;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.artifact-table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
}

.artifact-table-wrapper th {
    background: var(--bg-sidebar);
    text-align: left;
    padding: 1rem;
    font-weight: 700;
    border-bottom: 2px solid var(--border-color);
}

.artifact-table-wrapper td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* --- Team Modal Expansion Styles --- */
.promo-text-box {
    background: linear-gradient(135deg, var(--accent-color) 0%, #1e293b 100%);
    color: white;
    padding: 2rem;
    border-radius: 16px;
    margin: 2rem 0;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.promo-text-box h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    color: white;
    letter-spacing: -0.02em;
}

.promo-text-box p {
    font-size: 1.1rem;
    opacity: 0.9;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

.future-hires-section {
    margin-top: 3rem;
}

.future-hires-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.future-hires-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.future-hires-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.future-hire-card {
    background: var(--bg-app);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    color: var(--text-tertiary);
    transition: all 0.3s ease;
    opacity: 0.7;
}

.future-hire-card:hover {
    border-color: var(--accent-color);
    opacity: 1;
    transform: scale(1.02);
}

.future-hire-card i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.future-hire-card h4 {
    margin: 0.5rem 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.future-hire-card span {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

body.dark-theme .future-hire-card {
    background: rgba(255, 255, 255, 0.02);
}

.agent-avatar-placeholder.outline {
    background: transparent;
    border: 2px dashed var(--border-color);
    color: var(--text-tertiary);
}

/* --- Global Artifact Utility Classes (Premium Design System) --- */

/* 1. Score Visualization */
.artifact-score-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 2.5rem 0;
    position: relative;
}

.artifact-score-ring {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 10px;
    background: var(--bg-app);
    border: 10px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.artifact-score-ring:hover {
    transform: scale(1.05);
}

.artifact-score-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
}

.artifact-score-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 6px;
    text-align: center;
    max-width: 120px;
    line-height: 1.3;
}

/* Status Colors */
.status-success {
    border-color: #22c55e !important;
    color: #166534;
}

.status-warning {
    border-color: #f59e0b !important;
    color: #92400e;
}

.status-danger {
    border-color: #ef4444 !important;
    color: #991b1b;
}

/* 2. Issue & Feedback Lists */
.artifact-feedback-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.artifact-feedback-item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1.25rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    transition: all 0.2s ease;
}

.artifact-feedback-item:hover {
    border-color: var(--text-tertiary);
    transform: translateX(4px);
}

.artifact-feedback-item.issue {
    background: #fffafa;
    border-color: #fee2e2;
}

.artifact-feedback-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: -2px;
}

.artifact-feedback-text {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-primary);
    font-weight: 500;
}

/* 3. Metrics & Badges */
.artifact-metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.artifact-metric-row:last-child {
    border-bottom: none;
}

.artifact-metric-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.artifact-metric-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-sidebar);
}

/* 4. Recommendation Highlight Box */
.artifact-action-box {
    background: var(--accent-color);
    color: var(--accent-text);
    padding: 1.75rem;
    border-radius: 12px;
    margin-top: 2rem;
    position: relative;
    box-shadow: 0 10px 20px rgba(var(--accent-rgb), 0.15);
}

.artifact-action-box h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.artifact-action-list {
    margin: 0;
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.artifact-action-list li {
    font-size: 0.95rem;
    line-height: 1.4;
    font-weight: 400;
    opacity: 0.9;
}

/* 5. Section Dividers & Labels */
.markdown-body {
    line-height: 1.6;
    color: var(--text-primary);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.markdown-body p {
    margin-bottom: 1.25rem;
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 1.25rem;
    padding-left: 2rem;
}

.markdown-body li {
    margin-bottom: 0.5rem;
}

.markdown-body blockquote {
    padding: 0 1rem;
    color: var(--text-secondary);
    border-left: 0.25rem solid var(--border-color);
    margin-bottom: 1.25rem;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.25rem;
}

.markdown-body th,
.markdown-body td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
}

.markdown-body th {
    background: var(--bg-sidebar);
}

.artifact-divider {
    height: 1px;
    background: linear-gradient(to right, var(--border-color), transparent);
    margin: 2.5rem 0;
}

/* Dark Theme Adjustments */
body.dark-theme .artifact-feedback-item {
    background: #1e293b;
}

body.dark-theme .artifact-feedback-item.issue {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
}

body.dark-theme .artifact-metric-value {
    background: #0f172a;
}

/* Publishing Receipt Artifact Styles */
.receipt-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1rem;
}

.receipt-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.receipt-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

.receipt-header {
    padding: 1.25rem;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: #0f172a;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.status-badge.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status-badge.failed {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.status-badge.skipped {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.receipt-body {
    padding: 1.25rem;
}

.receipt-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
}

.info-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #334155;
}

.receipt-error-msg {
    margin: 0;
    font-size: 0.9rem;
    color: #991b1b;
    line-height: 1.5;
    background: #fff5f5;
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 3px solid #ef4444;
}

/* Dark Mode Overrides for Receipt */
body.dark-theme .receipt-card {
    background: #1e293b;
    border-color: #334155;
}

body.dark-theme .receipt-header {
    background: #0f172a;
    border-bottom-color: #334155;
}

body.dark-theme .brand-name {
    color: #f8fafc;
}

body.dark-theme .info-value {
    color: #cbd5e1;
}

body.dark-theme .receipt-error-msg {
    background: #451a1a;
    color: #fecaca;
    border-left-color: #f87171;
}

/* External Link Research Artifact Styles */
.external-link-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    transition: all 0.2s ease;
}

.external-link-card:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.external-link-card.selected {
    border-color: var(--accent-color);
    background: rgba(var(--accent-rgb), 0.02);
}

.link-content {
    flex: 1;
}

.link-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.link-url {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: 0.75rem;
    display: block;
    word-break: break-all;
}

.link-snippet {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.link-actions {
    display: flex;
    gap: 0.75rem;
}

.view-link-btn {
    background: #f1f5f9;
    color: #475569;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.view-link-btn:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

/* Modal Adjustments for Link Preview */
#linkPreviewModal .modal-content {
    border-color: var(--accent-color);
}

body.dark-theme .external-link-card {
    background: #1e293b;
    border-color: #334155;
}

body.dark-theme .view-link-btn {
    background: #334155;
    color: #f8fafc;
}

body.dark-theme .view-link-btn:hover {
    background: #475569;
}

/* Loading Spinner with Pulsing Circle and Animated Dots */
.loading-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pulsing-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse-circle 1.4s ease-in-out infinite;
}

@keyframes pulse-circle {

    0%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

.animated-dots::after {
    content: '';
    animation: dot-animation 1.5s steps(4, end) infinite;
}

@keyframes dot-animation {
    0% {
        content: '';
    }

    25% {
        content: '.';
    }

    50% {
        content: '..';
    }

    75% {
        content: '...';
    }

    100% {
        content: '';
    }
}

/* User Profile Section in Sidebar */
.user-profile-section {
    position: relative;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

.user-profile-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.user-profile-trigger:hover {
    background-color: var(--bg-item-hover);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar svg {
    stroke: white;
}

.user-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-chevron {
    color: var(--text-tertiary);
    transition: transform 0.2s;
}

.user-profile-section.open .user-menu-chevron {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.user-menu-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0.25rem;
    right: 0.25rem;
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-profile-section.open .user-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.user-menu-item:hover {
    background-color: var(--bg-item-hover);
    color: var(--text-primary);
}

.user-menu-item i {
    width: 18px;
    text-align: center;
    font-style: normal;
}

.user-menu-item.danger {
    color: #ef4444;
}

.user-menu-item.danger:hover {
    background-color: #fef2f2;
    color: #dc2626;
}

.user-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

/* Dark theme adjustments */
body.dark-theme .user-menu-dropdown {
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
}

body.dark-theme .user-menu-item.danger:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* Collapsed sidebar - user menu dropdown positioning */
.sidebar.collapsed .user-menu-dropdown {
    left: 0;
    right: 0;
    bottom: 100%;
    width: auto;
    min-width: 160px;
    margin-left: 0;
    margin-bottom: 0.5rem;
    z-index: 9999;
}

/* --- Autopilot Toggle Bar --- */
.autopilot-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    animation: autopilotSlideIn 0.25s ease-out;
}

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

.autopilot-bar-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    letter-spacing: -0.01em;
    line-height: 1;
}

.autopilot-bar-icon {
    font-size: 0.9rem;
    line-height: 1;
}

/* Toggle Switch */
.autopilot-toggle {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.autopilot-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.autopilot-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #cbd5e1;
    border-radius: 22px;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.autopilot-slider::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.autopilot-toggle input:checked + .autopilot-slider {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.autopilot-toggle input:checked + .autopilot-slider::before {
    transform: translateX(18px);
}

.autopilot-toggle input:focus-visible + .autopilot-slider {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Active state label glow */
.autopilot-bar.active .autopilot-bar-label {
    color: #3b82f6;
}

.autopilot-bar.active {
    background: linear-gradient(135deg, #eff6ff 0%, #eef2ff 100%);
    border-bottom-color: rgba(99, 102, 241, 0.15);
}

/* Dark Mode */
body.dark-theme .autopilot-bar {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-bottom-color: #334155;
}

body.dark-theme .autopilot-bar-label {
    color: #94a3b8;
}

body.dark-theme .autopilot-slider {
    background: #475569;
}

body.dark-theme .autopilot-bar.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(99, 102, 241, 0.08) 100%);
    border-bottom-color: rgba(99, 102, 241, 0.2);
}

body.dark-theme .autopilot-bar.active .autopilot-bar-label {
    color: #60a5fa;
}