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

        :root {
            --bg-primary: #000000;
            --bg-secondary: #0a0a0a;
            --bg-tertiary: #141414;
            --text-primary: #ffffff;
            --text-secondary: #a0a0a0;
            --text-tertiary: #666666;
            --border: #1f1f1f;
            --accent: #ffffff;
            --accent-hover: #e0e0e0;
        }

        [data-theme="light"] {
            --bg-primary: #ffffff;
            --bg-secondary: #f5f5f5;
            --bg-tertiary: #eeeeee;
            --text-primary: #000000;
            --text-secondary: #666666;
            --text-tertiary: #999999;
            --border: #e0e0e0;
            --accent: #000000;
            --accent-hover: #333333;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
            background: var(--bg-primary);
            color: var(--text-primary);
            height: 100vh;
            height: 100dvh;
            overflow: hidden;
            -webkit-font-smoothing: antialiased;
        }

        /* Login Screen */
        .login-screen {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            height: 100dvh;
            background: var(--bg-primary);
            z-index: 10000;
            align-items: center;
            justify-content: center;
        }

        .login-screen.active {
            display: flex;
        }

        .login-box {
            text-align: center;
            padding: 32px;
        }

        .login-box h1 {
            font-size: 32px;
            margin-bottom: 8px;
            font-weight: 300;
        }

        .login-box p {
            color: var(--text-secondary);
            margin-bottom: 32px;
            font-size: 14px;
        }

        .login-box input {
            width: 280px;
            padding: 14px 16px;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 8px;
            color: var(--text-primary);
            font-size: 16px;
            text-align: center;
            outline: none;
            margin-bottom: 16px;
        }

        .login-box button {
            width: 280px;
            padding: 14px;
            background: var(--accent);
            color: var(--bg-primary);
            border: none;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
        }

        .login-box button:hover {
            background: var(--accent-hover);
        }

        /* Main Container */
        .container {
            display: flex;
            height: 100vh;
            height: 100dvh;
        }

        /* Sidebar */
        .sidebar {
            width: 260px;
            background: var(--bg-secondary);
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            transition: transform 0.3s ease;
        }

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

        .sidebar-title {
            font-size: 14px;
            font-weight: 500;
            color: var(--text-secondary);
        }

        .sidebar-close {
            display: none;
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 4px;
        }

        .sidebar-menu {
            padding: 8px;
        }

        .menu-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 12px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            color: var(--text-secondary);
            transition: all 0.2s;
            border: none;
            background: none;
            width: 100%;
            text-align: left;
        }

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

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

        .menu-item svg {
            width: 18px;
            height: 18px;
            stroke-width: 1.5;
        }

        .sidebar-content {
            flex: 1;
            overflow-y: auto;
            padding: 8px;
        }

        .conversation-item, .template-item {
            padding: 10px 12px;
            margin-bottom: 4px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 8px;
            font-size: 13px;
            color: var(--text-secondary);
        }

        .conversation-item:hover, .template-item:hover {
            background: var(--bg-tertiary);
            color: var(--text-primary);
        }

        .conversation-item.active, .template-item.active {
            background: var(--bg-tertiary);
            color: var(--text-primary);
        }

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

        .item-actions {
            display: flex;
            gap: 4px;
            opacity: 0;
            transition: opacity 0.2s;
        }

        .conversation-item:hover .item-actions,
        .template-item:hover .item-actions {
            opacity: 1;
        }

        .icon-btn {
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 4px;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .icon-btn:hover {
            background: rgba(255, 255, 255, 0.1);
            color: var(--text-primary);
        }

        .icon-btn svg {
            width: 14px;
            height: 14px;
        }

        .empty-state {
            text-align: center;
            color: var(--text-tertiary);
            padding: 24px 16px;
            font-size: 13px;
        }

        /* Chat Area */
        .chat-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            position: relative;
            overflow: hidden;
        }
        
        .main-content {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
            display: flex;
            flex-direction: column;
        }
        
        #messagesContainer {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
            padding: 20px;
            padding-bottom: 0;
        }

        .chat-header {
            padding: 16px 20px;
            border-bottom: 1px solid var(--border);
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: var(--bg-secondary);
        }

        .chat-title {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .menu-toggle {
            display: none;
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 4px;
        }

        .chat-title h1 {
            font-size: 16px;
            font-weight: 400;
        }

        .messages {
            flex: 1;
            overflow-y: auto;
            padding: 24px 20px;
            padding-bottom: 80px;
        }

        .welcome-message {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            color: var(--text-tertiary);
            text-align: center;
        }

        .welcome-message svg {
            margin-bottom: 16px;
            opacity: 0.3;
        }

        .welcome-message h2 {
            font-size: 20px;
            margin-bottom: 8px;
            color: var(--text-secondary);
            font-weight: 300;
        }

        .message {
            display: flex;
            margin-bottom: 20px;
            animation: fadeIn 0.3s;
        }

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

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

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

        .message.user .message-content {
            background: var(--accent);
            color: var(--bg-primary);
        }

        .message.assistant .message-content {
            background: var(--bg-tertiary);
            color: var(--text-primary);
        }

        .loading {
            display: flex;
            gap: 6px;
            padding: 12px 16px;
        }

        .loading-dot {
            width: 6px;
            height: 6px;
            background: var(--text-tertiary);
            border-radius: 50%;
            animation: bounce 1.4s infinite ease-in-out both;
        }

        .loading-dot:nth-child(1) { animation-delay: -0.32s; }
        .loading-dot:nth-child(2) { animation-delay: -0.16s; }

        @keyframes bounce {
            0%, 80%, 100% { transform: scale(0); }
            40% { transform: scale(1); }
        }

        /* Input Area */
        .input-area {
            position: fixed;
            bottom: 0;
            left: 260px;
            right: 0;
            padding: 16px 20px;
            padding-bottom: max(16px, env(safe-area-inset-bottom));
            border-top: 1px solid var(--border);
            background: var(--bg-secondary);
            display: flex;
            gap: 12px;
        }

        #messageInput {
            flex: 1;
            padding: 12px 16px;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 8px;
            color: var(--text-primary);
            font-size: 14px;
            font-family: inherit;
            outline: none;
            resize: none;
            max-height: 120px;
        }

        #messageInput::placeholder {
            color: var(--text-tertiary);
        }

        .btn-send {
            padding: 12px 16px;
            background: var(--accent);
            color: var(--bg-primary);
            border: none;
            border-radius: 8px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .btn-send:disabled {
            opacity: 0.3;
            cursor: not-allowed;
        }

        .btn-send svg {
            width: 18px;
            height: 18px;
        }

        /* Modal */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            z-index: 1000;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .modal.active {
            display: flex;
        }

        .modal-content {
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 12px;
            width: 100%;
            max-width: 500px;
            max-height: 90vh;
            overflow-y: auto;
            animation: slideUp 0.3s;
        }

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

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

        .modal-header h3 {
            font-size: 16px;
            font-weight: 400;
        }

        .modal-close {
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 24px;
            line-height: 1;
            padding: 0;
        }

        .modal-body {
            padding: 20px;
        }

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

        .form-group:last-child {
            margin-bottom: 0;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-size: 13px;
            color: var(--text-secondary);
        }

        .form-group input,
        .form-group textarea {
            width: 100%;
            padding: 10px 12px;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 6px;
            color: var(--text-primary);
            font-size: 14px;
            font-family: inherit;
            outline: none;
        }

        .form-group textarea {
            resize: vertical;
            min-height: 100px;
        }

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

        .btn {
            padding: 10px 20px;
            border: none;
            border-radius: 6px;
            font-size: 14px;
            cursor: pointer;
            transition: all 0.2s;
        }

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

        .btn-primary:hover {
            background: var(--accent-hover);
        }

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

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

        /* Search */
        .search-box {
            padding: 8px;
            border-bottom: 1px solid var(--border);
        }

        .search-box input {
            width: 100%;
            padding: 8px 12px;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 6px;
            color: var(--text-primary);
            font-size: 13px;
            outline: none;
        }

        /* Mobile */
        @media (max-width: 768px) {
            .sidebar {
                position: fixed;
                left: -260px;
                top: 0;
                height: 100%;
                z-index: 100;
            }

            .sidebar.active {
                left: 0;
            }

            .sidebar-close {
                display: block;
            }

            .menu-toggle {
                display: block;
            }

            .input-area {
                left: 0;
            }

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

            .chat-header {
                padding: 12px 16px;
            }

            .messages {
                padding: 16px;
                padding-bottom: 80px;
            }
        }

        /* Scrollbar */
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }

        ::-webkit-scrollbar-track {
            background: transparent;
        }

        ::-webkit-scrollbar-thumb {
            background: var(--border);
            border-radius: 3px;
        }

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


/* Data Pages (Passwords, Domains, Notes) */
.data-page {
    padding: 20px;
    height: 100%;
    overflow-y: auto;
}

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

.data-header h2 {
    font-size: 24px;
    font-weight: 600;
}

.btn-add {
    padding: 10px 20px;
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add:hover {
    background: var(--accent-hover);
}

.data-grid {
    display: grid;
    gap: 15px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.data-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
}

.data-card:hover {
    border-color: var(--accent);
}

.data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.data-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}

.data-card-actions {
    display: flex;
    gap: 8px;
}

.data-card-actions .icon-btn {
    padding: 6px;
    opacity: 0.6;
}

.data-card-actions .icon-btn:hover {
    opacity: 1;
}

.data-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.data-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.data-field-label {
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-field-value {
    font-size: 14px;
    color: var(--text-secondary);
    word-break: break-all;
}

.data-field-value.password {
    font-family: monospace;
    filter: blur(4px);
    transition: filter 0.2s;
    cursor: pointer;
}

.data-field-value.password:hover {
    filter: blur(0);
}

.data-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.data-empty svg {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

/* Modal Improvements */
.modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .data-grid {
        grid-template-columns: 1fr;
    }
}

/* AI Action Button */
.ai-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
    margin-top: 10px;
}

.ai-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent);
}

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

/* Commands Page */
.commands-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

.command-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.command-card h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    color: var(--text-primary);
}

.command-examples {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.command-examples code {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    display: block;
    font-family: 'Courier New', monospace;
}

.command-card ul {
    margin: 0;
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.command-card ul li {
    margin-bottom: 8px;
}

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

/* Files Page */
.files-grid {
    padding: 20px;
}

.file-category {
    margin-bottom: 30px;
}

.file-category h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s;
}

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

.file-info {
    flex: 1;
}

.file-name {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.file-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.file-actions {
    display: flex;
    gap: 8px;
}

/* News Page */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 20px;
}

.news-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s;
}

.news-card:hover {
    background: var(--bg-secondary);
    border-color: var(--text-tertiary);
}

.news-source {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.news-title {
    font-size: 16px;
    margin: 0 0 12px 0;
    line-height: 1.4;
}

.news-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.news-title a:hover {
    color: var(--accent);
}

.news-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 12px 0;
}

.news-date {
    font-size: 11px;
    color: var(--text-tertiary);
}

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


/* Modal Buttons */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.btn-primary, .btn-secondary {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
}

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

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


/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

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

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-10px);
    }
}
