        /* Global CSS Variables */
        :root {
            --accent-color: #005fee; /* Royal Blue + Dodger Blue accent */
            --bg-light-gray: #f0f2f5;
            --text-dark: #333333;
            --text-medium: #777777;
            --text-light: #999999;
            --border-color-light: #e0e0e0;
            --border-color-lighter: #f0f0f0;
            --input-bg: #f5f5f5;
            --active-bg: #f5f5f5;
            --shadow-light: rgba(0, 0, 0, 0.08); /* Slightly lighter shadow */
            --shadow-heavy: rgba(0, 0, 0, 0.2); /* Slightly lighter shadow for modals */
            --destructive-red: #ff3b30;
        }

        .chat-app-container {
            width: 100%;
            height: 100%;
            background-color: #ffffff;
            border-radius: 0;
            box-shadow: none;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            position: fixed;
            top: 0;
            left: 0;
            z-index: 100;
    overflow: auto;
        }

        @media (max-width: 640px) {
            .chat-app-container {
                border-radius: 0;
                box-shadow: none;
            }
        }

        /* Header */
        .header {
            padding: 10px 0; /* Further reduced padding */
            background-color: #ffffff;
            border-bottom: 1px solid var(--border-color-light);
            position: relative;
            z-index: 10;
        }

        .header-title {
            font-size: 1.4rem; /* Slightly reduced font size */
            font-weight: 700;
            color: var(--text-dark);
            margin-bottom: 10px; /* Reduced margin-bottom */
            text-align: center;
        }

        /* Search Input */
        .search-input {
            width: calc(100% - 30px); /* Adjust width for new padding */
            padding: 8px 12px; /* Further reduced padding */
            border-radius: 9999px; /* Slightly smaller border-radius */
            border: none;
            background-color: var(--input-bg);
            font-size: 0.9rem; /* Reduced font size */
            outline: none;
            transition: all 0.2s ease-in-out;
            margin: 0 15px; /* Adjusted horizontal margin */
            box-sizing: border-box;
            height: 3em;
        }

        .search-input:focus {
            background-color: #ebebeb;
            box-shadow: 0 0 0 2px var(--accent-color);
        }

        /* Chat List */
        .chat-list {
            flex-grow: 1;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            padding: 0;
            margin: 0;
            list-style: none;
            padding-bottom: 5px; /* Reduced padding at the bottom */
        }

        .chat-item {
            display: flex;
            align-items: center;
            padding: 8px 15px; /* Further reduced vertical padding */
            border-bottom: 1px solid var(--border-color-lighter);
            cursor: pointer;
            transition: background-color 0.15s ease-in-out;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
        }

        .chat-item:last-child {
            border-bottom: none;
        }

        .chat-item:active {
            background-color: var(--active-bg);
        }

        .chat-item-avatar {
            width: 48px; /* Reduced avatar size */
            height: 48px; /* Reduced avatar size */
            border-radius: 50%;
            object-fit: cover;
            margin-right: 10px; /* Reduced margin-right */
            box-shadow: 0 1px 6px var(--shadow-light); /* Lighter shadow */
            border: 2px solid #ffffff;
            flex-shrink: 0;
        }

        .chat-item-content {
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            min-width: 0;
        }

        .chat-item-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: -2px; /* Pull header closer to message */
        }

        .chat-item-name {
            font-weight: 600;
            font-size: 1rem; /* Adjusted font size */
            color: var(--text-dark);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            flex-grow: 1;
        }

        .chat-item-time {
            font-size: 0.68rem; /* Adjusted font size */
            color: var(--text-light);
            white-space: nowrap;
            margin-left: 7px; /* Adjusted margin-left */
        }

        .chat-item-message {
            font-size: 0.8rem; /* Adjusted font size */
            color: var(--text-medium);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        /* Long Press Action Menu */
        .long-press-menu-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background-color: rgba(0, 0, 0, 0.3);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 100;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
        }

        .long-press-menu-overlay.active {
            opacity: 1;
            visibility: visible;
        }

        .long-press-menu {
            background-color: #ffffff;
            border-radius: 9px; /* Slightly smaller border-radius */
            box-shadow: 0 6px 20px var(--shadow-heavy); /* Adjusted shadow */
            padding: 6px 0; /* Reduced padding */
            transform: scale(0.95);
            opacity: 0;
            transition: transform 0.2s ease-out, opacity 0.2s ease-out;
            min-width: 170px; /* Reduced min-width */
        }

        .long-press-menu-overlay.active .long-press-menu {
            transform: scale(1);
            opacity: 1;
        }

        .long-press-menu-item {
            padding: 9px 16px; /* Reduced padding */
            font-size: 0.9rem; /* Reduced font size */
            color: var(--text-dark);
            cursor: pointer;
            transition: background-color 0.15s ease-in-out;
            text-align: center;
        }

        .long-press-menu-item:hover {
            background-color: var(--active-bg);
        }

        .long-press-menu-item:first-child {
            border-top-left-radius: 9px;
            border-top-right-radius: 9px;
        }

        .long-press-menu-item:last-child {
            border-bottom-left-radius: 9px;
            border-bottom-right-radius: 9px;
        }

        .long-press-menu-item.destructive {
            color: var(--destructive-red);
        }

        /* Custom Modal for alerts */
        .custom-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background-color: rgba(0, 0, 0, 0.4);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 200;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
        }

        .custom-modal-overlay.active {
            opacity: 1;
            visibility: visible;
            z-index: 1000;
        }

        .custom-modal {
            background-color: #ffffff;
            border-radius: 9px; /* Slightly reduced border-radius */
            box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18); /* Adjusted shadow */
            padding: 15px; /* Reduced padding */
            text-align: center;
            max-width: 260px; /* Reduced max-width */
            transform: scale(0.9);
            opacity: 0;
            transition: transform 0.2s ease-out, opacity 0.2s ease-out;
        }

        .custom-modal-overlay.active .custom-modal {
            transform: scale(1);
            opacity: 1;
        }

        .custom-modal-message {
            font-size: 0.95rem; /* Reduced font size */
            color: var(--text-dark);
            margin-bottom: 12px; /* Reduced margin-bottom */
        }

        .custom-modal-button {
            background-color: var(--accent-color);
            color: #ffffff;
            padding: 7px 16px; /* Reduced padding */
            border-radius: 6px; /* Slightly reduced border-radius */
            font-size: 0.9rem; /* Reduced font size */
            cursor: pointer;
            border: none;
            transition: background-color 0.15s ease-in-out;
        }

        .custom-modal-button:hover {
            background-color: #004ecc;
        }


        /* Scrollbar styling for better aesthetics (Webkit browsers) */
        .chat-list::-webkit-scrollbar {
            width: 6px;
        }

        .chat-list::-webkit-scrollbar-track {
            background: transparent;
        }

        .chat-list::-webkit-scrollbar-thumb {
            background-color: rgba(0, 0, 0, 0.1);
            border-radius: 10px;
        }

        .chat-list::-webkit-scrollbar-thumb:hover {
            background-color: rgba(0, 0, 0, 0.2);
        }

