/* Thread Style - Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Thread Color System */
    --color-black: #000000;
    --color-white: #FFFFFF;

    /* Gray Scale */
    --gray-10: #FAFAFA;
    --gray-20: #E5E5E5;
    --gray-30: #999999;
    --gray-40: #4D4D4D;
    --gray-50: #1A1A1A;

    /* Border */
    --border-primary: rgba(0, 0, 0, 0.1);
    --border-divider: #E5E5E5;

    /* Background */
    --bg-primary: #FFFFFF;
    --bg-secondary: #FAFAFA;

    /* Text */
    --text-primary: #000000;
    --text-secondary: #737373;
    --text-muted: #999999;

    /* Accent Colors */
    --accent-blue: #0095F6;
    --accent-red: #E57373;
    --accent-green: #00BA7C;

    /* Dimensions */
    --sidebar-width: 240px;
    --content-max-width: 640px;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-full: 50%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.4;
    font-size: 15px;
}

/* Layout Container */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar with Text Labels */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-divider);
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    margin-bottom: 16px;
    text-decoration: none;
    color: var(--text-primary);
}

.sidebar-logo svg {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.sidebar-logo span {
    font-size: 18px;
    font-weight: 700;
}

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

.sidebar-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 15px;
}

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

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

.nav-item svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.nav-item img {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    flex-shrink: 0;
}

.nav-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-divider);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Hidden elements for Thread style */
.sidebar h3,
.workspace-list,
.btn-add-workspace {
    display: none;
}

/* Main Content Area */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    padding: 0;
}

.content-inner {
    width: 100%;
    min-height: 100vh;
}

/* Top Navigation Bar (Thread Style) */
.navbar {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 16px 20px;
    display: none; /* Hidden by default in Thread style */
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-divider);
    position: sticky;
    top: 0;
    z-index: 50;
}

/* Page Header */
.page-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-divider);
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    flex: 1;
}

.page-header .logout-btn,
.page-header .btn {
    height: 36px;
    padding: 0 14px;
}

.header-dropdown {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex: 1;
}

.header-dropdown svg {
    width: 16px;
    height: 16px;
}

/* User Info in Header */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-full);
    object-fit: cover;
}

/* Feed/Message List */
.message-list,
.feed {
    display: flex;
    flex-direction: column;
    padding-bottom: 80px; /* Space for fixed pagination */
}

/* Message Card (Thread Style Post) */
.message {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-divider);
    display: flex;
    gap: 12px;
    transition: background 0.2s;
}

.message:hover {
    background: var(--gray-10);
}

.message-avatar {
    flex-shrink: 0;
}

.message-avatar img,
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-full);
    object-fit: cover;
}

.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.avatar svg {
    width: 24px;
    height: 24px;
    color: rgba(255, 255, 255, 0.9);
}

/* Avatar color palette */
.avatar-color-0 { background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%); }
.avatar-color-1 { background: linear-gradient(135deg, #1E3A5F 0%, #2E5077 100%); }
.avatar-color-2 { background: linear-gradient(135deg, #E84855 0%, #FF6B6B 100%); }
.avatar-color-3 { background: linear-gradient(135deg, #F9A825 0%, #FFD54F 100%); }
.avatar-color-4 { background: linear-gradient(135deg, #2ECC71 0%, #58D68D 100%); }
.avatar-color-5 { background: linear-gradient(135deg, #9B59B6 0%, #BB8FCE 100%); }
.avatar-color-6 { background: linear-gradient(135deg, #00BCD4 0%, #4DD0E1 100%); }
.avatar-color-7 { background: linear-gradient(135deg, #607D8B 0%, #90A4AE 100%); }

.avatar-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-small svg {
    width: 16px;
    height: 16px;
    color: rgba(255, 255, 255, 0.9);
}

.message-body {
    flex: 1;
    min-width: 0;
}

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

.message-user {
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.message-user:hover {
    text-decoration: underline;
}

.verified-badge {
    width: 16px;
    height: 16px;
    color: var(--accent-blue);
}

.message-time {
    color: var(--text-muted);
    font-size: 14px;
}

.message-time::before {
    content: "·";
    margin: 0 4px;
}

.message-workspace,
.message-channel {
    font-size: 12px;
    padding: 2px 8px;
    background: var(--gray-10);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    margin-left: 8px;
}

.message-text {
    color: var(--text-primary);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Code blocks */
.code-block {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    overflow-x: auto;
    margin: 8px 0;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
}

.code-block code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

.inline-code {
    background: #f0f0f0;
    color: #e83e8c;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.9em;
}

/* Message Actions (Like, Comment, Repost, Share) */
.message-actions {
    display: flex;
    gap: 16px;
    margin-top: 12px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    margin: -8px;
    border-radius: var(--border-radius-full);
    transition: all 0.2s;
    font-size: 13px;
}

.action-btn:hover {
    background: var(--gray-10);
}

.action-btn:hover .icon-heart {
    color: var(--accent-red);
}

.action-btn:hover .icon-comment {
    color: var(--accent-blue);
}

.action-btn:hover .icon-repost {
    color: var(--accent-green);
}

.action-btn svg {
    width: 20px;
    height: 20px;
}

/* Message Thread Indicator */
.message-thread {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--gray-10);
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
}

.message-reactions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.reaction {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--gray-10);
    border-radius: var(--border-radius-sm);
    font-size: 13px;
}

/* Compose Box */
.compose-box {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-divider);
    display: flex;
    gap: 12px;
}

.compose-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 15px;
    color: var(--text-primary);
    resize: none;
    outline: none;
}

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

.compose-btn {
    padding: 8px 16px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--border-radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.compose-btn:hover {
    opacity: 0.8;
}

.compose-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Search Page (Thread Style) */
.search-container {
    padding: 16px 20px;
}

.search-form {
    margin-bottom: 0;
}

.search-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    padding-left: 44px;
    border: 1px solid var(--border-divider);
    border-radius: var(--border-radius-lg);
    font-size: 15px;
    background: var(--gray-10);
    color: var(--text-primary);
    transition: all 0.2s;
}

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

.search-input-wrapper {
    position: relative;
}

.search-input-wrapper svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.search-select {
    padding: 12px 16px;
    border: 1px solid var(--border-divider);
    border-radius: var(--border-radius-lg);
    font-size: 15px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* Global input styles */
input, textarea, select {
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
}

.search-tips {
    padding: 20px;
    border-bottom: 1px solid var(--border-divider);
}

.search-tips h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
}

.search-tips ul {
    list-style: none;
}

.search-tips li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-divider);
    font-size: 14px;
    color: var(--text-secondary);
}

.search-tips li:last-child {
    border-bottom: none;
}

/* Follow Suggestions */
.suggestions {
    padding: 16px 20px;
}

.suggestions-title {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

.suggestion-info {
    flex: 1;
}

.suggestion-name {
    font-weight: 600;
    font-size: 14px;
}

.suggestion-handle {
    font-size: 14px;
    color: var(--text-muted);
}

.follow-btn {
    padding: 8px 16px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

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

/* Stats Grid (Dashboard) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: var(--border-divider);
    border-bottom: 1px solid var(--border-divider);
}

.stat-card {
    background: var(--bg-primary);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

/* Info Section */
.info-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-divider);
}

.info-section h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
}

.info-section p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.info-section p:last-child {
    margin-bottom: 0;
}

/* Channel List */
.channel-list {
    display: flex;
    flex-direction: column;
}

.channel-card {
    display: flex;
    align-items: center;
    padding: 0 20px 0 0;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-divider);
    transition: background 0.2s, opacity 0.2s, transform 0.2s;
}

.channel-card:hover {
    background: var(--gray-10);
}

.channel-link {
    display: flex;
    align-items: center;
    flex: 1;
    padding: 16px 0 16px 20px;
    text-decoration: none;
    color: inherit;
}

.channel-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-10);
    border-radius: var(--border-radius-full);
    margin-right: 12px;
    font-size: 18px;
}

.channel-info {
    flex: 1;
}

.channel-name {
    font-weight: 600;
    font-size: 15px;
}

.channel-purpose {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 2px;
}

.channel-count {
    font-size: 13px;
    color: var(--text-muted);
    padding: 4px 12px;
    background: var(--gray-10);
    border-radius: var(--border-radius-lg);
}

/* Sync Toggle Switch */
.sync-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    margin-left: 12px;
    cursor: pointer;
}

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

.sync-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-20);
    border-radius: var(--border-radius-lg);
    transition: 0.3s;
}

.sync-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.sync-toggle input:checked + .sync-slider {
    background-color: var(--accent-green);
}

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

.sync-toggle input:disabled + .sync-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Empty state inline for channel sections */
.empty-state-inline {
    padding: 24px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    border-bottom: 1px solid var(--border-divider);
}

.empty-state-inline p {
    margin: 0;
}

/* Hide empty state when there are synced channels */
#synced-channels .channel-card ~ .empty-state-inline {
    display: none;
}

/* Hide empty state when there are DMs */
#dm-channels .dm-card ~ .empty-state-inline {
    display: none;
}

/* DM card styling */
.dm-card {
    background: var(--bg-tertiary);
}

.dm-card .channel-name {
    color: var(--text-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--text-primary);
    color: var(--bg-primary);
}

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

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-divider);
}

.btn-secondary:hover {
    background: var(--gray-10);
}

.btn.disabled,
.btn-secondary.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-danger {
    background: var(--accent-red);
    color: var(--bg-primary);
}

.btn-danger:hover {
    opacity: 0.85;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-divider);
    background: var(--bg-primary);
    position: fixed;
    bottom: 0;
    left: 280px;
    right: 0;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.page-info {
    color: var(--text-muted);
    font-size: 14px;
}

.page-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-num {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
}

.page-num:hover {
    background: var(--gray-20);
    color: var(--text-primary);
}

.page-num.active {
    background: var(--accent-blue);
    color: white;
    font-weight: 600;
}

.page-ellipsis {
    color: var(--text-muted);
    padding: 0 4px;
}

/* Collapsible Sections */
.collapsible {
    cursor: pointer;
    user-select: none;
}

.collapsible:hover {
    background: var(--gray-10);
    border-radius: var(--border-radius-md);
}

.collapsible h2 {
    display: flex;
    align-items: center;
}

.collapse-icon {
    flex-shrink: 0;
}

.collapsible-content {
    transition: max-height 0.3s ease, opacity 0.2s ease;
    overflow: hidden;
}

.collapsible-content.collapsed {
    max-height: 0 !important;
    opacity: 0;
    margin: 0;
    padding: 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 20px;
}

/* Error */
.error-view {
    text-align: center;
    padding: 60px 20px;
}

.error-box {
    background: #FEF2F2;
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
    padding: 16px;
    border-radius: var(--border-radius-md);
    margin: 16px 0;
}

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    padding: 16px 20px;
}

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

.back-link svg {
    width: 20px;
    height: 20px;
}

/* Channel Header */
.channel-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-divider);
}

.channel-header h1 {
    font-size: 20px;
    font-weight: 700;
}

.channel-topic {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

/* Workspace Header */
.workspace-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-divider);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.workspace-title {
    flex: 1;
    min-width: 0;
}

.workspace-title h1 {
    font-size: 20px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workspace-domain {
    color: var(--text-muted);
    font-size: 14px;
}

.workspace-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.workspace-actions .btn,
.workspace-actions .logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    padding: 0 16px;
    white-space: nowrap;
}

/* Quick Actions */
.quick-actions {
    padding: 20px;
    border-bottom: 1px solid var(--border-divider);
}

.quick-actions h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
}

.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* No Data */
.no-data {
    color: var(--text-muted);
    font-style: normal;
    padding: 20px;
    text-align: center;
}

/* View Context Link */
.view-context {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
    color: var(--accent-blue);
    text-decoration: none;
}

.view-context:hover {
    text-decoration: underline;
}

/* Messages Header */
.messages-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-divider);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.messages-header h2 {
    font-size: 16px;
    font-weight: 600;
}

/* Dashboard */
.dashboard h1 {
    padding: 20px;
    font-size: 24px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-divider);
}

/* Login Page */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* Admin Page */
.admin-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-divider);
}

.admin-section h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-divider);
    font-size: 14px;
}

.admin-table th {
    font-weight: 600;
    color: var(--text-muted);
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        bottom: 0;
        top: auto;
        left: 0;
        right: 0;
        flex-direction: row;
        justify-content: space-around;
        padding: 8px 0;
        border-top: 1px solid var(--border-divider);
        border-right: none;
        overflow-x: auto;
    }

    .sidebar-logo {
        display: none;
    }

    .sidebar-section-title {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        gap: 0;
        width: 100%;
        justify-content: space-around;
    }

    .nav-item {
        flex-direction: column;
        gap: 4px;
        padding: 8px;
        font-size: 10px;
    }

    .nav-item span {
        display: none;
    }

    .nav-item svg,
    .nav-item img {
        width: 24px;
        height: 24px;
    }

    .sidebar-bottom {
        display: none;
    }

    .content {
        margin-left: 0;
        margin-bottom: 64px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .workspace-header {
        flex-direction: column;
    }

    .message-actions {
        gap: 8px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --color-black: #FFFFFF;
        --color-white: #000000;

        --gray-10: #1A1A1A;
        --gray-20: #2A2A2A;
        --gray-30: #666666;
        --gray-40: #B3B3B3;
        --gray-50: #E5E5E5;

        --border-primary: rgba(255, 255, 255, 0.1);
        --border-divider: #2A2A2A;

        --bg-primary: #000000;
        --bg-secondary: #0A0A0A;

        --text-primary: #FFFFFF;
        --text-secondary: #A0A0A0;
        --text-muted: #666666;
    }
}

/* Workspace List in Sidebar (for non-icon mode) */
.workspace-sidebar {
    display: none;
}

/* Nav links styling */
.nav-links {
    display: none;
}

.nav-brand {
    display: none;
}

/* Logout button */
.btn-logout {
    padding: 8px 16px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-divider);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    text-decoration: none;
}

.btn-logout:hover {
    background: var(--gray-10);
}

/* Nav admin link */
.nav-admin {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
}

.nav-admin:hover {
    text-decoration: underline;
}

/* User profile in sidebar (non-clickable) */
.user-profile {
    cursor: default;
}

.user-profile:hover {
    background: transparent;
}

/* Logout button in header */
.logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    padding: 0 16px;
    background: transparent;
    border: 1px solid var(--border-divider);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.logout-btn:hover {
    background: var(--gray-10);
    color: var(--text-primary);
}

/* Back link inline in header */
.back-link-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    margin-right: 8px;
}

.back-link-inline:hover {
    background: var(--gray-10);
    color: var(--text-primary);
}

.back-link-inline svg {
    width: 18px;
    height: 18px;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border-divider);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.header-btn:hover {
    background: var(--gray-10);
    color: var(--text-primary);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--bg-primary);
    border-radius: var(--border-radius-md);
    width: 100%;
    max-width: 400px;
    margin: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.2s ease-out;
}

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

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

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

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

.modal-content form {
    padding: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-divider);
    border-radius: var(--border-radius-sm);
    font-size: 15px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--text-primary);
    background: var(--bg-primary);
}

.form-error {
    padding: 10px 14px;
    background: #fef2f2;
    border: 1px solid var(--accent-red);
    border-radius: var(--border-radius-sm);
    color: var(--accent-red);
    font-size: 14px;
    margin-bottom: 16px;
}

.form-success {
    padding: 10px 14px;
    background: #f0fdf4;
    border: 1px solid var(--accent-green);
    border-radius: var(--border-radius-sm);
    color: var(--accent-green);
    font-size: 14px;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 8px;
}

/* Dark mode for form elements */
@media (prefers-color-scheme: dark) {
    .form-error {
        background: rgba(232, 72, 85, 0.1);
    }

    .form-success {
        background: rgba(0, 186, 124, 0.1);
    }
}
