/* Root Variables */
:root {
    --primary-color: #4A90E2;
    --primary-dark: #357ABD;
    --user-message-bg: #4A90E2;
    --assistant-message-bg: #E5E7EB;
    --bg-color: #F9FAFB;
    --text-color: #1F2937;
    --text-light: #6B7280;
    --border-color: #D1D5DB;
    --error-color: #EF4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.2s ease;
    --sidebar-width: 280px;
    --sidebar-bg: #1a1a2e;
    --sidebar-text: #e5e5e5;
    --sidebar-hover: #2d2d44;
    --sidebar-selected: #4A90E2;
}

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

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

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Container (legacy - kept for auth pages) */
.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    background: white;
}

/* App Layout - Sidebar + Main Content */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s ease, min-width 0.3s ease;
    z-index: 100;
    min-width: var(--sidebar-width);
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.new-chat-sidebar-button {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    color: var(--sidebar-text);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-right: 0.5rem;
}

.new-chat-sidebar-button:hover {
    background: var(--sidebar-hover);
    border-color: rgba(255, 255, 255, 0.3);
}

.toggle-sidebar {
    padding: 0.5rem;
    background: transparent;
    color: var(--sidebar-text);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    transition: var(--transition);
}

.toggle-sidebar:hover {
    background: var(--sidebar-hover);
}

/* Conversation List */
.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.loading-conversations {
    padding: 1rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Date Group Headers */
.date-group {
    margin-bottom: 0.5rem;
}

.date-group-header {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Conversation Items */
.conversation-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.25rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.conversation-item:hover {
    background: var(--sidebar-hover);
}

.conversation-item.selected {
    background: var(--sidebar-selected);
}

.conversation-item-content {
    flex: 1;
    min-width: 0;
    margin-right: 0.5rem;
}

.conversation-title {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.125rem;
}

.conversation-date {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.conversation-item.selected .conversation-date {
    color: rgba(255, 255, 255, 0.8);
}

/* Delete Button */
.delete-conversation {
    opacity: 0;
    padding: 0.375rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.conversation-item:hover .delete-conversation {
    opacity: 1;
}

.delete-conversation:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #EF4444;
}

/* Sidebar Integrations Section */
.sidebar-integrations {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.integrations-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.integration-item {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.integration-item.clickable {
    cursor: pointer;
    transition: var(--transition);
}

.integration-item.clickable:hover {
    background: var(--sidebar-hover);
}

.integration-icon {
    margin-right: 0.625rem;
    font-size: 1rem;
}

.integration-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.integration-status {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    margin-left: 0.5rem;
}

.integration-status.connected {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.integration-status.disconnected {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

.integration-add {
    margin-left: auto;
    font-size: 1rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: color 0.2s;
}

.integration-add:hover {
    color: #22c55e;
}

/* Sidebar Scrollbar */
.conversation-list::-webkit-scrollbar {
    width: 6px;
}

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

.conversation-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.conversation-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: white;
}

/* Header Left Section */
.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Header Logo */
.header-logo {
    height: 48px;
    width: auto;
    border-radius: 8px;
}

/* Menu Button (Mobile) */
.menu-button {
    display: none;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    transition: var(--transition);
}

.menu-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Empty State */
.empty-conversations {
    padding: 2rem 1rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
}

.empty-conversations p {
    margin-bottom: 0.5rem;
}

/* Expand Sidebar Button (Desktop) */
.expand-sidebar {
    display: none;
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 101;
    padding: 1rem 0.5rem;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    border: none;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.expand-sidebar:hover {
    background: var(--sidebar-hover);
    padding-left: 0.75rem;
}

/* Show expand button when sidebar is collapsed (desktop only) */
@media (min-width: 769px) {
    .sidebar.collapsed ~ .expand-sidebar,
    .sidebar.collapsed + .app-layout ~ .expand-sidebar {
        display: block;
    }
}

/* Alternative: use body class approach */
body.sidebar-collapsed .expand-sidebar {
    display: block;
}

@media (max-width: 768px) {
    body.sidebar-collapsed .expand-sidebar {
        display: none;
    }
}

/* Header */
header {
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.header-text {
    flex: 1;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

header .subtitle {
    font-size: 0.875rem;
    opacity: 0.9;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* New Chat Button & Logout Button & Notes Link & Desktop Token */
.new-chat-button, .logout-button, .notes-link-button, .desktop-token-button {
    padding: 0.625rem 1.25rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.new-chat-button:hover, .logout-button:hover, .notes-link-button:hover, .desktop-token-button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.new-chat-button:active, .logout-button:active, .notes-link-button:active, .desktop-token-button:active {
    transform: translateY(0);
}

/* Chat Container */
.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* Messages Area */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scroll-behavior: smooth;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-light);
}

.welcome-message p {
    font-size: 1.125rem;
}

/* Message Bubble Base */
.message {
    display: flex;
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease;
}

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

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

/* Message Bubble Content */
.message-bubble {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    word-wrap: break-word;
    box-shadow: var(--shadow-sm);
}

.message.user .message-bubble {
    background-color: var(--user-message-bg);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
    background-color: var(--assistant-message-bg);
    color: var(--text-color);
    border-bottom-left-radius: 4px;
}

.message-text {
    white-space: pre-wrap;
    line-height: 1.5;
}

/* Markdown Content Styles (for Claude's responses) */
.message.assistant .message-text {
    white-space: normal;
}

.message.assistant .message-text p {
    margin: 0 0 0.75em 0;
}

.message.assistant .message-text p:last-child {
    margin-bottom: 0;
}

.message.assistant .message-text strong {
    font-weight: 600;
}

.message.assistant .message-text em {
    font-style: italic;
}

.message.assistant .message-text code {
    background-color: rgba(0, 0, 0, 0.08);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.9em;
}

.message.assistant .message-text pre {
    background-color: rgba(0, 0, 0, 0.08);
    padding: 0.75em 1em;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.75em 0;
}

.message.assistant .message-text pre code {
    background: none;
    padding: 0;
    font-size: 0.85em;
}

.message.assistant .message-text ul,
.message.assistant .message-text ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.message.assistant .message-text li {
    margin: 0.25em 0;
}

.message.assistant .message-text blockquote {
    border-left: 3px solid var(--primary-color, #007bff);
    margin: 0.75em 0;
    padding-left: 1em;
    color: var(--text-secondary, #666);
}

.message.assistant .message-text h1,
.message.assistant .message-text h2,
.message.assistant .message-text h3,
.message.assistant .message-text h4 {
    margin: 1em 0 0.5em 0;
    font-weight: 600;
    line-height: 1.3;
}

.message.assistant .message-text h1:first-child,
.message.assistant .message-text h2:first-child,
.message.assistant .message-text h3:first-child {
    margin-top: 0;
}

.message.assistant .message-text h1 { font-size: 1.4em; }
.message.assistant .message-text h2 { font-size: 1.25em; }
.message.assistant .message-text h3 { font-size: 1.1em; }
.message.assistant .message-text h4 { font-size: 1em; }

.message.assistant .message-text a {
    color: var(--primary-color, #007bff);
    text-decoration: none;
}

.message.assistant .message-text a:hover {
    text-decoration: underline;
}

.message.assistant .message-text table {
    border-collapse: collapse;
    margin: 0.75em 0;
    width: 100%;
    font-size: 0.9em;
}

.message.assistant .message-text th,
.message.assistant .message-text td {
    border: 1px solid var(--border-color, #ddd);
    padding: 0.5em 0.75em;
    text-align: left;
}

.message.assistant .message-text th {
    background-color: rgba(0, 0, 0, 0.04);
    font-weight: 600;
}

.message.assistant .message-text hr {
    border: none;
    border-top: 1px solid var(--border-color, #ddd);
    margin: 1em 0;
}

/* Thinking Indicator */
.message.thinking .message-bubble {
    background-color: var(--assistant-message-bg);
    font-style: italic;
    opacity: 0.8;
}

.thinking-dots {
    display: inline-block;
}

.thinking-dots .dot {
    animation: thinking 1.4s infinite;
    animation-fill-mode: both;
}

.thinking-dots .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dots .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinking {
    0%, 60%, 100% {
        opacity: 0.3;
    }
    30% {
        opacity: 1;
    }
}

/* Chat Input Form */
.chat-input-form {
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.input-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Message Input */
.message-input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.message-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.message-input:disabled {
    background-color: #F3F4F6;
    cursor: not-allowed;
}

/* Send Button */
.send-button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: white;
    background-color: var(--primary-color);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.send-button:hover:not(:disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.send-button:active:not(:disabled) {
    transform: translateY(0);
}

.send-button:disabled {
    background-color: #9CA3AF;
    cursor: not-allowed;
    transform: none;
}

.send-button .loading-icon {
    display: inline-block;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Error Message */
.error-message {
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: #FEE2E2;
    color: var(--error-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    border-left: 4px solid var(--error-color);
}

/* Scrollbar Styling */
.messages::-webkit-scrollbar {
    width: 8px;
}

.messages::-webkit-scrollbar-track {
    background: #F3F4F6;
}

.messages::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* Authentication Pages */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #F3F4F6;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.auth-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    height: 80px;
    width: auto;
    margin-bottom: 1rem;
    border-radius: 12px;
}

.auth-header h1 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-light);
    font-size: 0.875rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-light);
}

.auth-button {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.auth-button:hover {
    background-color: var(--primary-dark);
}

.auth-button:disabled {
    background-color: #9CA3AF;
    cursor: not-allowed;
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-light);
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Responsive Design - Tablet */
@media (max-width: 768px) {
    /* Sidebar - hidden by default on mobile */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Show menu button on mobile */
    .menu-button {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Hide New Chat button in header on mobile (use sidebar instead) */
    .header-actions .new-chat-button {
        display: none;
    }

    header {
        padding: 1.25rem 1.5rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .messages {
        padding: 1rem;
    }

    .message-bubble {
        max-width: 80%;
    }

    .chat-input-form {
        padding: 0.875rem 1rem;
    }
}

/* Responsive Design - Mobile */
@media (max-width: 375px) {
    header {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.25rem;
    }

    header .subtitle {
        font-size: 0.75rem;
    }

    .messages {
        padding: 0.75rem;
    }

    .message-bubble {
        max-width: 85%;
        padding: 0.625rem 0.875rem;
        font-size: 0.9375rem;
    }

    .chat-input-form {
        padding: 0.75rem;
    }

    .input-group {
        gap: 0.5rem;
    }

    .message-input {
        padding: 0.625rem 0.875rem;
        font-size: 0.9375rem;
    }

    .send-button {
        padding: 0.625rem 1rem;
        font-size: 0.9375rem;
    }

    .welcome-message {
        padding: 1.5rem 0.5rem;
    }

    .welcome-message p {
        font-size: 1rem;
    }
}

/* Citations */
.citations {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.8125rem;
}

.citations-header {
    font-weight: 600;
    color: var(--text-light);
    display: block;
    margin-bottom: 0.375rem;
}

.citations-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.citations-list li {
    display: flex;
    align-items: center;
}

.citations-list a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
    word-break: break-word;
}

.citations-list a:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

.citations-list a::before {
    content: '→';
    margin-right: 0.375rem;
    color: var(--text-light);
}

/* Print Styles */
@media print {
    header {
        background: white;
        color: var(--text-color);
    }

    .chat-input-form {
        display: none;
    }

    .message-bubble {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}

/* ============================================
   Inbox Section (Sidebar)
   ============================================ */
.sidebar-inbox {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    max-height: 300px;
    flex-shrink: 0;
}

.inbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.inbox-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.inbox-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inbox-account-select {
    background: rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text);
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    max-width: 120px;
    cursor: pointer;
}

.inbox-account-select:focus {
    outline: 1px solid var(--primary-color);
}

.inbox-refresh {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: var(--transition);
}

.inbox-refresh:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.inbox-refresh.spinning {
    animation: spin 1s linear infinite;
}

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

.inbox-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.25rem 0.5rem;
}

.inbox-loading {
    padding: 1rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
}

.inbox-empty {
    padding: 1rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
}

/* Email Item in Inbox */
.inbox-email-item {
    padding: 0.625rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0.25rem;
}

.inbox-email-item:hover {
    background: var(--sidebar-hover);
}

.inbox-email-item.selected {
    background: var(--sidebar-selected);
}

.inbox-email-item.unread .inbox-email-from,
.inbox-email-item.unread .inbox-email-subject {
    font-weight: 600;
}

.inbox-email-from {
    font-size: 0.75rem;
    color: var(--sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.125rem;
}

.inbox-email-subject {
    font-size: 0.8rem;
    color: var(--sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.125rem;
}

.inbox-email-snippet {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inbox-email-date {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 0.25rem;
}

.inbox-email-account {
    display: inline-block;
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    margin-bottom: 0.2rem;
    text-transform: lowercase;
}

/* Unread indicator dot */
.inbox-email-item.unread::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--primary-color);
    border-radius: 50%;
    position: absolute;
    left: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
}

.inbox-email-item {
    position: relative;
    padding-left: 1rem;
}

/* ============================================
   Email Preview Panel (Slide-over)
   ============================================ */
.email-preview-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
}

.email-preview-overlay.active {
    display: block;
}

.email-preview-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 500px;
    max-width: 100%;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 201;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.email-preview-panel.open {
    transform: translateX(0);
}

.email-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
    flex-shrink: 0;
}

.email-preview-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
}

.email-preview-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-color);
}

.email-preview-actions {
    display: flex;
    gap: 0.5rem;
}

.email-action-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.email-action-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

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

.email-preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.email-preview-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* Email Preview Content Styles */
.email-detail-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.email-detail-subject {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.email-detail-meta {
    font-size: 0.875rem;
    color: var(--text-light);
    line-height: 1.6;
}

.email-detail-meta strong {
    color: var(--text-color);
}

.email-detail-body {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-color);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.email-detail-attachments {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.email-detail-attachments-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.email-attachment-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-color);
    border-radius: 6px;
    font-size: 0.8125rem;
    margin-bottom: 0.25rem;
}

.email-attachment-icon {
    font-size: 1rem;
}

.email-attachment-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-attachment-size {
    color: var(--text-light);
    font-size: 0.75rem;
}

/* Mobile responsive for preview panel */
@media (max-width: 768px) {
    .email-preview-panel {
        width: 100%;
    }

    .inbox-account-select {
        max-width: 80px;
    }

    .sidebar-inbox {
        max-height: 200px;
    }
}

/* ============================================
   Calendar Section (Sidebar)
   ============================================ */
.sidebar-calendar {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    max-height: 350px;
    flex-shrink: 0;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.calendar-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.calendar-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.calendar-account-select {
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 0.125rem 0.25rem;
    font-size: 0.7rem;
    max-width: 100px;
    cursor: pointer;
}

.calendar-account-select:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

.calendar-add-account {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    transition: var(--transition);
}

.calendar-add-account:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    border-color: rgba(255, 255, 255, 0.4);
}

.calendar-refresh {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: var(--transition);
}

.calendar-refresh:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.calendar-refresh.spinning {
    animation: spin 1s linear infinite;
}

/* Calendar filter toggle button */
.calendar-filter-toggle {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: var(--transition);
}

.calendar-filter-toggle:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.calendar-filter-toggle.active {
    background: var(--sidebar-hover);
    color: var(--accent);
}

/* Calendar filters panel */
.calendar-filters {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.calendar-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-sync-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.125rem 0.25rem;
    border-radius: 4px;
    transition: var(--transition);
}

.calendar-sync-btn:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.calendar-sync-btn.spinning {
    animation: spin 1s linear infinite;
}

.calendar-filters-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.calendar-filter-loading {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    padding: 0.5rem;
}

.calendar-filter-account-header {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    padding: 0.5rem 0.25rem 0.25rem 0.25rem;
    margin-top: 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-filter-account-header:first-child {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

.calendar-filter-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
}

.calendar-filter-item:hover {
    background: var(--sidebar-hover);
}

.calendar-filter-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    cursor: pointer;
}

.calendar-filter-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.calendar-filter-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.8);
}

.calendar-filter-item.disabled .calendar-filter-name {
    color: rgba(255, 255, 255, 0.4);
}

.calendar-agenda {
    flex: 1;
    overflow-y: auto;
    padding: 0.25rem 0.5rem;
}

.calendar-loading {
    padding: 1rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
}

.calendar-connect {
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    border-radius: 8px;
    margin: 0.5rem;
    background: rgba(66, 133, 244, 0.1);
    border: 1px dashed rgba(66, 133, 244, 0.3);
    transition: var(--transition);
}

.calendar-connect:hover {
    background: rgba(66, 133, 244, 0.2);
    border-color: rgba(66, 133, 244, 0.5);
}

.calendar-connect .connect-icon {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.calendar-connect .connect-text {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    font-weight: 500;
}

.calendar-connect .connect-hint {
    display: block;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    margin-top: 0.25rem;
}

.calendar-empty {
    padding: 1rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
}

/* Agenda Day Group */
.agenda-day {
    margin-bottom: 0.75rem;
}

.agenda-day-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.375rem 0.5rem;
    margin-bottom: 0.25rem;
}

/* Calendar Event Item */
.calendar-event-item {
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0.25rem;
    border-left: 3px solid var(--primary-color);
    background: rgba(255, 255, 255, 0.03);
}

.calendar-event-item:hover {
    background: var(--sidebar-hover);
}

.calendar-event-item.selected {
    background: var(--sidebar-selected);
}

.calendar-event-item.all-day {
    border-left-color: #9b59b6;
}

.calendar-event-item.has-video {
    border-left-color: #27ae60;
}

.calendar-event-time {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.125rem;
}

.calendar-event-title {
    font-size: 0.8rem;
    color: var(--sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-event-location {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.125rem;
}

.calendar-event-video {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6rem;
    color: #27ae60;
    margin-top: 0.25rem;
}

.calendar-event-account {
    display: inline-block;
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    margin-top: 0.2rem;
    text-transform: lowercase;
}

/* ============================================
   Event Preview Panel (Slide-over)
   ============================================ */
.event-preview-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
}

.event-preview-overlay.active {
    display: block;
}

.event-preview-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 500px;
    max-width: 100%;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 201;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.event-preview-panel.open {
    transform: translateX(0);
}

.event-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
    flex-shrink: 0;
}

.event-preview-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
}

.event-preview-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-color);
}

.event-preview-actions {
    display: flex;
    gap: 0.5rem;
}

.event-action-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.event-action-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

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

.event-action-btn.event-action-danger:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}

.event-preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.event-preview-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* Event Preview Content Styles */
.event-detail-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.event-detail-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.event-detail-time {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.event-detail-time-icon {
    font-size: 1.1rem;
}

.event-detail-date {
    font-size: 0.875rem;
    color: var(--text-light);
}

.event-detail-section {
    margin-bottom: 1.25rem;
}

.event-detail-section-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.5rem;
}

.event-detail-location {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: var(--text-color);
}

.event-detail-location-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.event-detail-video-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: #27ae60;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.event-detail-video-link:hover {
    background: #219a52;
}

.event-detail-description {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-color);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.event-detail-attendees {
    list-style: none;
    padding: 0;
    margin: 0;
}

.event-attendee-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.event-attendee-item:last-child {
    border-bottom: none;
}

.event-attendee-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

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

.event-attendee-name {
    font-size: 0.875rem;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-attendee-email {
    font-size: 0.75rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-attendee-status {
    font-size: 0.7rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    text-transform: capitalize;
}

.event-attendee-status.accepted {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
}

.event-attendee-status.declined {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.event-attendee-status.tentative {
    background: rgba(241, 196, 15, 0.1);
    color: #f39c12;
}

.event-attendee-status.needsaction {
    background: rgba(149, 165, 166, 0.1);
    color: #7f8c8d;
}

.event-organizer-badge {
    font-size: 0.6rem;
    background: var(--primary-color);
    color: white;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    margin-left: 0.375rem;
}

/* Mobile responsive for calendar */
@media (max-width: 768px) {
    .event-preview-panel {
        width: 100%;
    }

    .sidebar-calendar {
        max-height: 250px;
    }
}
/* ============================================
   Tasks Section (Sidebar)
   ============================================ */
.sidebar-tasks {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    max-height: 350px;
    flex-shrink: 0;
}

.tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tasks-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tasks-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.tasks-add-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    transition: var(--transition);
}

.tasks-add-btn:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    border-color: rgba(255, 255, 255, 0.4);
}

.tasks-refresh {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: var(--transition);
}

.tasks-refresh:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.tasks-refresh.spinning {
    animation: spin 1s linear infinite;
}

.tasks-filters {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.task-filter-btn {
    flex: 1;
    padding: 0.375rem 0.5rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    border: none;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: var(--transition);
}

.task-filter-btn:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.task-filter-btn.active {
    background: var(--primary-color);
    color: white;
}

.tasks-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.25rem 0.5rem;
}

.tasks-loading {
    padding: 1rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
}

.tasks-empty {
    padding: 1rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
}

/* Tasks Group */
.tasks-group {
    margin-bottom: 0.5rem;
}

.tasks-group-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.375rem 0.5rem;
    margin-bottom: 0.25rem;
}

.tasks-group-label.overdue {
    color: #e74c3c;
}

/* Task Item */
.task-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0.25rem;
    background: rgba(255, 255, 255, 0.03);
}

.task-item:hover {
    background: var(--sidebar-hover);
}

.task-item.selected {
    background: var(--sidebar-selected);
}

.task-item.completed {
    opacity: 0.5;
}

.task-item.completed .task-title {
    text-decoration: line-through;
}

.task-checkbox {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    transition: var(--transition);
}

.task-checkbox:hover {
    border-color: var(--primary-color);
    background: rgba(74, 144, 226, 0.1);
}

.task-checkbox.checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.task-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
}

.task-content {
    flex: 1;
    min-width: 0;
}

.task-title {
    font-size: 0.8rem;
    color: var(--sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.125rem;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
}

.task-due {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.task-due.overdue {
    color: #e74c3c;
}

.task-due.today {
    color: #f39c12;
}

.task-category {
    color: rgba(255, 255, 255, 0.5);
}

.task-priority {
    font-size: 0.6rem;
}

.task-priority.urgent { color: #e74c3c; }
.task-priority.high { color: #e67e22; }
.task-priority.medium { color: #3498db; }
.task-priority.low { color: rgba(255, 255, 255, 0.4); }

/* ============================================
   Task Preview Panel (Slide-over)
   ============================================ */
.task-preview-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
}

.task-preview-overlay.active {
    display: block;
}

.task-preview-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 500px;
    max-width: 100%;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 201;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.task-preview-panel.open {
    transform: translateX(0);
}

.task-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
    flex-shrink: 0;
}

.task-preview-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
}

.task-preview-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-color);
}

.task-preview-actions {
    display: flex;
    gap: 0.5rem;
}

.task-action-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.task-action-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

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

.task-action-btn.task-action-complete:hover {
    border-color: #27ae60;
    color: #27ae60;
}

.task-action-btn.task-action-danger:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}

.task-preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.task-preview-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* Task Detail Styles */
.task-detail-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.task-detail-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.task-detail-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    text-transform: capitalize;
}

.task-detail-status.pending {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

.task-detail-status.in_progress {
    background: rgba(241, 196, 15, 0.1);
    color: #f39c12;
}

.task-detail-status.completed {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
}

.task-detail-status.cancelled {
    background: rgba(149, 165, 166, 0.1);
    color: #7f8c8d;
}

.task-detail-section {
    margin-bottom: 1.25rem;
}

.task-detail-section-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.5rem;
}

.task-detail-priority {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    text-transform: capitalize;
}

.task-detail-priority.urgent { color: #e74c3c; }
.task-detail-priority.high { color: #e67e22; }
.task-detail-priority.medium { color: #3498db; }
.task-detail-priority.low { color: #7f8c8d; }

.task-detail-due {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: var(--text-color);
}

.task-detail-due.overdue {
    color: #e74c3c;
}

.task-detail-description {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-color);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.task-detail-tag {
    display: inline-block;
    background: var(--bg-color);
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    font-size: 0.8125rem;
    color: var(--text-color);
    margin-right: 0.375rem;
}

/* ============================================
   Quick Add Task Modal
   ============================================ */
.task-add-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 300;
}

.task-add-modal-overlay.active {
    display: block;
}

.task-add-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    max-width: 90%;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 301;
}

.task-add-modal.open {
    display: block;
}

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

.task-add-modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
}

.task-add-modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
}

.task-add-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-color);
}

.task-add-form {
    padding: 1.25rem;
}

.task-form-group {
    margin-bottom: 1rem;
}

.task-form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.375rem;
}

.task-form-group input,
.task-form-group select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.9375rem;
    transition: var(--transition);
}

.task-form-group input:focus,
.task-form-group select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.task-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.task-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.task-form-cancel {
    padding: 0.625rem 1.25rem;
    background: transparent;
    color: var(--text-light);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.task-form-cancel:hover {
    background: var(--bg-color);
    border-color: var(--text-light);
}

.task-form-submit {
    padding: 0.625rem 1.25rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.task-form-submit:hover {
    background: var(--primary-dark);
}

.task-form-submit:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
}

/* Mobile responsive for tasks */
@media (max-width: 768px) {
    .task-preview-panel {
        width: 100%;
    }

    .sidebar-tasks {
        max-height: 250px;
    }

    .task-add-modal {
        width: 95%;
    }

    .task-form-row {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Slack Section Styles
   ======================================== */

.sidebar-slack {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    max-height: 300px;
    display: flex;
    flex-direction: column;
}

.slack-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
}

.slack-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.slack-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.slack-workspace-select {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    cursor: pointer;
    max-width: 120px;
}

.slack-workspace-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.slack-refresh {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    border: none;
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
}

.slack-refresh:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.slack-refresh.spinning {
    animation: spin 1s linear infinite;
}

.slack-add-workspace {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    transition: var(--transition);
}

.slack-add-workspace:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    border-color: rgba(255, 255, 255, 0.4);
}

.slack-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem 0.5rem;
}

.slack-loading {
    padding: 1rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
}

/* Slack Connect Button (when not connected) */
.slack-connect {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    margin: 0.5rem;
    background: var(--sidebar-hover);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.slack-connect:hover {
    background: rgba(255, 255, 255, 0.15);
}

.slack-connect .connect-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.slack-connect .connect-text {
    font-size: 0.8rem;
    font-weight: 500;
}

.slack-connect .connect-hint {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.25rem;
}

/* Channel/DM Group Labels */
.slack-group-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 0.5rem 0.25rem;
}

/* Channel/DM List Items */
.slack-channel-item,
.slack-dm-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
    font-size: 0.8rem;
}

.slack-channel-item:hover,
.slack-dm-item:hover {
    background: var(--sidebar-hover);
}

.slack-channel-item.selected,
.slack-dm-item.selected {
    background: var(--sidebar-selected);
}

.slack-channel-icon {
    color: rgba(255, 255, 255, 0.5);
    margin-right: 0.5rem;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.slack-channel-icon.private {
    color: #E9A820;
}

.slack-dm-avatar {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    margin-right: 0.5rem;
    background: var(--sidebar-hover);
    flex-shrink: 0;
}

.slack-channel-name,
.slack-dm-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.slack-unread-badge {
    background: #E01E5A;
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    margin-left: auto;
}

/* Slack Preview Panel */
.slack-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.slack-preview-overlay.active {
    opacity: 1;
    visibility: visible;
}

.slack-preview-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 400px;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.slack-preview-panel.open {
    transform: translateX(0);
}

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

.slack-preview-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

.slack-preview-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    border-radius: 4px;
    transition: var(--transition);
}

.slack-preview-close:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

.slack-preview-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.slack-preview-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* Slack Message Bubble */
.slack-message {
    margin-bottom: 1rem;
}

.slack-message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.slack-message-author {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-color);
}

.slack-message-time {
    font-size: 0.75rem;
    color: var(--text-light);
}

.slack-message-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-color);
    word-break: break-word;
}

.slack-message.is-own .slack-message-author {
    color: var(--primary-color);
}

/* Quick Reply Input */
.slack-quick-reply {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: #F8F9FA;
}

.slack-quick-reply input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    outline: none;
    transition: var(--transition);
}

.slack-quick-reply input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.slack-quick-reply-btn {
    padding: 0.625rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.slack-quick-reply-btn:hover {
    background: var(--primary-dark);
}

.slack-quick-reply-btn:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
}

/* No Messages State */
.slack-no-messages {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* Mobile responsive for Slack */
@media (max-width: 768px) {
    .slack-preview-panel {
        width: 100%;
    }

    .sidebar-slack {
        max-height: 200px;
    }
}

/* ========================================
   Telegram Section Styles
   ======================================== */

.sidebar-telegram {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    max-height: 300px;
    display: flex;
    flex-direction: column;
}

.telegram-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
}

.telegram-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.telegram-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.telegram-account-select {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    cursor: pointer;
    max-width: 120px;
}

.telegram-account-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.telegram-refresh {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    border: none;
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
}

.telegram-refresh:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.telegram-add-account {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    transition: var(--transition);
}

.telegram-add-account:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    border-color: rgba(255, 255, 255, 0.4);
}

.telegram-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem 0.5rem;
}

.telegram-loading,
.telegram-error,
.telegram-empty,
.telegram-not-configured {
    padding: 1rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
}

/* Telegram Connect Prompt */
.telegram-connect-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    margin: 0.5rem;
    background: var(--sidebar-hover);
    border-radius: var(--border-radius);
}

.telegram-connect-prompt p {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.75rem;
}

.telegram-connect-btn {
    background: #0088cc;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.telegram-connect-btn:hover {
    background: #006699;
}

/* Telegram Chat List Items */
.telegram-chat-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
    font-size: 0.8rem;
    gap: 0.5rem;
}

.telegram-chat-item:hover {
    background: var(--sidebar-hover);
}

.telegram-chat-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.telegram-chat-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.telegram-chat-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.telegram-chat-preview {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.telegram-unread {
    background: #0088cc;
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    flex-shrink: 0;
}

/* Telegram Preview Panel */
.telegram-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.telegram-preview-overlay.open {
    opacity: 1;
    visibility: visible;
}

.telegram-preview-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 400px;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.telegram-preview-panel.open {
    transform: translateX(0);
}

.telegram-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: #0088cc;
    color: white;
}

.telegram-preview-title {
    font-size: 1rem;
    font-weight: 600;
}

.telegram-preview-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    border-radius: 4px;
    transition: var(--transition);
}

.telegram-preview-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.telegram-preview-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #e8f4f8;
}

.telegram-preview-loading,
.telegram-preview-error,
.telegram-preview-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* Telegram Message Bubbles */
.telegram-message {
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
}

.telegram-message.incoming {
    align-items: flex-start;
}

.telegram-message.outgoing {
    align-items: flex-end;
}

.telegram-message-sender {
    font-size: 0.7rem;
    font-weight: 600;
    color: #0088cc;
    margin-bottom: 0.125rem;
}

.telegram-message-text {
    max-width: 80%;
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.4;
    word-break: break-word;
}

.telegram-message.incoming .telegram-message-text {
    background: white;
    color: var(--text-color);
    border-bottom-left-radius: 4px;
}

.telegram-message.outgoing .telegram-message-text {
    background: #0088cc;
    color: white;
    border-bottom-right-radius: 4px;
}

.telegram-message-time {
    font-size: 0.65rem;
    color: var(--text-light);
    margin-top: 0.125rem;
}

/* Telegram Message Hover Actions */
.telegram-message {
    position: relative;
}

.telegram-message-actions {
    display: none;
    position: absolute;
    top: 0;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.25rem;
    z-index: 10;
}

.telegram-message.incoming .telegram-message-actions {
    right: 0;
}

.telegram-message.outgoing .telegram-message-actions {
    left: 0;
}

.telegram-message:hover .telegram-message-actions {
    display: flex;
    gap: 0.25rem;
}

.telegram-action-btn {
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.telegram-action-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Telegram Reaction Bar */
.telegram-reaction-bar {
    display: none;
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    padding: 0.25rem 0.5rem;
    z-index: 10;
    gap: 0.125rem;
}

.telegram-message:hover .telegram-reaction-bar {
    display: flex;
}

.telegram-reaction-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.15s, background 0.15s;
    line-height: 1;
}

.telegram-reaction-btn:hover {
    transform: scale(1.3);
    background: rgba(0, 0, 0, 0.05);
}

.telegram-reaction-btn.sending {
    opacity: 0.5;
    transform: scale(0.9);
}

.telegram-reaction-btn.sent {
    transform: scale(1.4);
    animation: reaction-pop 0.3s ease-out;
}

.telegram-reaction-btn.error {
    background: rgba(255, 0, 0, 0.1);
}

@keyframes reaction-pop {
    0% { transform: scale(1.4); }
    50% { transform: scale(1.6); }
    100% { transform: scale(1); }
}

/* Sent Reaction Indicator - Telegram Style */
.telegram-sent-reaction {
    position: absolute;
    bottom: -10px;
    left: 8px;
    background: #3390ec;
    border-radius: 14px;
    padding: 4px 8px 4px 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    animation: reaction-appear 0.3s ease-out;
    z-index: 5;
}

.telegram-message.outgoing .telegram-sent-reaction {
    right: 8px;
    left: auto;
    background: #2b5278;
}

.telegram-sent-reaction .reaction-emoji {
    font-size: 1rem;
    line-height: 1;
}

.telegram-sent-reaction .reaction-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #5eaae8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: white;
    overflow: hidden;
}

.telegram-sent-reaction .reaction-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@keyframes reaction-appear {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Telegram Reply Indicator */
.telegram-reply-indicator {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #E3F2FD;
    border-left: 3px solid #0088cc;
    border-radius: 0 4px 4px 0;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.telegram-reply-label {
    color: #0088cc;
    font-weight: 600;
    white-space: nowrap;
}

.telegram-reply-preview {
    color: var(--text-light);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.telegram-reply-cancel {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
    border-radius: 4px;
}

.telegram-reply-cancel:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-color);
}

/* Telegram Reply Quote (displayed on messages that are replies) */
.telegram-reply-quote {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.4rem 0.6rem;
    background: rgba(0, 136, 204, 0.1);
    border-left: 2px solid #0088cc;
    border-radius: 0 4px 4px 0;
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
    cursor: pointer;
}

.telegram-message.outgoing .telegram-reply-quote {
    background: rgba(0, 0, 0, 0.1);
    border-left-color: rgba(255, 255, 255, 0.7);
}

.telegram-reply-quote-sender {
    color: #0088cc;
    font-weight: 600;
}

.telegram-message.outgoing .telegram-reply-quote-sender {
    color: #005580;
}

.telegram-reply-quote-text {
    color: var(--text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.telegram-message.outgoing .telegram-reply-quote-text {
    color: #333;
}

/* Telegram Quick Reply */
.telegram-quick-reply {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: #F8F9FA;
}

.telegram-quick-reply-row {
    display: flex;
    gap: 0.5rem;
}

.telegram-quick-reply input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    outline: none;
    transition: var(--transition);
}

.telegram-quick-reply input:focus {
    border-color: #0088cc;
    box-shadow: 0 0 0 2px rgba(0, 136, 204, 0.2);
}

.telegram-quick-reply-btn {
    padding: 0.625rem 1rem;
    background: #0088cc;
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.telegram-quick-reply-btn:hover {
    background: #006699;
}

.telegram-quick-reply-btn:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
}

/* Telegram Picker Buttons (Emoji, GIF) */
.telegram-picker-btn {
    padding: 0.5rem 0.625rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.telegram-picker-btn:hover {
    background: #F3F4F6;
    border-color: #0088cc;
}

#telegram-gif-btn {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-light);
    padding: 0.5rem 0.5rem;
}

/* Emoji Picker Modal */
.emoji-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.emoji-picker-overlay.open {
    opacity: 1;
    visibility: visible;
}

.emoji-picker-modal {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 280px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.emoji-picker-modal.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

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

.emoji-category-tabs {
    display: flex;
    gap: 0.25rem;
}

.emoji-tab {
    background: none;
    border: none;
    padding: 0.375rem;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}

.emoji-tab:hover {
    background: #F3F4F6;
}

.emoji-tab.active {
    background: #E3F2FD;
}

.emoji-picker-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}

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

.emoji-picker-grid {
    padding: 0.5rem;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    max-height: 200px;
    overflow-y: auto;
}

.emoji-item {
    font-size: 1.4rem;
    padding: 0.25rem;
    cursor: pointer;
    border-radius: 6px;
    text-align: center;
    transition: background 0.15s, transform 0.15s;
}

.emoji-item:hover {
    background: #F3F4F6;
    transform: scale(1.15);
}

/* GIF Picker Modal */
.gif-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.gif-picker-overlay.open {
    opacity: 1;
    visibility: visible;
}

.gif-picker-modal {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 320px;
    max-height: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.gif-picker-modal.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.gif-picker-header {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.gif-search-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.875rem;
    outline: none;
}

.gif-search-input:focus {
    border-color: #0088cc;
}

.gif-picker-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}

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

.gif-picker-grid {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    min-height: 200px;
}

.gif-picker-loading,
.gif-picker-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
    font-size: 0.875rem;
}

.gif-item {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    aspect-ratio: 1;
}

.gif-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.15s ease;
}

.gif-item:hover img {
    transform: scale(1.05);
}

.gif-picker-footer {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--border-color);
    text-align: right;
}

.giphy-attribution {
    font-size: 0.7rem;
    color: var(--text-light);
}

/* Telegram Auth Modal */
.telegram-auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.telegram-auth-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.telegram-auth-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
}

.telegram-auth-modal.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
}

.telegram-auth-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: #0088cc;
    color: white;
    border-radius: 12px 12px 0 0;
}

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

.telegram-auth-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    border-radius: 4px;
    transition: var(--transition);
}

.telegram-auth-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.telegram-auth-modal-body {
    padding: 1.5rem;
}

.telegram-auth-step p {
    margin: 0 0 1rem 0;
    color: var(--text-color);
    font-size: 0.9rem;
}

.telegram-auth-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    margin-bottom: 1rem;
    outline: none;
    transition: var(--transition);
    box-sizing: border-box;
}

.telegram-auth-input:focus {
    border-color: #0088cc;
    box-shadow: 0 0 0 2px rgba(0, 136, 204, 0.2);
}

.telegram-auth-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #0088cc;
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.telegram-auth-btn:hover {
    background: #006699;
}

.telegram-auth-btn:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
}

.telegram-auth-hint {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

.telegram-auth-status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    text-align: center;
}

.telegram-auth-status.error {
    background: #FEE2E2;
    color: #DC2626;
}

.telegram-auth-status.success {
    background: #D1FAE5;
    color: #059669;
}

/* Mobile responsive for Telegram */
@media (max-width: 768px) {
    .telegram-preview-panel {
        width: 100%;
    }

    .sidebar-telegram {
        max-height: 200px;
    }

    .telegram-auth-modal {
        width: 95%;
    }
}

/* ============================================
   Desktop Token Modal
   ============================================ */

.desktop-token-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.desktop-token-modal-overlay.active {
    display: block;
}

.desktop-token-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    width: 90%;
    max-width: 500px;
}

.desktop-token-modal.active {
    display: block;
}

.desktop-token-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.desktop-token-modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    color: #1f2937;
}

.desktop-token-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.desktop-token-modal-close:hover {
    color: #1f2937;
}

.desktop-token-modal-body {
    padding: 1.5rem;
}

.desktop-token-modal-body p {
    margin: 0 0 1rem 0;
    color: #374151;
}

.desktop-token-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#desktop-token-value {
    width: 100%;
    padding: 0.75rem;
    font-family: monospace;
    font-size: 0.75rem;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    resize: none;
    color: #1f2937;
}

.desktop-token-copy-btn {
    align-self: flex-end;
    padding: 0.5rem 1rem;
    background: var(--primary-color, #6366f1);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.desktop-token-copy-btn:hover {
    background: var(--primary-dark, #4f46e5);
}

.desktop-token-copy-btn.copied {
    background: #10b981;
}

.desktop-token-hint {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 1rem !important;
}

/* ============================================
   Settings Button
   ============================================ */

.settings-button {
    padding: 0.5rem 1rem;
    background: var(--primary-color, #6366f1);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.settings-button:hover {
    background: var(--primary-dark, #4f46e5);
}

/* ============================================
   Settings Modal
   ============================================ */

.settings-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.settings-modal-overlay.active {
    display: block;
}

.settings-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    flex-direction: column;
}

.settings-modal.active {
    display: flex;
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.settings-modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    color: #1f2937;
}

.settings-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.settings-modal-close:hover {
    color: #1f2937;
}

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

.settings-section {
    margin-bottom: 1.5rem;
}

.settings-label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.settings-select {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #1f2937;
    cursor: pointer;
}

.settings-select:focus {
    outline: none;
    border-color: var(--primary-color, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.settings-hint {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.settings-save-btn {
    padding: 0.625rem 1.25rem;
    background: var(--primary-color, #6366f1);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.settings-save-btn:hover {
    background: var(--primary-dark, #4f46e5);
}

.settings-save-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.settings-save-btn.saved {
    background: #10b981;
}

/* Connected Accounts */
.connected-accounts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.75rem;
}

.account-group {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.account-group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
}

.account-icon {
    font-size: 1rem;
}

.account-list {
    padding: 0.5rem;
}

.account-loading {
    padding: 0.5rem 0.375rem;
    color: #6b7280;
    font-size: 0.8125rem;
}

.account-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.375rem;
    border-radius: 4px;
}

.account-item:hover {
    background: #f3f4f6;
}

.account-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.account-name {
    font-size: 0.875rem;
    color: #1f2937;
}

.account-detail {
    font-size: 0.75rem;
    color: #6b7280;
}

.account-disconnect-btn {
    padding: 0.25rem 0.5rem;
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s ease;
}

.account-disconnect-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

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

.account-none {
    padding: 0.5rem 0.375rem;
    color: #9ca3af;
    font-size: 0.8125rem;
    font-style: italic;
}

.account-add {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f3f4f6;
}

.account-connect-btn {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: #f0f9ff;
    border: 1px dashed #0ea5e9;
    border-radius: 6px;
    color: #0284c7;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.account-connect-btn:hover {
    background: #e0f2fe;
    border-style: solid;
    border-color: #38bdf8;
}

/* Google Drive Sync */
.drive-sync-area {
    margin-top: 0.75rem;
}

.drive-sync-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #1d4ed8;
    transition: all 0.15s ease;
}

.drive-sync-btn:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.drive-sync-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.drive-sync-btn.syncing {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.drive-sync-icon {
    font-size: 1rem;
}

.drive-sync-status {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: #6b7280;
}

.drive-sync-status.success {
    color: #059669;
}

.drive-sync-status.error {
    color: #dc2626;
}

/* Google Contacts Sync */
.contacts-sync-area {
    margin-top: 0.75rem;
}

.contacts-sync-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #166534;
    transition: all 0.15s ease;
}

.contacts-sync-btn:hover {
    background: #dcfce7;
    border-color: #86efac;
}

.contacts-sync-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.contacts-sync-btn.syncing {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.contacts-sync-icon {
    font-size: 1rem;
}

.contacts-sync-status {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: #6b7280;
}

.contacts-sync-status.success {
    color: #059669;
}

.contacts-sync-status.error {
    color: #dc2626;
}

/* YouTube Sync */
.youtube-sync-area {
    margin-top: 0.75rem;
}

.youtube-sync-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #dc2626;
    transition: all 0.15s ease;
}

.youtube-sync-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.youtube-sync-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.youtube-sync-btn.syncing {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.youtube-sync-icon {
    font-size: 1rem;
}

.youtube-sync-status {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: #6b7280;
}

.youtube-sync-status.success {
    color: #059669;
}

.youtube-sync-status.error {
    color: #dc2626;
}

/* Location History Import */
.location-import-area {
    margin-top: 0.75rem;
}

.location-import-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f3f4f6;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9375rem;
    color: #374151;
    width: 100%;
    justify-content: center;
    transition: all 0.2s;
}

.location-import-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.location-import-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.location-import-icon {
    font-size: 1.25rem;
}

.location-hint {
    text-align: center;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
}

.location-import-status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
}

.location-import-status.loading {
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.location-import-status.success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.location-import-status.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.location-stats {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.location-stat {
    display: flex;
    justify-content: space-between;
    padding: 0.375rem 0;
    font-size: 0.875rem;
}

.location-stat:not(:last-child) {
    border-bottom: 1px solid #e5e7eb;
}

.location-stat-label {
    color: #6b7280;
}

.location-stat-value {
    color: #374151;
    font-weight: 500;
}

/* Push Notifications */
.notification-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    font-size: 0.875rem;
}

.notification-status.enabled {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.notification-status.disabled {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.notification-status.denied {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.notification-status-icon {
    font-size: 1.125rem;
}

.notification-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

.enable-notifications-btn,
.test-notification-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
}

.enable-notifications-btn {
    background: #3b82f6;
    color: white;
}

.enable-notifications-btn:hover {
    background: #2563eb;
}

.enable-notifications-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.test-notification-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.test-notification-btn:hover {
    background: #e5e7eb;
}

.notification-btn-icon {
    font-size: 1rem;
}

.notification-devices {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.devices-header {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.devices-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: white;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    font-size: 0.875rem;
}

.device-info {
    display: flex;
    flex-direction: column;
}

.device-name {
    color: #374151;
    font-weight: 500;
}

.device-date {
    color: #9ca3af;
    font-size: 0.75rem;
}

.device-remove-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    line-height: 1;
    transition: color 0.2s;
}

.device-remove-btn:hover {
    color: #ef4444;
}

.device-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.device-edit,
.device-save,
.device-cancel,
.device-remove {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.875rem;
    line-height: 1;
    transition: opacity 0.2s;
    opacity: 0.6;
}

.device-edit:hover,
.device-save:hover,
.device-cancel:hover,
.device-remove:hover {
    opacity: 1;
}

.device-remove:hover {
    color: #ef4444;
}

.device-save:hover {
    color: #22c55e;
}

.device-name-input {
    flex: 1;
    padding: 0.25rem 0.5rem;
    border: 1px solid #3b82f6;
    border-radius: 4px;
    font-size: 0.875rem;
    outline: none;
    min-width: 0;
    max-width: 200px;
}

.device-name-input:focus {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* ============================================
   Chat Model Bar (per-conversation model selector)
   ============================================ */

.chat-model-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    font-size: 0.875rem;
}

.chat-model-label {
    color: #6b7280;
    font-weight: 500;
}

.chat-model-select {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #374151;
    cursor: pointer;
    min-width: 200px;
}

.chat-model-select:focus {
    outline: none;
    border-color: var(--primary-color, #6366f1);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.chat-model-select:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .chat-model-bar {
        padding: 0.5rem;
    }

    .chat-model-select {
        min-width: 150px;
        flex: 1;
    }
}

/* ============================================
   Daily Digest Settings (Phase 8-07)
   ============================================ */

.digest-settings-form {
    margin-top: 0.75rem;
}

.settings-row {
    margin-bottom: 0.75rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.toggle-checkbox {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: #d1d5db;
    border-radius: 12px;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 2px;
    top: 2px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-checkbox:checked + .toggle-slider {
    background: var(--primary-color, #6366f1);
}

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

.toggle-text {
    font-size: 0.9rem;
    color: #374151;
}

.digest-options {
    padding-left: 1rem;
    border-left: 3px solid #e5e7eb;
    margin-left: 0.5rem;
    margin-top: 0.75rem;
}

.digest-options.hidden {
    display: none;
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

.settings-field label {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 500;
}

.settings-time-input {
    padding: 0.5rem;
    font-size: 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #374151;
    width: 150px;
}

.settings-time-input:focus {
    outline: none;
    border-color: var(--primary-color, #6366f1);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.digest-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.digest-action-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.digest-action-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.digest-send-btn {
    background: var(--primary-color, #6366f1);
    color: white;
    border-color: var(--primary-color, #6366f1);
}

.digest-send-btn:hover {
    background: #4f46e5;
    border-color: #4f46e5;
}

/* ============================================
   Digest Preview Modal
   ============================================ */

.digest-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 1100;
}

.digest-preview-overlay.active {
    opacity: 1;
    visibility: visible;
}

.digest-preview-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 1101;
}

.digest-preview-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.digest-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.digest-preview-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #111827;
}

.digest-preview-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.digest-preview-close:hover {
    color: #374151;
}

.digest-preview-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.digest-loading {
    text-align: center;
    color: #6b7280;
    padding: 2rem;
}

/* Digest Content Styles */
.digest-date {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.digest-summary {
    font-size: 1rem;
    color: #374151;
    background: #f3f4f6;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.digest-section {
    margin-bottom: 1.5rem;
}

.digest-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    color: #111827;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.digest-section-header.priorities {
    border-color: #f59e0b;
}

.digest-section-header.calendar {
    border-color: #3b82f6;
}

.digest-section-header.relationships {
    border-color: #10b981;
}

.digest-section-header.stuck {
    border-color: #ef4444;
}

.digest-section-header.win {
    border-color: #22c55e;
}

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

.digest-list li {
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.digest-list li.overdue {
    background: #fef2f2;
    border-left: 3px solid #ef4444;
}

.digest-item-source {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

.digest-event-time {
    font-weight: 600;
    color: #3b82f6;
    margin-right: 0.5rem;
}

.digest-followup-days {
    font-size: 0.8rem;
    color: #9ca3af;
}

.digest-win-text {
    padding: 0.75rem 1rem;
    background: #f0fdf4;
    border-radius: 8px;
    border-left: 3px solid #22c55e;
    color: #15803d;
}

.digest-empty {
    color: #9ca3af;
    font-style: italic;
    padding: 0.5rem 0;
}

/* Mobile adjustments for digest */
@media (max-width: 640px) {
    .digest-preview-modal {
        width: 95%;
        max-height: 85vh;
    }

    .digest-actions {
        flex-direction: column;
    }

    .digest-action-btn {
        width: 100%;
    }
}

/* ============================================ */
/* Weekly Review Modal (Phase 8-08)            */
/* ============================================ */

.weekly-review-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 1100;
}

.weekly-review-overlay.active {
    opacity: 1;
    visibility: visible;
}

.weekly-review-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 1101;
}

.weekly-review-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.weekly-review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
}

.weekly-review-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.weekly-review-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.weekly-review-close:hover {
    opacity: 1;
}

.weekly-review-body {
    padding: 1.25rem;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.weekly-review-date {
    font-size: 1.1rem;
    font-weight: 600;
    color: #6366f1;
    margin-bottom: 0.75rem;
}

.weekly-stat {
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.weekly-stat.completed {
    background: #ecfdf5;
    border-left: 3px solid #10b981;
}

.digest-section-header.patterns {
    border-color: #8b5cf6;
}

.pattern-item {
    padding: 0.75rem;
    background: #f5f3ff;
    border-left: 3px solid #8b5cf6;
    margin-bottom: 0.5rem;
    border-radius: 0 6px 6px 0;
}

.focus-list {
    padding-left: 1.25rem;
}

.focus-list li {
    margin-bottom: 0.75rem;
}

.focus-reason {
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.relationship-good {
    color: #10b981;
    margin-bottom: 0.5rem;
}

.relationship-stale {
    color: #ef4444;
}

.win-item {
    padding: 0.75rem;
    background: #f0fdf4;
    border-left: 3px solid #22c55e;
    margin-bottom: 0.5rem;
    border-radius: 0 6px 6px 0;
}

/* Mobile adjustments for weekly review */
@media (max-width: 640px) {
    .weekly-review-modal {
        width: 95%;
        max-height: 85vh;
    }
}
