        /* ============================================
           CSS VARIABLES - All colors and values in one place
           ============================================ */
        :root {
            --primary: #8ab4f8;
            --primary-dark: #6fa0f0;
            --primary-gradient: var(--primary);

            --bg-dark: #111111;
            --bg-darker: #111111;
            --bg-overlay: rgba(24, 24, 24, 0.92);
            --bg-panel: #1a1a1a;
            --bg-header: #111111;
            --bg-input: #1d1d1d;

            --text-primary: #eeeeee;
            --text-secondary: rgba(238, 238, 238, 0.72);
            --text-dim: rgba(238, 238, 238, 0.48);
            --text-dimmer: rgba(238, 238, 238, 0.32);

            --border: #333333;
            --border-light: #444444;

            --radius: 8px;
            --radius-lg: 10px;
            --radius-xl: 12px;

            --shadow: none;
            --shadow-lg: none;
        }

        /* ============================================
           BASE STYLES
           ============================================ */
        *,
        *::before,
        *::after {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        html {
            height: 100%;
            overflow: hidden;
        }

        body {
            font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: var(--bg-dark);
            color: var(--text-primary);
            height: 100%;
            min-height: 100vh;
            min-height: -webkit-fill-available;
            overflow: hidden;
            -webkit-text-size-adjust: 100%;
            touch-action: manipulation;
        }

        /* ============================================
           CONTAINER
           ============================================ */
        .container {
            background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
            width: 100%;
            height: 100%;
            min-height: 100vh;
            min-height: -webkit-fill-available;
            display: flex;
            flex-direction: column;
            position: relative;
            overflow-y: auto;
        }

        @media (min-width: 768px) {
            body {
                padding: 20px;
                background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
            }

            .container {
                background: var(--bg-overlay);
                backdrop-filter: blur(20px);
                border: 1px solid var(--border);
                box-shadow: var(--shadow-lg);
                border-radius: 24px;
                width: 95vw;
                height: 95vh;
                max-width: 1600px;
                margin: 0 auto;
                min-height: unset;
            }
        }

        /* ============================================
           HEADER
           ============================================ */
        .header {
            background: var(--bg-header);
            backdrop-filter: blur(10px);
            padding: 16px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;
        }

        .header h1 {
            font-size: 18px;
            font-weight: 600;
            letter-spacing: -0.5px;
        }

        .header-actions {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        @media (min-width: 768px) {
            .header {
                padding: 20px 24px;
            }

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

        /* ============================================
           BUTTONS
           ============================================ */
        .btn {
            background: var(--primary-gradient);
            color: #000;
            border: none;
            padding: 12px 20px;
            border-radius: var(--radius);
            font-size: 14px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s ease;
            box-shadow: 0 4px 16px rgba(138, 180, 248, 0.3);
        }

        .btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 6px 20px rgba(138, 180, 248, 0.4);
        }

        .btn:active {
            transform: translateY(0);
        }

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

        .btn-secondary {
            background: rgba(60, 60, 70, 0.8);
            color: var(--text-primary);
            border: 1px solid var(--border-light);
            box-shadow: none;
        }

        .btn-secondary:hover {
            background: rgba(70, 70, 80, 0.9);
            box-shadow: var(--shadow);
        }

        .btn-small {
            padding: 8px 16px;
            font-size: 13px;
        }

        .btn-icon {
            padding: 10px;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        @media (min-width: 768px) {
            .btn {
                padding: 14px 28px;
                font-size: 15px;
            }

            .btn-small {
                padding: 10px 20px;
                font-size: 14px;
            }
        }

        /* ============================================
           INPUTS
           ============================================ */
        input[type="text"] {
            width: 100%;
            padding: 12px 16px;
            border: 1px solid var(--border-light);
            border-radius: var(--radius);
            font-size: 14px;
            background: var(--bg-input);
            color: var(--text-primary);
            transition: all 0.3s ease;
        }

        input::placeholder {
            color: var(--text-dimmer);
        }

        input:focus {
            outline: none;
            border-color: rgba(138, 180, 248, 0.5);
            background: rgba(40, 40, 50, 0.9);
            box-shadow: 0 0 0 3px rgba(138, 180, 248, 0.1);
        }

        /* ============================================
           LOGIN SECTION
           ============================================ */
        .login-section {
            padding: 40px 20px;
            text-align: center;
            background: var(--bg-panel);
            border-radius: var(--radius-lg);
            margin: 20px;
        }

        .login-section h2 {
            margin-bottom: 10px;
            font-size: 24px;
        }

        .input-group {
            margin-bottom: 20px;
            text-align: left;
        }

        .input-group label {
            display: block;
            margin-bottom: 8px;
            color: var(--text-secondary);
            font-weight: 500;
        }

        .instructions {
            background: rgba(138, 180, 248, 0.1);
            border-left: 4px solid var(--primary);
            padding: 15px;
            margin: 20px 0;
            border-radius: 8px;
            text-align: left;
            color: var(--text-secondary);
        }

        .instructions strong {
            color: var(--primary);
        }

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

        .instructions a:hover {
            text-decoration: underline;
        }

        .instructions ol {
            margin: 10px 0 10px 20px;
        }

        /* ============================================
           DASHBOARD
           ============================================ */
        .dashboard {
            display: none;
            flex: 1;
            overflow: hidden;
            flex-direction: column;
        }

        .dashboard.active {
            display: flex;
        }

        .dashboard-content {
            display: flex;
            flex-direction: column;
            flex: 1;
            overflow: hidden;
            position: relative;
        }

        @media (min-width: 768px) {
            .dashboard-content {
                flex-direction: row;
            }
        }

        /* ============================================
           SIDEBAR
           ============================================ */
        .sidebar {
            width: 100%;
            display: flex;
            flex-direction: column;
            background: var(--bg-panel);
            backdrop-filter: blur(10px);
            height: 100%;
            position: absolute;
            inset: 0;
            z-index: 2;
            transition: transform 0.3s ease;
        }

        .sidebar.hidden-mobile {
            transform: translateX(-100%);
        }

        @media (min-width: 768px) {
            .sidebar {
                width: 380px;
                min-width: 380px;
                border-right: 1px solid var(--border);
                position: relative;
                transform: none !important;
            }
        }

        .sidebar-header {
            padding: 24px;
            border-bottom: 1px solid var(--border);
            position: relative;
            flex-shrink: 0;
            /* Keep this property */
        }

        .sidebar-header-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }

        .sidebar-header h2 {
            font-size: 18px;
            margin: 0;
            font-weight: 600;
        }

        .new-chat-btn {
            background: var(--primary);
            color: white;
            border: none;
            width: 32px;
            height: 32px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            transition: transform 0.2s, background 0.2s;
            box-shadow: 0 2px 8px rgba(138, 180, 248, 0.3);
        }

        .new-chat-btn:hover {
            background: #e69d01;
            transform: scale(1.1);
        }

        @media (min-width: 768px) {
            .sidebar-header {
                padding: 24px 24px 20px;
            }

            .sidebar-header h2 {
                font-size: 20px;
                margin-bottom: 16px;
            }
        }

        .conversations-list {
            flex: 1;
            overflow-y: auto;
        }

        .conversations-list::-webkit-scrollbar {
            width: 6px;
        }

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

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

        .conversation-item {
            padding: 16px 20px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.04);
            cursor: pointer;
            transition: background 0.2s ease;
            position: relative;
        }

        .conversation-item::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 3px;
            background: var(--primary);
            transform: scaleY(0);
            transition: transform 0.2s ease;
        }

        .conversation-item:hover {
            background: rgba(40, 40, 50, 0.4);
        }

        .conversation-item.active {
            background: rgba(138, 180, 248, 0.08);
        }

        .conversation-item.active::before {
            transform: scaleY(1);
        }

        .conversation-item .contact-name {
            font-weight: 600;
            margin-bottom: 6px;
            font-size: 14px;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .conversation-item .last-message {
            font-size: 13px;
            color: var(--text-dim);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .conversation-item .timestamp {
            font-size: 11px;
            color: var(--text-dimmer);
            margin-top: 4px;
        }

        .unread-badge {
            background: var(--primary);
            color: #000;
            font-size: 11px;
            font-weight: 700;
            padding: 4px 10px;
            border-radius: 12px;
            min-width: 24px;
            text-align: center;
        }

        @media (min-width: 768px) {
            .conversation-item {
                padding: 20px 24px;
            }

            .conversation-item .contact-name {
                font-size: 15px;
                margin-bottom: 8px;
            }

            .conversation-item .last-message {
                font-size: 14px;
            }

            .conversation-item .timestamp {
                font-size: 12px;
                margin-top: 6px;
            }
        }

        /* ============================================
           CHAT AREA
           ============================================ */
        .chat-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: rgba(20, 20, 30, 0.3);
            position: absolute;
            inset: 0;
            z-index: 3;
            transform: translateX(100%);
            transition: transform 0.3s ease;
        }

        .chat-area.visible-mobile {
            transform: translateX(0);
        }

        @media (min-width: 768px) {
            .chat-area {
                position: relative;
                transform: none !important;
            }
        }

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

        .back-button {
            background: rgba(60, 60, 70, 0.8);
            border: 1px solid var(--border-light);
            color: var(--text-primary);
            padding: 8px 12px;
            border-radius: 8px;
            font-size: 14px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
            transition: background 0.2s;
        }

        .back-button:hover {
            background: rgba(70, 70, 80, 0.9);
        }

        @media (min-width: 768px) {
            .back-button {
                display: none;
            }

            .chat-header {
                padding: 24px 32px;
            }
        }

        .contact-info h3 {
            font-size: 16px;
            margin-bottom: 4px;
            font-weight: 600;
            letter-spacing: -0.3px;
        }

        .npub {
            font-size: 11px;
            color: var(--text-dimmer);
            font-family: ui-monospace, 'SF Mono', Monaco, monospace;
        }

        @media (min-width: 768px) {
            .contact-info h3 {
                font-size: 18px;
                margin-bottom: 6px;
            }

            .npub {
                font-size: 13px;
            }
        }

        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 20px 16px;
            background: rgba(18, 18, 28, 0.4);
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .chat-messages::-webkit-scrollbar {
            width: 8px;
        }

        .chat-messages::-webkit-scrollbar-track {
            background: transparent;
        }

        .chat-messages::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.15);
            border-radius: 4px;
        }

        @media (min-width: 768px) {
            .chat-messages {
                padding: 32px;
                gap: 16px;
            }
        }

        .message {
            padding: 14px 16px;
            border-radius: var(--radius-lg);
            max-width: 85%;
            word-wrap: break-word;
            animation: slideIn 0.3s ease;
        }

        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateY(10px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .message.sent {
            background: rgba(60, 60, 70, 0.7);
            backdrop-filter: blur(10px);
            border: 1px solid var(--border-light);
            margin-left: auto;
            align-self: flex-end;
        }

        .message.received {
            background: var(--primary-gradient);
            color: #000;
            box-shadow: 0 4px 20px rgba(138, 180, 248, 0.25);
            font-weight: 500;
            align-self: flex-start;
        }

        .message .content {
            font-size: 15px;
            line-height: 1.5;
        }

        .message .time {
            font-size: 11px;
            opacity: 0.5;
            margin-top: 8px;
            font-weight: 500;
        }

        .message.received .time {
            opacity: 0.6;
        }

        @media (min-width: 768px) {
            .message {
                padding: 16px 20px;
                border-radius: 18px;
                max-width: 65%;
            }
        }

        .chat-input-area {
            padding: 16px 20px;
            background: var(--bg-header);
            backdrop-filter: blur(10px);
            border-top: 1px solid var(--border);
            display: flex;
            gap: 10px;
            align-items: center;
            flex-shrink: 0;
        }

        .chat-input-area input {
            font-size: 16px;
            /* Prevents zoom on iOS */
        }

        @media (min-width: 768px) {
            .chat-input-area {
                padding: 24px 32px;
                gap: 12px;
            }

            .chat-input-area input {
                padding: 16px 20px;
                border-radius: 14px;
            }
        }

        /* ============================================
           UTILITY CLASSES
           ============================================ */
        .hidden {
            display: none !important;
        }

        .empty-state {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            color: rgba(255, 255, 255, 0.35);
            gap: 16px;
        }

        .empty-state h3 {
            color: rgba(255, 255, 255, 0.5);
            font-size: 20px;
            font-weight: 600;
        }

        .empty-state-icon {
            font-size: 64px;
            opacity: 0.3;
        }

        .spinner {
            border: 3px solid rgba(255, 255, 255, 0.1);
            border-top: 3px solid var(--primary);
            border-radius: 50%;
            width: 20px;
            height: 20px;
            animation: spin 1s linear infinite;
            display: inline-block;
            margin-right: 10px;
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }

        .loading-overlay {
            position: absolute;
            inset: 0;
            background: rgba(25, 25, 35, 0.95);
            backdrop-filter: blur(10px);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 16px;
            font-size: 15px;
            color: rgba(255, 255, 255, 0.6);
        }

        .status {
            padding: 10px 20px;
            font-size: 13px;
            text-align: center;
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        }

        .status.success {
            background: #d4edda;
            color: #155724;
        }

        .status.error {
            background: #f8d7da;
            color: #721c24;
        }

        .cache-info {
            font-size: 11px;
            color: var(--text-dimmer);
            margin-top: 8px;
            text-align: center;
        }

        .notification-badge {
            background: #ff3b30;
            color: white;
            font-size: 11px;
            font-weight: 700;
            padding: 2px 6px;
            border-radius: 10px;
            min-width: 18px;
            text-align: center;
            position: absolute;
            top: -4px;
            right: -4px;
        }

        /* ============================================
           MODAL
           ============================================ */
        .modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.8);
            backdrop-filter: blur(10px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
            padding: 20px;
        }

        .modal {
            background: rgba(30, 30, 40, 0.95);
            border: 1px solid var(--border);
            border-radius: var(--radius-xl);
            padding: 32px;
            max-width: 500px;
            width: 100%;
            box-shadow: var(--shadow-lg);
        }

        #settingsModal .modal-content {
            max-width: 500px;
            max-height: 85vh;
            /* Limit height */
            display: flex;
            flex-direction: column;
        }

        #settingsModal .modal-body {
            padding: 2px;
            overflow-y: auto;
            /* Enable scroll */
            flex: 1;
        }

        .modal h3 {
            color: var(--primary);
            margin-bottom: 16px;
            font-size: 22px;
        }

        .modal p {
            color: var(--text-secondary);
            margin-bottom: 12px;
            line-height: 1.6;
        }

        .modal .btn-group {
            display: flex;
            gap: 12px;
            margin-top: 24px;
        }

        .modal .btn-group .btn {
            flex: 1;
        }

        /* PWA Install Banner */
        .pwa-install-banner {
            background: linear-gradient(135deg, rgba(138, 180, 248, 0.15) 0%, rgba(138, 180, 248, 0.15) 100%);
            border: 1px solid rgba(138, 180, 248, 0.3);
            border-radius: var(--radius-lg);
            padding: 24px;
            margin: 0 0 24px 0;
            text-align: left;
            animation: fadeIn 0.5s ease;
        }

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

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .pwa-install-banner h3 {
            color: var(--primary);
            margin-bottom: 12px;
            font-size: 18px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .pwa-install-banner p {
            color: var(--text-secondary);
            margin-bottom: 12px;
            font-size: 14px;
            line-height: 1.6;
        }

        .pwa-install-banner ol {
            margin: 12px 0 12px 24px;
            color: var(--text-secondary);
        }

        .pwa-install-banner li {
            margin: 8px 0;
            font-size: 14px;
        }

/* ============================================
   BTCforPlebs flat skin (matches /css/site.css dark mode)
   ============================================ */
h1, h2, h3, .login-section h2 { font-family: inherit; font-weight: 700; letter-spacing: 0; }
.btn, button { font-family: inherit; }
.btn { color: #111111; font-weight: 600; border-radius: 4px; box-shadow: none; }
.btn:hover { box-shadow: none; filter: none; text-decoration: underline; }
* { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; box-shadow: none !important; background-image: none !important; }
::selection { background: var(--primary); color: #111111; }
