
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        }

        body {
            background: #f5f5f5;
            padding: 0;
        }

        /* ЭКРАН ВХОДА */
        .login-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: #f5f5f5;
            z-index: 10000;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .login-card {
            background: white;
            padding: 32px 28px;
            border-radius: 20px;
            text-align: center;
            width: 320px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
            position: relative;
        }

        .login-card h2 {
            font-size: 22px;
            font-weight: 500;
            color: #1a1a1a;
            margin-bottom: 6px;
        }

        .login-card p {
            color: #888;
            font-size: 13px;
            margin-bottom: 28px;
        }

        .login-card select,
        .login-card input {
            width: 100%;
            padding: 12px 14px;
            border-radius: 12px;
            border: 1px solid #ddd;
            font-size: 15px;
            margin-bottom: 16px;
            outline: none;
            background: white;
        }

        .login-card select:focus,
        .login-card input:focus {
            border-color: #999;
        }

        .login-card button {
            width: 100%;
            padding: 12px;
            background: #1a1a1a;
            color: white;
            border: none;
            border-radius: 12px;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
        }

        .login-card button:active {
            background: #333;
        }

        .login-error {
            color: #e53935;
            font-size: 12px;
            margin-top: 12px;
            display: none;
        }

        /* ОСНОВНОЙ ИНТЕРФЕЙС */
        .container {
            max-width: 100%;
            margin: 0;
            padding: 12px;
            display: none;
        }

        .header {
            position: sticky;
            top: 0;
            z-index: 100;
            background: #f5f5f5;
            padding-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
        }

        .header h1 {
            font-size: 18px;
            font-weight: 600;
            color: #1a1a1a;
            margin: 0;
            white-space: nowrap;
        }

        .search-box {
            position: relative;
            flex: 1;
            min-width: 120px;
        }

        .search-box input {
            width: 100%;
            padding: 8px 32px 8px 12px;
            border-radius: 12px;
            border: 1px solid #ddd;
            font-size: 14px;
            background: white;
        }

        .search-box .clear-btn {
            position: absolute;
            right: 10px;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            font-size: 14px;
            cursor: pointer;
            color: #bbb;
            display: none;
        }

        .search-box .clear-btn.visible {
            display: block;
        }

        .info-bar {
            width: 100%;
            font-size: 11px;
            color: #888;
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 6px;
        }

        .sync-indicator.offline {
    background: #f44336;
    box-shadow: 0 0 4px #f44336;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

        .sync-indicator {
            display: inline-block;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #ccc;
        }

        .sync-indicator.syncing {
            background: #ff9800;
            animation: pulse 1s infinite;
        }

        .sync-indicator.online {
            background: #4caf50;
        }

        .sync-indicator.offline {
            background: #f44336;
        }

        @keyframes pulse {

            0%,
            100% {
                opacity: 1;
            }

            50% {
                opacity: 0.4;
            }
        }

        .header-btn {
            padding: 6px 12px;
            color: white;
            border: none;
            border-radius: 10px;
            font-size: 13px;
            cursor: pointer;
        }

        .btn-sync {
            background: #607d8b;
        }

        .btn-download {
            background: #4caf50;
        }

        .btn-logout {
            background: #9e9e9e;
        }

        /* СЕТКА КАРТОЧЕК */
        .cards-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 10px;
        }

        @media (min-width: 550px) {
            .cards-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 12px;
            }
        }

        @media (min-width: 800px) {
            .cards-grid {
                grid-template-columns: repeat(3, 1fr);
                gap: 12px;
            }
        }

        @media (min-width: 1100px) {
            .cards-grid {
                grid-template-columns: repeat(4, 1fr);
                gap: 14px;
            }
        }

        .card {
            background: white;
            border-radius: 16px;
            padding: 12px;
            cursor: pointer;
            transition: all 0.15s;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
            border: 1px solid #eee;
        }

        .card:active {
            transform: scale(0.99);
            background: #fafafa;
        }

        .field {
            margin-bottom: 4px;
            display: flex;
            align-items: center;
            gap: 6px;
            flex-wrap: wrap;
        }

        .field .label {
            color: #999;
            font-size: 12px;
        }

        .field .value {
            color: #333;
            font-size: 13px;
            word-break: break-word;
        }

        .empty {
            text-align: center;
            padding: 40px;
            color: #aaa;
            font-size: 14px;
        }

        .nav-icon-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 42px;
            height: 22px;
            flex-shrink: 0;
            cursor: pointer;
            background: #ffffff;
            border-radius: 50%;
            transition: background 0.15s;
        }

        .card-open-btn {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        cursor: pointer;
        flex-shrink: 0;
        align-self: flex-end;  /* прижимает к низу flex-контейнера */
    }

        /* МОДАЛКА */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            justify-content: center;
            align-items: center;
        }

        .modal.show {
            display: flex;
        }

        .modal-content {
            background: white;
            border-radius: 20px;
            width: 100%;
            max-width: 650px;
            max-height: 85vh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            margin: 16px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 16px 12px;
            border-bottom: 1px solid #f0f0f0;
            flex-shrink: 0;
            background: white;
        }

        .modal-header h2 {
            font-size: 16px;
            font-weight: 600;
            color: #1a1a1a;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            flex: 1;
        }

        .close-btn {
            font-size: 28px;
            cursor: pointer;
            color: #666;
            background: rgba(0, 0, 0, 0.05);
            border: none;
            width: 36px;
            height: 36px;
            line-height: 36px;
            text-align: center;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .close-btn:active {
            background: rgba(0, 0, 0, 0.15);
        }

.btn-edit, .btn-save, .btn-cancel {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}
.btn-edit { background: #4a6fa5; color: white; }
.btn-save { background: #2ecc71; color: white; }
.btn-cancel { background: #e74c3c; color: white; }

        .tabs {
            display: flex;
            gap: 0;
            border-bottom: 1px solid #f0f0f0;
            padding: 0 16px;
            flex-shrink: 0;
            background: white;
        }

        .tab-btn {
            padding: 10px 16px;
            background: none;
            border: none;
            font-size: 13px;
            color: #888;
            border-bottom: 2px solid transparent;
            cursor: pointer;
        }

        .tab-btn.active {
            color: #1a1a1a;
            border-bottom-color: #1a1a1a;
            font-weight: 500;
        }

        .tab-content {
            display: none;
            padding: 16px;
            overflow-y: auto;
            flex: 1;
            -webkit-overflow-scrolling: touch;
        }

        .tab-content.active {
            display: block;
        }

        .readme-content {
            background: #fafafa;
            padding: 14px;
            border-radius: 14px;
            font-size: 14px;
            line-height: 1.5;
            white-space: pre-wrap;
            font-family: monospace;
        }

        .photos-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
        }

        @media (min-width: 700px) {
            .photos-grid {
                grid-template-columns: repeat(4, 1fr);
            }
        }

        @media (min-width: 900px) {
            .photos-grid {
                grid-template-columns: repeat(5, 1fr);
            }
        }

        .photo-card {
            border: 1px solid #eee;
            border-radius: 12px;
            overflow: hidden;
            cursor: pointer;
            background: #fafafa;
        }

        .photo-card img {
            width: 100%;
            height: 90px;
            object-fit: cover;
        }

        .photo-name {
            padding: 6px;
            font-size: 9px;
            text-align: center;
            color: #666;
            word-break: break-all;
        }

        .files-list {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .file-item {
            padding: 10px 12px;
            background: #fafafa;
            border-radius: 12px;
            font-size: 13px;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .file-item:hover {
            background: #e3f2fd;
            transform: translateX(5px);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }

        .file-item.pdf { border-left: 4px solid #f44336; }
        .file-item.doc, .file-item.docx { border-left: 4px solid #2196f3; }
        .file-item.xls, .file-item.xlsx { border-left: 4px solid #4caf50; }
        .file-item.image { border-left: 4px solid #ff9800; }
        .file-item.video { border-left: 4px solid #9c27b0; }
        .file-item.txt, .file-item.md { border-left: 4px solid #607d8b; }

        .btn-replace-file {
            width: 100%;
            padding: 12px;
            background: #ff9800;
            color: white;
            border: none;
            border-radius: 12px;
            font-size: 13px;
            cursor: pointer;
            margin-top: 8px;
            font-weight: 500;
        }

        .btn-replace-file:active {
            opacity: 0.7;
        }

        .modal-actions {
            padding: 12px 16px;
            border-top: 1px solid #f0f0f0;
            display: flex;
            gap: 8px;
            flex-shrink: 0;
            background: white;
        }

        .modal-actions button {
            flex: 1;
            padding: 10px;
            border: none;
            border-radius: 10px;
            font-size: 13px;
            cursor: pointer;
        }

        .modal-actions button:active {
            opacity: 0.7;
        }

        .btn-folder {
            background: #607d8b;
            color: white;
        }

        .btn-upload {
            background: #4caf50;
            color: white;
        }

        .btn-close {
            background: #9e9e9e;
            color: white;
        }

        /* ГАЛЕРЕЯ */
        .gallery-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: black;
            z-index: 2000;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .gallery-overlay.active {
            display: flex;
        }

        .gallery-image {
            max-width: 100%;
            max-height: 80vh;
            object-fit: contain;
        }

        .gallery-counter {
            color: white;
            font-size: 13px;
            padding: 12px;
        }

        .gallery-close {
            position: absolute;
            top: 16px;
            right: 20px;
            color: white;
            font-size: 28px;
            cursor: pointer;
        }

        .gallery-nav {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            color: white;
            font-size: 36px;
            cursor: pointer;
            padding: 20px;
        }

        .gallery-prev {
            left: 5px;
        }

        .gallery-next {
            right: 5px;
        }

            .gallery-image {
    cursor: zoom-in;
    user-select: none;  /* запрещаем выделение */
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.gallery-image.zoomed,
.gallery-image[style*="scale"] {
    cursor: grab;
}

.gallery-image:active {
    cursor: grabbing;
}


        /* ПРОГРЕСС-БАР ЗАГРУЗКИ ФОТО */
        .progress-bar-container {
            position: fixed;
            bottom: 20px;
            left: 20px;
            right: 20px;
            background: rgba(0, 0, 0, 0.85);
            backdrop-filter: blur(8px);
            border-radius: 16px;
            padding: 12px 16px;
            z-index: 9999;
            display: none;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        }

        .progress-bar-container.active {
            display: block;
        }

        .progress-text {
            display: flex;
            justify-content: space-between;
            font-size: 12px;
            color: white;
            margin-bottom: 8px;
        }

        .progress-bar {
            width: 100%;
            height: 6px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 3px;
            overflow: hidden;
        }

        .progress-fill {
            height: 100%;
            background: #4caf50;
            width: 0%;
            transition: width 0.2s;
        }

        /* Адаптация под маленькие экраны */
        @media (max-width: 480px) {
            .modal-content {
                margin: 8px;
                max-height: 90vh;
            }

            .photos-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        .autocomplete-list {
            position: absolute;
            width: 100%;
            background: white;
            border: 1px solid #ddd;
            border-top: none;
            border-radius: 0 0 12px 12px;
            max-height: 200px;
            overflow-y: auto;
            z-index: 10001;
            display: none;
        }

        .autocomplete-list:not(:empty) {
            display: block;
        }

        .autocomplete-item {
            padding: 10px 14px;
            cursor: pointer;
            font-size: 14px;
            color: #333;
        }

        .autocomplete-item:hover,
        .autocomplete-item:active {
            background: #f0f0f0;
        }