* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Elegant Black & White Theme */
    --primary-color: #000000;
    --primary-hover: #1a1a1a;
    --primary-light: #2a2a2a;
    --primary-gradient: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    
    /* Secondary Colors - Grayscale */
    --secondary-color: #2a2a2a;
    --secondary-hover: #1a1a1a;
    
    /* Text Colors - Elegant grays */
    --text-primary: #000000;
    --text-secondary: #4a4a4a;
    --text-muted: #8a8a8a;
    --text-light: #b0b0b0;
    
    /* Background Colors - Clean whites and light grays */
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-tertiary: #f5f5f5;
    --bg-hover: #f0f0f0;
    
    /* Border Colors */
    --border-color: #e0e0e0;
    --border-light: #f0f0f0;
    
    /* Sidebar Colors */
    --sidebar-bg: #ffffff;
    --sidebar-text: #2a2a2a;
    --sidebar-active: #f5f5f5;
    --sidebar-hover: #fafafa;
    
    /* Status Colors - Subtle grays with minimal color accents */
    --success-color: #000000;
    --success-light: #f0f0f0;
    --warning-color: #4a4a4a;
    --warning-light: #f5f5f5;
    --error-color: #2a2a2a;
    --error-light: #fafafa;
    --info-color: #1a1a1a;
    --info-light: #f5f5f5;
    
    /* Shadows - Elegant and subtle */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent body scroll */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: 240px;
    height: 100vh;
    max-height: 100vh;
    background: var(--sidebar-bg);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: width 0.3s ease, opacity 0.3s ease;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: 0;
    opacity: 0;
    overflow: hidden;
    border-right: none;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0; /* Prevent header from shrinking */
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-toggle-left {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: all 0.2s;
    z-index: 10;
}

.sidebar-toggle-left:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

.sidebar.collapsed .sidebar-toggle-left {
    display: none;
}

.sidebar-toggle-left-header {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s;
    margin-right: 12px;
    font-weight: 500;
}

.sidebar-toggle-left-header:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
}

.logo-image {
    width: 100%;
    max-width: 120px;
    height: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
}

.nav-section {
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    min-height: 0;
    flex-shrink: 0;
}
.nav-section.acc-projects-section {
    flex: 1;
    overflow-y: auto;
}

.nav-section-title {
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0; /* Prevent title from shrinking */
}

/* Data source switcher (left sidebar) */
.source-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 12px 12px;
}
.source-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: background 0.2s, color 0.2s;
}
.source-nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}
.source-nav-item.active {
    background: var(--sidebar-active);
    color: var(--primary-color);
    font-weight: 600;
    border-left: 3px solid var(--primary-color);
    margin-left: 0;
    padding-left: 11px;
}
.source-icon {
    font-size: 18px;
    flex-shrink: 0;
}
.source-label {
    flex: 1;
    min-width: 0;
}
.acc-projects-section {
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
    padding-top: 8px;
}

/* Thread section in sidebar */
.threads-section {
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
    padding-top: 0;
    flex-shrink: 0;
}
.threads-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 14px !important;
    cursor: pointer;
    user-select: none;
}
.threads-header-left {
    display: flex;
    align-items: center;
    gap: 4px;
}
.threads-chevron {
    font-size: 10px;
    transition: transform 0.2s;
    display: inline-block;
}
.threads-section.collapsed .threads-chevron {
    transform: rotate(-90deg);
}
.threads-section-body {
    overflow: hidden;
    transition: max-height 0.25s ease-out;
    max-height: 500px;
}
.threads-section.collapsed .threads-section-body {
    max-height: 0;
}
.btn-new-thread {
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    width: 22px;
    height: 22px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.btn-new-thread:hover {
    background: var(--primary-hover);
}
.thread-search-container {
    padding: 0 12px 6px;
}
.thread-search-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-bg, #fff);
    color: var(--text-primary);
    font-size: 12px;
    outline: none;
    box-sizing: border-box;
}
.thread-search-input:focus {
    border-color: var(--primary-color);
}
.thread-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 8px;
    max-height: 300px;
    overflow-y: auto;
}
.thread-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
    position: relative;
}
.thread-item:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}
.thread-item.active {
    background: var(--sidebar-active);
    color: var(--primary-color);
    font-weight: 600;
}
.thread-item .thread-source-icon {
    font-size: 14px;
    flex-shrink: 0;
}
.thread-item .thread-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.thread-item .thread-time {
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.7;
    flex-shrink: 0;
}
.thread-item .thread-delete {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.6;
}
.thread-item:hover .thread-delete {
    display: inline;
}
.thread-item:hover .thread-time {
    display: none;
}
.thread-item .thread-delete:hover {
    color: #e53e3e;
    opacity: 1;
}
.thread-item.thread-busy .thread-source-icon::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
    margin-left: 2px;
    animation: pulse-dot 1s infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.thread-placeholder {
    padding: 12px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.6;
}
.btn-load-more-threads {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 12px;
    padding: 8px;
    text-align: center;
    width: 100%;
}
.btn-load-more-threads:hover {
    text-decoration: underline;
}

/* Header project selector (top center) */
.header-project-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 16px;
}
.header-project-label {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.header-project-select {
    min-width: 180px;
    max-width: 280px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.header-project-select:hover,
.header-project-select:focus {
    outline: none;
    border-color: var(--primary-color);
}
.header-project-select option {
    padding: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
    font-size: 14px;
}

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

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
    font-weight: 600;
}

.nav-icon {
    font-size: 18px;
}

.nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 16px 20px;
}

.project-search-container {
    padding: 0 16px 12px 16px;
    flex-shrink: 0; /* Prevent search container from shrinking */
}

.project-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.2s;
}

.project-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.project-search-input::placeholder {
    color: var(--text-muted);
}

.project-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    max-height: 100%; /* Constrain to parent */
    padding-right: 4px; /* Avoid hide-under-bar feeling */
    /* Mac-style thin scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

/* Chrome/Safari scrollbar - Mac-style thin, appears on hover */
.project-list::-webkit-scrollbar {
    width: 6px;
}

.project-list::-webkit-scrollbar-track {
    background: transparent;
}

.project-list::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    transition: background-color 0.2s;
}

.project-list:hover::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.35);
}

.project-refresh-wrap {
    padding: 8px 12px 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.btn-project-refresh {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--sidebar-bg);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-project-refresh:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
    border-color: rgba(0, 0, 0, 0.2);
}

.btn-project-refresh:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-project-refresh-icon {
    font-size: 14px;
}

.project-item {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    margin: 2px 8px;
}

.project-item:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
    transform: translateX(4px);
}

.project-item.selected {
    background: var(--bg-hover);
    color: var(--primary-color);
    font-weight: 600;
    border-left: 3px solid var(--primary-color);
}

/* Phase I: Global mode selectable projects */
.global-select-actions {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.global-select-btn {
    flex: 1;
    padding: 6px 10px;
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}
.global-select-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.project-item-global {
    cursor: default;
    padding-left: 12px;
}
.project-item-global:hover {
    transform: none;
}
.project-item-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    width: 100%;
}
.project-checkbox {
    flex-shrink: 0;
    cursor: pointer;
}
.project-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.project-status-badge {
    flex-shrink: 0;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
}
.project-status-archived {
    background: rgba(0,0,0,0.08);
    color: var(--text-secondary);
}

.project-item-placeholder {
    padding: 8px 20px;
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px;
    flex-shrink: 0; /* Prevent footer from shrinking */
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    box-shadow: var(--shadow-md);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-logout {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.user-logout:hover {
    color: var(--primary-color);
}

/* ========== MAIN CONTENT ========== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 0;
}

.main-header {
    padding: 20px 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}


.header-left {
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Global Search Toggle */
.global-search-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 20px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

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

.toggle-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    user-select: none;
}

.toggle-switch input:checked ~ .toggle-label {
    color: var(--primary-color);
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: 8px;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

/* Foldable header + project selection (collapse for more chat space) */
.projects-foldable {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}
.projects-foldable-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 32px;
    font: inherit;
    font-size: 14px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.projects-foldable-header:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.projects-foldable-chevron {
    flex-shrink: 0;
    margin-left: 12px;
    font-size: 12px;
    opacity: 0.8;
    transition: transform 0.2s;
}
.projects-foldable.collapsed .projects-foldable-chevron {
    transform: rotate(-90deg);
}
.projects-foldable-content {
    overflow: hidden;
    max-height: 320px;
    transition: max-height 0.25s ease-out;
}
.projects-foldable.collapsed .projects-foldable-content {
    max-height: 0;
}

/* Project selection bar (main content: search + multi-select) */
.project-selection-bar {
    padding: 12px 32px 16px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}
.project-selection-bar-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.project-search-main {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}
.project-search-main:focus {
    outline: none;
    border-color: var(--primary-color);
}
.project-search-main::placeholder {
    color: var(--text-muted);
}
.project-selection-actions {
    display: flex;
    gap: 8px;
}
.btn-global-select {
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}
.btn-global-select:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.project-list-main {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 120px;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
}
.project-list-main::-webkit-scrollbar {
    height: 6px;
}
.project-item-main {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    white-space: nowrap;
}
.project-item-main:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}
.project-item-main.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.project-item-main input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}
.project-item-main .project-name-txt {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-description p {
    color: var(--text-secondary);
    font-size: 14px;
}

.status-bar {
    padding: 12px 32px;
    background: var(--bg-tertiary);
    border-bottom: 1.5px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.status-separator {
    color: var(--border-color);
    margin: 0 12px;
}

.token-info-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.token-info-inline svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.status-bar.connected {
    background: var(--bg-secondary);
    border-bottom: 1.5px solid var(--primary-color);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: pulse 2s infinite;
}

.status-bar.connected .status-indicator {
    background: var(--primary-color);
}

#status-text {
    font-size: 13px;
    color: var(--text-primary);
}


/* ========== ROLE SECTION ========== */
.role-section {
    padding: 24px 32px;
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.role-selector-header {
    margin-bottom: 16px;
}

.role-selector-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

.role-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.role-tab {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.role-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.role-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.suggested-questions {
    margin-top: 24px;
}

.suggested-questions h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.questions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.question-card {
    padding: 14px 18px;
    background: var(--bg-primary);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    color: var(--text-primary);
    text-align: left;
    box-shadow: var(--shadow-sm);
}

.question-card:hover {
    border-color: var(--primary-color);
    background: var(--bg-hover);
    transform: translateX(4px) translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ========== CHAT AREA ========== */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

#welcome-messages-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1;
    pointer-events: none;
    padding: 24px 32px;
}
#welcome-messages-wrapper .welcome-message {
    pointer-events: auto;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
    background: var(--bg-secondary);
}

.welcome-message {
    max-width: 700px;
    margin: 40px auto;
    text-align: center;
}

.welcome-message h2 {
    font-size: 28px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.welcome-message p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.welcome-message ul {
    text-align: left;
    list-style: none;
    padding: 0;
}

.welcome-message li {
    padding: 12px;
    margin-bottom: 8px;
    font-size: 15px;
    color: var(--text-primary);
}

.welcome-message-wide {
    max-width: 820px;
}
.welcome-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
    text-align: left;
}
.welcome-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    transition: box-shadow 0.15s;
}
.welcome-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.welcome-card-icon {
    font-size: 20px;
    flex-shrink: 0;
    line-height: 1.3;
}
.welcome-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.welcome-card-body strong {
    font-size: 14px;
    color: var(--text-primary);
}
.welcome-card-body span {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}
.welcome-card-body em {
    font-style: normal;
    color: #999;
    font-size: 12px;
}
@media (max-width: 700px) {
    .welcome-grid {
        grid-template-columns: 1fr;
    }
}

.message {
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
}

.message.user {
    flex-direction: row-reverse;
}

/* AI Review chat messages */
.user-message {
    flex-direction: row-reverse;
    margin-bottom: 16px;
}

.ai-message {
    margin-bottom: 16px;
}

.user-message .message-content {
    background: var(--bg-secondary, #f5f5f5);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    border: 1px solid var(--border-color);
}

.ai-message .message-content {
    background: #f5f5f5;
    color: #333;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
}

.message-header {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.message-text {
    line-height: 1.6;
    font-size: 14px;
}

/* AI Review response – rich formatting */
.ai-review-message-content .ai-review-response {
    line-height: 1.6;
    color: var(--text-primary);
}
.ai-review-response .ai-review-h1 {
    font-size: 1.35em;
    font-weight: 700;
    margin: 0.75em 0 0.35em;
    color: var(--text-primary);
}
.ai-review-response .ai-review-h2 {
    font-size: 1.2em;
    font-weight: 600;
    margin: 0.75em 0 0.35em;
    padding-bottom: 0.25em;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}
.ai-review-response .ai-review-h3 {
    font-size: 1.05em;
    font-weight: 600;
    margin: 0.5em 0 0.25em;
    color: var(--text-primary);
}
.ai-review-response .ai-review-p {
    margin: 0.4em 0;
}
.ai-review-response .ai-review-ul,
.ai-review-response .ai-review-ol {
    margin: 0.4em 0;
    padding-left: 1.5em;
}
.ai-review-response .ai-review-ul li,
.ai-review-response .ai-review-ol li {
    margin: 0.2em 0;
}
.ai-review-response .ai-review-code,
.ai-review-response pre {
    margin: 0.6em 0;
}
.ai-review-response .ai-review-link {
    color: #0066cc;
    text-decoration: underline;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.message.assistant .message-avatar {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.message.user .message-avatar {
    background: var(--secondary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.message-content {
    max-width: 70%;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
}

.message.assistant .message-content {
    background: white;
    border: 1.5px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.message.user .message-content {
    background: var(--bg-secondary, #f5f5f5);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.message.system .message-content {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    color: var(--text-primary);
    max-width: 100%;
}

/* Collapsible system messages */
.collapsible-system-message {
    margin-bottom: 8px;
}

.collapsible-system-header {
    font-weight: 500;
    color: #92400e;
    transition: color 0.2s;
}

.collapsible-system-header:hover {
    color: #78350f;
}

.collapsible-system-content {
    margin-top: 8px;
    padding: 8px;
    background: #ffffff;
    border-radius: 4px;
    border: 1px solid #fbbf24;
    max-height: 400px;
    overflow-y: auto;
    font-size: 0.9em;
    line-height: 1.5;
}

/* Thinking section styling - separate container from response */
.message.assistant .thinking-section {
    margin-bottom: 12px;
    margin-top: 0;
    margin-left: 50px; /* Align with message content (account for avatar) */
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-left: 3px solid #6c757d;
    border-radius: 4px;
    font-size: 0.9em;
    color: #6c757d;
    display: none; /* Hidden by default, shown when thinking arrives */
    /* Separate container - not inside message-content */
    max-width: 70%;
    box-sizing: border-box;
}

.thinking-header {
    font-weight: 600;
    margin-bottom: 8px;
    color: #495057;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.thinking-header:hover {
    color: #212529;
}

.thinking-toggle {
    font-size: 0.85em;
    color: #6c757d;
    font-weight: normal;
    transition: color 0.2s;
}

.thinking-header:hover .thinking-toggle {
    color: #495057;
}

.thinking-content {
    white-space: pre-wrap;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85em;
    line-height: 1.5;
    color: #495057;
    /* Collapsed by default; JS toggles to block when user clicks "Show" */
    display: none;
}

.response-section {
    /* Response content styling - inherits from .message-content */
    /* Ensure response is visually separate from thinking */
    margin-top: 0;
    padding-top: 0;
}

/* Collapsible JSON/SQL code blocks in chat - body collapsed by default */
.collapsible-code-block .collapsible-code-header {
    cursor: pointer;
}
.collapsible-code-block pre {
    display: none; /* Shown when user clicks "Show"; JS toggles to block */
}

/* Progress indicator between thinking and response */
.response-progress {
    margin: 16px 0;
    padding: 16px;
    background: #f0f9ff;
    border-left: 3px solid #3b82f6;
    border-radius: 4px;
    display: none; /* Hidden by default, shown when thinking completes */
}

.progress-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e0e7ff;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-text {
    color: #1e40af;
    font-size: 0.9em;
    font-weight: 500;
}

/* Processing notice progress bar */
.processing-notice .progress-bar-container {
    width: 100%;
    height: 8px;
    background: #fde68a;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.processing-notice .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #ff8c5a);
    border-radius: 4px;
    width: 0%;
    transition: width 0.1s linear;
    box-shadow: 0 0 8px rgba(255, 107, 53, 0.3);
}

.processing-notice .progress-text {
    text-align: center;
    font-weight: 500;
}

/* ========== CHAT INPUT ========== */
/* Example Queries in Welcome Message */
.example-queries-section {
    margin-top: 28px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

.example-queries-section h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 14px;
    letter-spacing: 0.01em;
    text-align: left;
}

.example-queries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.example-query-card {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
    text-align: left;
}

.example-query-card:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.example-query-card .example-icon {
    transition: transform 0.25s ease;
}

.example-query-card:hover .example-icon {
    transform: scale(1.1);
}

.example-query-card:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.example-icon {
    font-size: 20px;
    margin-right: 12px;
    flex-shrink: 0;
}

.example-text {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-primary);
}

.example-query-card:hover .example-text {
    color: white;
}

/* Suggested Queries */
.suggested-queries {
    padding: 12px 32px 8px 32px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
    animation: slideDown 0.3s ease-out;
}

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

.suggested-queries-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.suggested-queries-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.query-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
}

.query-chip:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.query-chip:active {
    transform: translateY(0);
}

.query-chip .chip-icon {
    margin-right: 6px;
    font-size: 14px;
}

.chat-input-wrapper {
    border-top: 1px solid var(--border-color);
    background: white;
    padding: 20px 32px;
}

.chat-input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    max-width: none;
    margin: 0;
    width: 100%;
}

#user-input,
#ai-review-user-input {
    flex: 1;
    padding: 14px 18px;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 150px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

#user-input:focus,
#ai-review-user-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05), var(--shadow-md);
    background: white;
}

.btn-send {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    letter-spacing: 0.3px;
}

.btn-send:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-send:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-send:disabled {
    background: var(--text-muted);
    border-color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.5;
}

/* ========== BUTTONS ========== */
.btn-login,
.btn-logout,
.btn-help,
.btn-features {
    padding: 10px 20px;
    border: 2px solid var(--primary-color);
    background: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    letter-spacing: 0.2px;
}

.btn-help {
    padding: 10px;
    min-width: 40px;
    border-radius: 8px;
}

.btn-help svg {
    width: 20px;
    height: 20px;
    display: block;
    transition: transform 0.3s;
    stroke-width: 2;
}

.btn-login {
    background: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
    box-shadow: var(--shadow-md);
}

.btn-login:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-logout {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.btn-logout:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-help:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-help:hover svg {
    transform: scale(1.1);
}

.btn-features {
    padding: 10px 16px;
}

.btn-features.highlighted {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border-color: #4CAF50;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.4), var(--shadow-md);
    animation: pulse-highlight 2s ease-in-out infinite;
}

@keyframes pulse-highlight {
    0%, 100% {
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.4), var(--shadow-md);
    }
    50% {
        box-shadow: 0 0 30px rgba(76, 175, 80, 0.6), var(--shadow-lg);
    }
}

.btn-features:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-features.highlighted:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    color: white;
    border-color: #45a049;
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.6), var(--shadow-lg);
}

.btn-features:hover svg {
    transform: scale(1.1);
}


/* ========== FILE LINKS ========== */
.file-link {
    color: var(--primary-color) !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-block;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
}

.file-link:hover {
    background: var(--bg-tertiary);
    color: var(--primary-color) !important;
    text-decoration: none !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-color);
}

/* ========== MODAL ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* File viewer modal should appear above other modals (e.g., chat history) */
#file-viewer-modal {
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90vw;
    height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
}

.modal-content-large {
    max-width: 1200px;
    width: 95vw;
    max-height: 95vh;
    height: auto;
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
}

#file-viewer-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

#forge-viewer {
    width: 100%;
    height: 100%;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.btn-download {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.2px;
}

.btn-download:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ========== ANIMATIONS ========== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ========== RIGHT SIDEBAR - WORK PACKAGES ========== */
.right-sidebar {
    width: 640px;
    min-width: 400px;
    max-width: 90vw;
    background: white;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-color);
    transition: opacity 0.3s ease;
    flex-shrink: 0;
    position: relative;
}

.sidebar-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    cursor: ew-resize;
    background: transparent;
    z-index: 10;
    transition: background 0.2s;
}

.sidebar-resize-handle:hover {
    background: var(--primary-color);
}

.sidebar-resize-handle.resizing {
    background: var(--primary-color);
    width: 2px;
}

.right-sidebar.collapsed {
    width: 40px;
    min-width: 40px;
    overflow: hidden;
    border-left: none;
}

/* Keep toggle button visible and clickable when collapsed */
.right-sidebar.collapsed .right-sidebar-header {
    width: 40px;
    padding: 0;
    justify-content: center;
    opacity: 1 !important;
    display: flex !important;
    pointer-events: auto !important;
}

.right-sidebar.collapsed .right-sidebar-header h3 {
    display: none;
}

.right-sidebar.collapsed .right-sidebar-header .sidebar-toggle-btn {
    margin: 0;
    padding: 8px;
    pointer-events: auto !important;
    cursor: pointer !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.right-sidebar.collapsed .right-sidebar-content {
    opacity: 0;
    pointer-events: none;
}

.right-sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.right-sidebar-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.feature-selector-container {
    flex: 1;
    min-width: 0;
}

.feature-selector {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.feature-selector:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.feature-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.sidebar-toggle-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Toggle button icon rotation is handled in JavaScript */

.right-sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.assets-search-container {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.assets-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.assets-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.assets-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.assets-placeholder {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.asset-item {
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.asset-item:hover {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.asset-item.expanded {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.asset-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.asset-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
    flex: 1;
}

.asset-code {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 8px;
}

.asset-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    transition: transform 0.2s;
}

.asset-item.expanded .asset-toggle {
    transform: rotate(90deg);
}

.asset-files {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    display: none;
}

.asset-item.expanded .asset-files {
    display: block;
}

.asset-file-item {
    padding: 8px;
    margin-bottom: 4px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

.asset-file-item:hover {
    background: var(--bg-tertiary);
}

.asset-file-name {
    flex: 1;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asset-file-actions {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.asset-file-download {
    background: #000000;
    color: white;
    border: 2px solid #000000;
    cursor: pointer;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.3s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.asset-file-download:hover {
    background: #1a1a1a;
    border-color: #1a1a1a;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.asset-files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.asset-files-count {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Unified View / Download button style (same across all pages) */
.btn-view,
a.btn-view {
    padding: 6px 12px;
    background: white;
    color: #000;
    border: 2px solid #000;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}
.btn-view:hover,
a.btn-view:hover {
    background: #f5f5f5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.btn-download,
a.btn-download {
    padding: 6px 12px;
    background: #000;
    color: white;
    border: 2px solid #000;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}
.btn-download:hover,
a.btn-download:hover {
    background: #1a1a1a;
    border-color: #1a1a1a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.asset-batch-download {
    background: #000000;
    color: white;
    border: 2px solid #000000;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.asset-batch-download:hover {
    background: #1a1a1a;
    border-color: #1a1a1a;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.asset-batch-download:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.asset-view-files {
    background: white;
    color: #000000;
    border: 2px solid #000000;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.asset-view-files:hover {
    background: #000000;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.asset-loading {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.asset-error {
    padding: 20px;
    text-align: center;
    color: var(--error-color);
    font-size: 14px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -240px;
        transition: left 0.3s;
        z-index: 100;
    }

    .sidebar.open {
        left: 0;
}

    .message-content {
        max-width: 90%;
    }
}
