        :root {
            --bg: #0a0a0a;
            --surface: #141414;
            --surface2: #1e1e1e;
            --surface3: #252525;
            --border: #2a2a2a;
            --border-light: #333;
            --text: #e5e5e5;
            --text2: #888;
            --text3: #555;
            --accent: #3b82f6;
            --accent-hover: #2563eb;
            --green: #22c55e;
            --red: #ef4444;
            --yellow: #eab308;
        }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
            background: var(--bg);
            color: var(--text);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }

        /* --- Header --- */
        .header {
            display: flex;
            align-items: center;
            gap: 16px;
            padding: 12px 24px;
            border-bottom: 1px solid var(--border);
            background: var(--surface);
            position: sticky;
            top: 0;
            z-index: 100;
        }
        .header .logo { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
        .header .logo span { color: var(--accent); }
        .header .nav {
            display: flex;
            gap: 4px;
            margin-left: 24px;
        }
        .header .nav button {
            padding: 6px 14px;
            border-radius: 6px;
            border: none;
            background: transparent;
            color: var(--text2);
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.15s;
        }
        .header .nav button:hover { background: var(--surface2); color: var(--text); }
        .header .nav button.active { background: var(--accent); color: #fff; }
        .header .spacer { flex: 1; }
        .header .stats-bar {
            display: flex;
            gap: 16px;
            font-size: 12px;
            color: var(--text2);
        }
        .header .stats-bar .stat-val { color: var(--text); font-weight: 600; }

        /* --- Main layout --- */
        .main { flex: 1; display: flex; flex-direction: column; }

        /* --- Upload area --- */
        .upload-bar {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 24px;
            background: var(--surface);
            border-bottom: 1px solid var(--border);
        }
        .upload-btn {
            padding: 8px 20px;
            border-radius: 8px;
            border: none;
            background: var(--accent);
            color: #fff;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: background 0.15s;
        }
        .upload-btn:hover { background: var(--accent-hover); }
        .upload-bar .view-toggle {
            display: flex;
            gap: 2px;
            margin-left: auto;
        }
        .upload-bar .view-toggle button {
            padding: 6px 10px;
            border: 1px solid var(--border);
            background: var(--surface2);
            color: var(--text2);
            font-size: 12px;
            cursor: pointer;
            transition: all 0.15s;
        }
        .upload-bar .view-toggle button:first-child { border-radius: 6px 0 0 6px; }
        .upload-bar .view-toggle button:last-child { border-radius: 0 6px 6px 0; }
        .upload-bar .view-toggle button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
        .filter-btns {
            display: flex;
            gap: 4px;
        }
        .filter-btns button {
            padding: 5px 12px;
            border-radius: 20px;
            border: 1px solid var(--border);
            background: transparent;
            color: var(--text2);
            font-size: 12px;
            cursor: pointer;
            transition: all 0.15s;
        }
        .filter-btns button:hover { border-color: var(--text2); }
        .filter-btns button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

        /* --- Search bar --- */
        .search-wrap {
            flex: 1;
            max-width: 320px;
            position: relative;
        }
        .search-wrap .search-icon {
            position: absolute;
            left: 10px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text3);
            font-size: 14px;
            pointer-events: none;
        }
        .search-input {
            width: 100%;
            padding: 7px 10px 7px 32px;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: var(--surface2);
            color: var(--text);
            font-size: 13px;
            outline: none;
            transition: border-color 0.15s;
        }
        .search-input:focus { border-color: var(--accent); }
        .search-input::placeholder { color: var(--text3); }

        /* --- Bulk action bar --- */
        .bulk-bar {
            position: fixed;
            bottom: 24px;
            left: 50%;
            transform: translateX(-50%) translateY(80px);
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 10px 16px;
            background: var(--surface);
            border: 1px solid var(--border-light);
            border-radius: 12px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.6);
            z-index: 150;
            opacity: 0;
            transition: transform 0.2s, opacity 0.2s;
            white-space: nowrap;
        }
        .bulk-bar.show {
            transform: translateX(-50%) translateY(0);
            opacity: 1;
        }
        .bulk-bar .count {
            font-size: 13px;
            font-weight: 600;
            color: var(--text);
            padding-right: 8px;
            border-right: 1px solid var(--border);
        }
        .bulk-bar .bulk-btn {
            padding: 6px 14px;
            border-radius: 7px;
            border: 1px solid var(--border);
            background: var(--surface2);
            color: var(--text);
            font-size: 12px;
            font-weight: 500;
            cursor: pointer;
            transition: background 0.15s;
        }
        .bulk-bar .bulk-btn:hover { background: var(--border); }
        .bulk-bar .bulk-btn.danger { border-color: var(--red); color: var(--red); }
        .bulk-bar .bulk-btn.danger:hover { background: rgba(239,68,68,0.15); }
        .bulk-bar .bulk-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
        .bulk-bar .bulk-btn.primary:hover { background: var(--accent-hover); }

        input[type="file"] { display: none; }

        /* --- Drop overlay --- */
        .drop-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(59, 130, 246, 0.15);
            border: 3px dashed var(--accent);
            z-index: 200;
            align-items: center;
            justify-content: center;
        }
        .drop-overlay.show { display: flex; }
        .drop-overlay .drop-text {
            font-size: 24px;
            font-weight: 700;
            color: var(--accent);
            background: var(--surface);
            padding: 24px 48px;
            border-radius: 16px;
        }

        /* --- Photo grid --- */
        .photo-container { flex: 1; padding: 16px 24px; overflow-y: auto; }

        .timeline-group { margin-bottom: 24px; }
        .timeline-date {
            font-size: 13px;
            font-weight: 600;
            color: var(--text2);
            margin-bottom: 8px;
            padding-left: 4px;
            position: sticky;
            top: 0;
            background: var(--bg);
            padding: 4px 4px;
            z-index: 10;
        }

        .photo-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
            gap: 4px;
        }
        .photo-grid.large {
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        }
        .photo-grid.small {
            grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        }

        .photo-item {
            aspect-ratio: 1;
            border-radius: 4px;
            overflow: hidden;
            cursor: pointer;
            position: relative;
            background: var(--surface2);
            transition: transform 0.15s;
        }
        .photo-item:hover { transform: scale(1.02); z-index: 2; }
        .photo-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }
        .photo-item .file-icon {
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 8px;
            color: var(--text2);
        }
        .photo-item .file-icon .ext {
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            background: var(--surface3);
            padding: 2px 8px;
            border-radius: 4px;
        }
        .photo-item .badge {
            position: absolute;
            bottom: 4px;
            right: 4px;
            font-size: 10px;
            padding: 2px 6px;
            border-radius: 4px;
            background: rgba(0,0,0,0.7);
            color: #fff;
            font-weight: 600;
        }
        .photo-item .check {
            position: absolute;
            top: 6px;
            left: 6px;
            width: 22px;
            height: 22px;
            border-radius: 50%;
            border: 2px solid rgba(255,255,255,0.5);
            background: transparent;
            display: none;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            color: #fff;
            cursor: pointer;
        }
        .photo-item:hover .check { display: flex; }
        .photo-item.selected .check {
            display: flex;
            background: var(--accent);
            border-color: var(--accent);
        }

        /* --- Empty state --- */
        /* --- Albums grid --- */
        .albums-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 16px;
        }
        .album-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 12px;
            overflow: hidden;
            cursor: pointer;
            transition: border-color 0.15s, transform 0.1s;
        }
        .album-card:hover { border-color: var(--border-light); transform: translateY(-2px); }
        .album-cover {
            width: 100%;
            aspect-ratio: 1;
            background: var(--surface2);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 48px;
            color: var(--text3);
            overflow: hidden;
        }
        .album-cover img { width: 100%; height: 100%; object-fit: cover; }
        .album-info { padding: 12px; }
        .album-info .name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
        .album-info .count { font-size: 12px; color: var(--text2); }

        /* --- People grid --- */
        .people-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
            gap: 16px;
        }
        .person-card {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            padding: 16px 8px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 12px;
            cursor: pointer;
            transition: border-color 0.15s, transform 0.1s;
        }
        .person-card:hover { border-color: var(--border-light); transform: translateY(-2px); }
        .person-avatar {
            width: 72px;
            height: 72px;
            border-radius: 50%;
            background: var(--surface2);
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 28px;
            color: var(--text3);
        }
        .person-avatar img { width: 100%; height: 100%; object-fit: cover; }
        .person-name { font-size: 13px; font-weight: 600; text-align: center; }
        .person-count { font-size: 11px; color: var(--text2); }
        .face-card {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
            padding: 12px 8px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
        }
        .face-crop {
            width: 64px;
            height: 64px;
            border-radius: 50%;
            object-fit: cover;
            background: var(--surface2);
        }
        .face-actions {
            display: flex;
            gap: 4px;
        }
        .face-actions select {
            padding: 4px 8px;
            border-radius: 6px;
            border: 1px solid var(--border);
            background: var(--surface2);
            color: var(--text);
            font-size: 11px;
            font-family: inherit;
        }

        .empty-state {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 80px 24px;
            gap: 16px;
        }
        .empty-state .icon { font-size: 64px; opacity: 0.3; }
        .empty-state .title { font-size: 18px; font-weight: 600; color: var(--text); }
        .empty-state .desc { font-size: 14px; color: var(--text2); text-align: center; max-width: 400px; }
        .empty-state .upload-btn-lg {
            margin-top: 8px;
            padding: 12px 32px;
            border-radius: 10px;
            border: none;
            background: var(--accent);
            color: #fff;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
        }
        .empty-state .upload-btn-lg:hover { background: var(--accent-hover); }

        /* --- Upload progress panel --- */
        .upload-panel {
            position: fixed;
            bottom: 16px;
            right: 16px;
            width: 380px;
            max-height: 400px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 12px;
            overflow: hidden;
            z-index: 150;
            display: none;
            box-shadow: 0 8px 32px rgba(0,0,0,0.5);
            transform: translateY(20px);
            opacity: 0;
            transition: transform 0.3s ease, opacity 0.3s ease;
        }
        .upload-panel.show { display: block; transform: translateY(0); opacity: 1; }
        .upload-panel.hiding { transform: translateY(20px); opacity: 0; }
        .upload-panel-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 12px 16px;
            border-bottom: 1px solid var(--border);
            font-size: 13px;
            font-weight: 600;
        }
        .upload-panel-header .close {
            background: none;
            border: none;
            color: var(--text2);
            cursor: pointer;
            font-size: 16px;
            padding: 4px 8px;
            border-radius: 4px;
            transition: background 0.15s;
        }
        .upload-panel-header .close:hover { background: var(--surface3); color: var(--text); }
        .upload-panel-overall {
            padding: 8px 16px 12px;
            border-bottom: 1px solid var(--border);
        }
        .upload-panel-overall .bar-bg {
            width: 100%;
            height: 4px;
            background: var(--surface3);
            border-radius: 2px;
            overflow: hidden;
            margin-bottom: 6px;
        }
        .upload-panel-overall .bar-fill {
            height: 100%;
            background: var(--accent);
            border-radius: 2px;
            transition: width 0.3s ease;
        }
        .upload-panel-overall .bar-fill.complete { background: var(--green); }
        .upload-panel-overall .summary {
            display: flex;
            justify-content: space-between;
            font-size: 11px;
            color: var(--text2);
        }
        .upload-panel-list {
            max-height: 280px;
            overflow-y: auto;
        }
        .upload-panel-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 16px;
            border-bottom: 1px solid var(--border);
            font-size: 12px;
            transition: opacity 0.3s;
        }
        .upload-panel-item:last-child { border-bottom: none; }
        .upload-panel-item .icon {
            width: 32px;
            height: 32px;
            border-radius: 6px;
            background: var(--surface3);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            flex-shrink: 0;
        }
        .upload-panel-item .icon.done { background: rgba(34,197,94,0.15); color: var(--green); }
        .upload-panel-item .icon.failed { background: rgba(239,68,68,0.15); color: var(--red); }
        .upload-panel-item .icon.dedup { background: rgba(234,179,8,0.15); color: var(--yellow); }
        .upload-panel-item .icon.uploading { background: rgba(59,130,246,0.15); color: var(--accent); }
        .upload-panel-item .info { flex: 1; min-width: 0; }
        .upload-panel-item .name {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 12px;
        }
        .upload-panel-item .meta {
            font-size: 11px;
            color: var(--text2);
            margin-top: 2px;
            display: flex;
            gap: 8px;
        }
        .upload-panel-item .file-progress {
            width: 100%;
            height: 2px;
            background: var(--surface3);
            border-radius: 1px;
            margin-top: 4px;
            overflow: hidden;
        }
        .upload-panel-item .file-progress .fill {
            height: 100%;
            background: var(--accent);
            border-radius: 1px;
            transition: width 0.2s;
        }

        /* --- Upload toast (auto-dismiss summary) --- */
        .upload-toast {
            position: fixed;
            bottom: 16px;
            right: 16px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 12px 16px;
            z-index: 151;
            box-shadow: 0 8px 32px rgba(0,0,0,0.5);
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 13px;
            cursor: pointer;
            transform: translateY(20px);
            opacity: 0;
            transition: transform 0.3s ease, opacity 0.3s ease;
            pointer-events: none;
        }
        .upload-toast.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
        .upload-toast .toast-icon {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            flex-shrink: 0;
        }
        .upload-toast .toast-icon.success { background: rgba(34,197,94,0.15); color: var(--green); }
        .upload-toast .toast-icon.partial { background: rgba(234,179,8,0.15); color: var(--yellow); }
        .upload-toast .toast-dismiss {
            width: 100%;
            height: 3px;
            background: var(--surface3);
            border-radius: 2px;
            position: absolute;
            bottom: 0;
            left: 0;
            border-radius: 0 0 10px 10px;
            overflow: hidden;
        }
        .upload-toast .toast-dismiss .shrink {
            height: 100%;
            background: var(--accent);
            width: 100%;
            animation: shrink 4s linear forwards;
        }
        /* --- Storage provider cards --- */
        .storage-providers {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 10px;
        }
        .provider-card {
            background: var(--surface);
            border: 2px solid var(--border);
            border-radius: 12px;
            padding: 16px;
            cursor: pointer;
            transition: all 0.2s;
            position: relative;
            text-align: center;
        }
        .provider-card:hover { border-color: var(--border-light); background: var(--surface2); }
        .provider-card.selected { border-color: var(--accent); background: rgba(59,130,246,0.06); }
        .provider-icon {
            width: 48px;
            height: 48px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 10px;
            color: white;
        }
        .provider-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
        .provider-desc { font-size: 11px; color: var(--text2); }
        .provider-check {
            position: absolute;
            top: 8px;
            right: 8px;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: var(--accent);
            color: white;
            font-size: 11px;
            display: none;
            align-items: center;
            justify-content: center;
        }
        .provider-card.selected .provider-check { display: flex; }

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

        /* --- Lightbox --- */
        .lightbox {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.95);
            z-index: 300;
            align-items: center;
            justify-content: center;
            flex-direction: column;
        }
        .lightbox.show { display: flex; }
        .lightbox-close {
            position: absolute;
            top: 16px;
            right: 16px;
            background: none;
            border: none;
            color: #fff;
            font-size: 28px;
            cursor: pointer;
            opacity: 0.7;
            z-index: 310;
        }
        .lightbox-close:hover { opacity: 1; }
        .lightbox-nav {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            background: rgba(255,255,255,0.1);
            border: none;
            color: #fff;
            font-size: 24px;
            padding: 16px 12px;
            cursor: pointer;
            border-radius: 8px;
            z-index: 310;
        }
        .lightbox-nav:hover { background: rgba(255,255,255,0.2); }
        .lightbox-nav.prev { left: 16px; }
        .lightbox-nav.next { right: 16px; }
        .lightbox img {
            max-width: 90vw;
            max-height: 85vh;
            object-fit: contain;
            border-radius: 4px;
        }
        .lightbox-info {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            padding: 16px 24px;
            background: linear-gradient(transparent, rgba(0,0,0,0.8));
            display: flex;
            align-items: center;
            gap: 16px;
        }
        .lightbox-info .name { font-size: 14px; font-weight: 500; flex: 1; }
        .lightbox-info .meta { font-size: 12px; color: var(--text2); }
        .lightbox-info .actions { display: flex; gap: 8px; }
        .lightbox-info .action-btn {
            padding: 6px 14px;
            border-radius: 6px;
            border: 1px solid rgba(255,255,255,0.2);
            background: rgba(255,255,255,0.1);
            color: #fff;
            font-size: 12px;
            cursor: pointer;
        }
        .lightbox-info .action-btn:hover { background: rgba(255,255,255,0.2); }
        .lightbox-info .action-btn.danger { border-color: var(--red); color: var(--red); }
        .lightbox-info .action-btn.danger:hover { background: rgba(239,68,68,0.2); }
        .lightbox-info .action-btn.fav-active { color: var(--red); border-color: var(--red); }

        /* --- Trash item overlay --- */
        .trash-item {
            position: relative;
        }
        .trash-item .trash-actions {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            display: flex;
            gap: 4px;
            padding: 6px;
            background: linear-gradient(transparent, rgba(0,0,0,0.8));
            opacity: 0;
            transition: opacity 0.15s;
        }
        .trash-item:hover .trash-actions { opacity: 1; }
        .trash-actions button {
            flex: 1;
            padding: 5px 8px;
            border-radius: 5px;
            border: none;
            font-size: 11px;
            font-weight: 600;
            cursor: pointer;
        }
        .trash-actions .restore-btn { background: var(--accent); color: #fff; }
        .trash-actions .purge-btn { background: var(--red); color: #fff; }

        /* --- Favorite heart overlay --- */
        .photo-item .fav-heart {
            position: absolute;
            top: 6px;
            right: 6px;
            font-size: 16px;
            color: var(--red);
            opacity: 0;
            transition: opacity 0.15s;
            pointer-events: none;
        }
        .photo-item .fav-heart.show { opacity: 1; }

        /* --- Timeline --- */
        .timeline-group { margin-bottom: 24px; }
        .timeline-header {
            display: flex;
            align-items: baseline;
            gap: 12px;
            margin-bottom: 8px;
            padding: 0 4px;
        }
        .timeline-date { font-size: 16px; font-weight: 600; color: var(--text); }
        .timeline-count { font-size: 12px; color: var(--text2); }
        .timeline-group-btn {
            padding: 4px 12px;
            border-radius: 6px;
            border: 1px solid var(--border);
            background: var(--surface);
            color: var(--text2);
            cursor: pointer;
            font-size: 12px;
            font-weight: 500;
        }
        .timeline-group-btn.active {
            background: var(--accent);
            color: #fff;
            border-color: var(--accent);
        }

        /* --- Mobile nav --- */
        .mobile-menu-btn {
            display: none;
            background: none;
            border: none;
            color: var(--text);
            font-size: 24px;
            cursor: pointer;
            padding: 4px 8px;
        }
        @media (max-width: 768px) {
            .header .nav {
                display: none;
                position: fixed;
                top: 52px;
                left: 0;
                right: 0;
                bottom: 0;
                background: var(--bg);
                flex-direction: column;
                padding: 16px;
                z-index: 200;
                overflow-y: auto;
            }
            .header .nav.mobile-open { display: flex; }
            .header .nav button {
                text-align: left;
                padding: 12px 16px;
                font-size: 16px;
                border-radius: 8px;
            }
            .mobile-menu-btn { display: block; }
            .stats-bar { display: none; }
        }

        /* --- Device cards (kept for future mobile client use) --- */
        .page { display: none; flex: 1; padding: 24px; }
        .page.active { display: block; }
        .page-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; }

        .device-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 16px;
            display: flex;
            align-items: center;
            gap: 16px;
            margin-bottom: 8px;
        }
        .device-card .dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: var(--green);
            flex-shrink: 0;
        }
        .device-card .info { flex: 1; }
        .device-card .info .name { font-size: 14px; font-weight: 600; }
        .device-card .info .meta { font-size: 12px; color: var(--text2); margin-top: 2px; }

        .activity-row {
            display: flex;
            gap: 12px;
            padding: 10px 16px;
            font-size: 12px;
            font-family: 'SF Mono', Monaco, Consolas, monospace;
            border-bottom: 1px solid var(--border);
        }
        .activity-row:last-child { border-bottom: none; }
        .activity-row .time { color: var(--text2); white-space: nowrap; }
        .activity-row .action { color: var(--accent); white-space: nowrap; }
        .activity-row .detail { color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

        .card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            overflow: hidden;
            margin-bottom: 16px;
        }
        .card-header {
            padding: 12px 16px;
            border-bottom: 1px solid var(--border);
            font-size: 14px;
            font-weight: 600;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .card-empty {
            padding: 32px;
            text-align: center;
            color: var(--text2);
            font-size: 13px;
        }
        .btn {
            padding: 6px 14px;
            border-radius: 6px;
            border: 1px solid var(--border);
            background: var(--surface2);
            color: var(--text);
            font-size: 12px;
            cursor: pointer;
        }
        .btn:hover { background: var(--border); }

        /* --- Stats row for devices page --- */
        .stats-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 12px;
            margin-bottom: 20px;
        }
        .stat-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 16px;
        }
        .stat-card .label {
            font-size: 11px;
            color: var(--text2);
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .stat-card .value {
            font-size: 28px;
            font-weight: 700;
            margin-top: 4px;
        }
        .stat-card .value.accent { color: var(--accent); }
        .stat-card .value.green { color: var(--green); }

        /* --- Login overlay --- */
        .login-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: var(--bg);
            z-index: 500;
            align-items: center;
            justify-content: center;
        }
        .login-overlay.show { display: flex; }
        .login-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 40px 48px;
            width: 360px;
            display: flex;
            flex-direction: column;
            gap: 20px;
        }
        .login-card .login-logo {
            font-size: 28px;
            font-weight: 700;
            letter-spacing: -0.5px;
            text-align: center;
            margin-bottom: 4px;
        }
        .login-card .login-logo span { color: var(--accent); }
        .login-card .login-label {
            font-size: 12px;
            color: var(--text2);
            margin-bottom: 4px;
        }
        .login-card input[type="text"],
        .login-card input[type="password"] {
            width: 100%;
            padding: 10px 14px;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: var(--surface2);
            color: var(--text);
            font-size: 14px;
            outline: none;
            transition: border-color 0.15s;
        }
        .login-card input:focus { border-color: var(--accent); }
        .login-card .connect-btn {
            padding: 11px;
            border-radius: 8px;
            border: none;
            background: var(--accent);
            color: #fff;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: background 0.15s;
        }
        .login-card .connect-btn:hover { background: var(--accent-hover); }
        .login-card .login-hint {
            font-size: 11px;
            color: var(--text3);
            text-align: center;
            margin-top: -8px;
        }

        /* --- Logout button --- */
        .logout-btn {
            padding: 6px 12px;
            border-radius: 6px;
            border: 1px solid var(--border);
            background: transparent;
            color: var(--text2);
            font-size: 12px;
            cursor: pointer;
            transition: all 0.15s;
        }
        .logout-btn:hover { border-color: var(--red); color: var(--red); }

        /* --- Settings page --- */
        .settings-section { margin-bottom: 24px; }
        .settings-section .section-title {
            font-size: 11px;
            font-weight: 600;
            color: var(--text2);
            text-transform: uppercase;
            letter-spacing: 0.8px;
            margin-bottom: 10px;
        }
        .form-row {
            display: flex;
            flex-direction: column;
            gap: 6px;
            margin-bottom: 12px;
        }
        .form-row label {
            font-size: 12px;
            color: var(--text2);
        }
        .form-row input[type="text"],
        .form-row input[type="password"],
        .form-row input[type="number"],
        .form-row select,
        .form-row textarea {
            width: 100%;
            padding: 9px 12px;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: var(--surface2);
            color: var(--text);
            font-size: 13px;
            outline: none;
            transition: border-color 0.15s;
            font-family: inherit;
        }
        .form-row input:focus,
        .form-row select:focus,
        .form-row textarea:focus { border-color: var(--accent); }
        .form-row select option { background: var(--surface2); }
        .form-actions {
            display: flex;
            gap: 10px;
            margin-top: 4px;
        }
        .btn-primary {
            padding: 8px 20px;
            border-radius: 8px;
            border: none;
            background: var(--accent);
            color: #fff;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: background 0.15s;
        }
        .btn-primary:hover { background: var(--accent-hover); }
        .btn-test {
            padding: 8px 20px;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: var(--surface2);
            color: var(--text);
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.15s;
        }
        .btn-test:hover { border-color: var(--accent); color: var(--accent); }
        .btn-test.success { border-color: var(--green); color: var(--green); }
        .info-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 10px;
        }
        .info-item {
            background: var(--surface2);
            border-radius: 8px;
            padding: 12px 14px;
        }
        .info-item .info-label {
            font-size: 11px;
            color: var(--text2);
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .info-item .info-val {
            font-size: 16px;
            font-weight: 600;
            margin-top: 4px;
        }

        @media (max-width: 600px) {
            .header .nav { display: none; }
            .header .stats-bar { display: none; }
            .photo-grid { grid-template-columns: repeat(3, 1fr); }
            .upload-panel { width: calc(100% - 32px); }
            .upload-toast { width: calc(100% - 32px); }
            .lightbox-info { flex-wrap: wrap; }
            .login-card { width: calc(100% - 40px); padding: 32px 24px; }
            .storage-providers { grid-template-columns: repeat(2, 1fr); }
        }
