/* ============================================================
   progress.css — стили для мини-приложения «Прогресс»
   Версия: 2.0.0
   ============================================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #0b0d12;
    --surface: #151821;
    --surface-2: #1e2230;
    --surface-3: #262b3d;
    --border: #2a2f42;
    --border-soft: #1f2333;
    --text: #f0f2f8;
    --text-dim: #8891a8;
    --text-muted: #5a6278;
    --accent: #7c83ff;
    --accent-2: #a78bfa;
    --accent-soft: rgba(124, 131, 255, 0.12);
    --success: #34d399;
    --danger: #f87171;
    --radius: 16px;
    --radius-sm: 12px;
}

/* ============ APP CONTAINER ============ */
.progress-app {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10002;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
}

.progress-app .app-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px;
    padding-bottom: env(safe-area-inset-bottom, 20px);
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ============ TOPBAR ============ */
.progress-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 16px 24px;
    padding-top: max(env(safe-area-inset-top, 0), 16px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    min-height: 60px;
}

.progress-topbar .back-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.2s;
}

.progress-topbar .back-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.progress-topbar .back-btn:active {
    transform: scale(0.95);
}

.progress-topbar .back-btn.hidden {
    visibility: hidden;
    pointer-events: none;
}

.progress-topbar .topbar-title {
    margin: 0;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-topbar .topbar-title .step-badge {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 12px;
    border-radius: 20px;
}

.progress-topbar .close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.progress-topbar .close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.progress-topbar .close-btn:active {
    transform: scale(0.95);
}

/* ============ PANELS ============ */
.progress-panel {
    display: none;
    animation: progressFadeIn 0.35s ease;
    flex: 1;
    min-height: 0;
}

.progress-panel.active {
    display: block;
}

/* Редактор — flex контейнер */
.progress-panel#progressPanel3.active {
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
    min-height: 0;
}

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

/* ============ STEP 1: TEMPLATES ============ */
.progress-hero {
    text-align: center;
    padding: 20px 0 28px;
    flex-shrink: 0;
}

.progress-hero h2 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #fff, #a8b0cc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.progress-hero p {
    color: var(--text-dim);
    font-size: 14px;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    padding: 4px;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 520px) {
    .templates-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
        max-height: calc(100vh - 300px);
    }
}

.templates-grid::-webkit-scrollbar {
    width: 3px;
}
.templates-grid::-webkit-scrollbar-track {
    background: transparent;
}
.templates-grid::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.tpl-card {
    background: var(--surface);
    border: 1.5px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.tpl-card:active {
    transform: scale(0.97);
}

.tpl-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(124, 131, 255, 0.15);
}

.tpl-card.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 1px var(--accent), 0 8px 24px rgba(124, 131, 255, 0.2);
}

.tpl-preview {
    aspect-ratio: 1;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.tpl-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tpl-preview .placeholder-slots {
    display: grid;
    gap: 4px;
    width: 80%;
    height: 80%;
    padding: 4px;
}

.tpl-preview .slot-placeholder {
    background: rgba(124, 131, 255, 0.08);
    border-radius: 4px;
    border: 1px dashed rgba(124, 131, 255, 0.15);
}

.tpl-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
    letter-spacing: -0.01em;
}

.tpl-count {
    font-size: 11px;
    color: var(--text-muted);
}

.tpl-check {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #fff;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s ease;
}

.tpl-card.selected .tpl-check {
    opacity: 1;
    transform: scale(1);
}

/* 🏆 Золотой бейдж как у PRO+ */
.tpl-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #1a1a2e;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    letter-spacing: 0.3px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.2);
}

/* ============ STEP 2: PHOTOS ============ */
.upload-hero {
    text-align: center;
    padding: 8px 0 20px;
    flex-shrink: 0;
}

.upload-hero h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.upload-hero p {
    color: var(--text-dim);
    font-size: 13px;
}

.upload-zone {
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s;
    margin-bottom: 20px;
}

.upload-zone:hover,
.upload-zone.drag {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.upload-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(124, 131, 255, 0.3);
}

.upload-icon i {
    font-size: 24px;
    color: white;
}

.upload-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.upload-sub {
    font-size: 12px;
    color: var(--text-dim);
}

.upload-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

.upload-buttons .btn-upload {
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.upload-buttons .btn-upload:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.upload-buttons .btn-upload i {
    font-size: 14px;
}

.upload-buttons .btn-upload.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.upload-buttons .btn-upload.primary:hover {
    background: #6a72e6;
    border-color: #6a72e6;
}

.progress-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    margin: 16px 0;
}

.progress-indicator .dots {
    display: flex;
    gap: 6px;
}

.progress-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.progress-indicator .dot.filled {
    background: var(--accent);
}

.progress-indicator .dot.current {
    background: var(--accent);
    box-shadow: 0 0 12px rgba(124, 131, 255, 0.3);
    animation: progressPulseDot 1s ease-in-out infinite;
}

@keyframes progressPulseDot {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.4);
    }
}

.progress-indicator .progress-text {
    font-size: 13px;
    color: var(--text-dim);
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
    max-height: calc(100vh - 480px);
    overflow-y: auto;
    padding: 4px;
    -webkit-overflow-scrolling: touch;
}

.photos-grid::-webkit-scrollbar {
    width: 3px;
}
.photos-grid::-webkit-scrollbar-track {
    background: transparent;
}
.photos-grid::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.photo-item {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    background: var(--surface);
    border: 1.5px solid var(--border);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-num {
    position: absolute;
    top: 6px;
    left: 6px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(10px);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

.photo-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(10px);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    color: #fff;
}

.photo-remove:hover {
    background: var(--danger);
}

.photo-remove i {
    font-size: 12px;
}

.photo-slot-empty {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1.5px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 28px;
    position: relative;
}

.photo-slot-empty .slot-label {
    position: absolute;
    bottom: 8px;
    font-size: 10px;
    color: var(--text-muted);
}

.create-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    box-shadow: 0 6px 20px rgba(124, 131, 255, 0.3);
    min-height: 52px;
    flex-shrink: 0;
}

.create-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(124, 131, 255, 0.4);
}

.create-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.create-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.create-btn i {
    font-size: 16px;
}

/* ============ STEP 3: EDITOR ============ */
.editor-wrap {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 10px;
    flex: 0 0 auto;
    width: 100%;
}

.canvas-box {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 100%;
    background: var(--bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
    touch-action: none;
    flex-shrink: 0;
}

#editorCanvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

.canvas-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    font-size: 9px;
    color: var(--text-dim);
    pointer-events: none;
    white-space: nowrap;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 6px;
}

.canvas-hint i {
    font-size: 10px;
}

.layers {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-top: 10px;
    flex-shrink: 0;
}

.layers-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
    padding: 0 2px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.layers-label .layer-count {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    text-transform: none;
}

.layers-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.layers-list::-webkit-scrollbar {
    height: 3px;
}
.layers-list::-webkit-scrollbar-track {
    background: transparent;
}
.layers-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.layer-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 4px;
    background: var(--surface-2);
    border: 1.5px solid var(--border-soft);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.layer-chip:hover {
    border-color: var(--accent);
}

.layer-chip.active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.layer-chip-img {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--surface-3);
    flex-shrink: 0;
}

.layer-chip-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.layer-chip-name {
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    flex-shrink: 0;
    padding-bottom: env(safe-area-inset-bottom, 8px);
}

.ctrl-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.ctrl-btn {
    padding: 8px 6px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: inherit;
    min-height: 36px;
}

.ctrl-btn:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.ctrl-btn:active {
    transform: scale(0.96);
}

.ctrl-btn i {
    font-size: 14px;
}

.ctrl-btn .ctrl-label {
    font-size: 9px;
    color: var(--text-muted);
}

.export-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    box-shadow: 0 4px 16px rgba(124, 131, 255, 0.3);
    min-height: 44px;
    flex-shrink: 0;
    margin-top: 4px;
}

.export-btn:active {
    transform: scale(0.98);
}

.export-btn i {
    font-size: 16px;
}

/* ============ TOAST ============ */
.progress-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 24px;
    background: rgba(30, 34, 48, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #f0f2f8;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 10010;
    transition: transform 0.35s ease, opacity 0.35s ease;
    opacity: 0;
    pointer-events: none;
    max-width: 90%;
}

.progress-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.progress-toast.success {
    border-color: rgba(52, 211, 153, 0.3);
}

.progress-toast.error {
    border-color: rgba(248, 113, 113, 0.3);
}

/* ============ MODAL OVERLAY ============ */
.progress-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10003;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.progress-modal-content {
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    color: var(--text);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-modal-content h2 {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-modal-search {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.progress-modal-search input {
    flex: 1;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 14px;
    outline: none;
}

.progress-modal-search input:focus {
    border-color: var(--accent);
}

.progress-modal-search input::placeholder {
    color: var(--text-muted);
}

.progress-modal-search .search-btn {
    padding: 10px 20px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.progress-modal-search .search-btn:hover {
    background: #6a72e6;
}

.progress-client-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

.progress-client-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.progress-client-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.progress-client-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface-2);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-client-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.progress-client-avatar .placeholder {
    font-size: 18px;
    color: var(--text-muted);
    font-weight: 600;
}

.progress-client-info {
    flex: 1;
}

.progress-client-name {
    font-weight: 500;
}

.progress-client-phone {
    font-size: 12px;
    color: var(--text-dim);
}

.progress-client-arrow {
    color: var(--text-muted);
}

.progress-modal-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
}

.progress-modal-pagination button {
    padding: 6px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.progress-modal-pagination button:hover:not(:disabled) {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.progress-modal-pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.progress-modal-pagination .page-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

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

.progress-modal-footer .btn-close {
    padding: 10px 24px;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.progress-modal-footer .btn-close:hover {
    border-color: var(--border);
    background: var(--surface-3);
}

/* ============ ALBUM GRID ============ */
.progress-album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
}

.progress-album-item {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    background: var(--surface-2);
    position: relative;
}

.progress-album-item:hover {
    border-color: var(--accent);
    transform: scale(1.02);
}

.progress-album-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.progress-album-item .album-check {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--accent);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s;
}

.progress-album-item:hover .album-check {
    opacity: 1;
}

.progress-album-empty {
    grid-column: 1/-1;
    text-align: center;
    padding: 40px;
    color: var(--text-dim);
}

.progress-album-empty i {
    font-size: 32px;
    display: block;
    margin-bottom: 12px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 480px) {
    .progress-app .app-inner {
        padding: 0 12px;
    }

    .progress-hero h2 {
        font-size: 22px;
    }

    .templates-grid {
        gap: 10px;
        max-height: calc(100vh - 240px);
    }

    .tpl-card {
        padding: 10px;
    }

    .tpl-name {
        font-size: 12px;
    }

    .photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
        max-height: calc(100vh - 440px);
    }

    .upload-zone {
        padding: 24px 16px;
    }

    .upload-icon {
        width: 44px;
        height: 44px;
    }

    .upload-icon i {
        font-size: 20px;
    }

    .editor-wrap {
        padding: 8px;
        margin-bottom: 6px;
    }

    .layers {
        padding: 8px 10px;
        margin-top: 6px;
    }

    .controls {
        margin-top: 6px;
        gap: 6px;
    }

    .ctrl-row {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }

    .ctrl-btn {
        padding: 6px 4px;
        font-size: 9px;
        min-height: 32px;
    }

    .ctrl-btn i {
        font-size: 12px;
    }

    .ctrl-btn .ctrl-label {
        font-size: 8px;
    }

    .export-btn {
        padding: 10px;
        font-size: 13px;
        min-height: 40px;
        border-radius: var(--radius-sm);
    }

    .layer-chip {
        padding: 3px 6px 3px 3px;
    }

    .layer-chip-img {
        width: 20px;
        height: 20px;
    }

    .layer-chip-name {
        font-size: 10px;
    }

    .create-btn {
        padding: 14px;
        font-size: 14px;
        min-height: 44px;
    }

    .progress-topbar {
        padding: 12px 16px;
        min-height: 50px;
    }

    .progress-topbar .topbar-title {
        font-size: 17px;
    }

    .progress-topbar .topbar-title .step-badge {
        font-size: 10px;
        padding: 1px 8px;
    }

    .progress-topbar .back-btn,
    .progress-topbar .close-btn {
        width: 34px;
        height: 34px;
        font-size: 15px;
    }

    .progress-modal-content {
        padding: 16px;
        max-width: 95%;
    }

    .progress-modal-content h2 {
        font-size: 18px;
    }

    .progress-client-item {
        padding: 10px 12px;
    }

    .progress-client-avatar {
        width: 34px;
        height: 34px;
    }

    .progress-client-name {
        font-size: 14px;
    }

    .progress-album-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }

    .progress-modal-search {
        flex-direction: column;
    }

    .progress-modal-search .search-btn {
        width: 100%;
    }
}

@media (max-width: 360px) {
    .templates-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        max-height: calc(100vh - 220px);
    }

    .photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 6px;
        max-height: calc(100vh - 420px);
    }

    .upload-buttons .btn-upload {
        font-size: 12px;
        padding: 6px 12px;
        width: 100%;
        justify-content: center;
    }

    .upload-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .ctrl-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .progress-topbar .topbar-title {
        font-size: 15px;
    }

    .progress-topbar .topbar-title .step-badge {
        font-size: 9px;
        padding: 1px 6px;
    }

    .editor-wrap {
        padding: 6px;
    }

    .layers {
        padding: 6px 8px;
    }

    .export-btn {
        font-size: 12px;
        min-height: 36px;
        padding: 8px;
    }
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* ============================================================
   МИНИМАЛИСТИЧНЫЙ РЕЖИМ ДЛЯ ОЧЕНЬ МАЛЕНЬКИХ ЭКРАНОВ (≤ 360px)
   ============================================================ */

@media (max-width: 360px) {
    /* Уменьшаем отступы контейнера */
    .progress-app .app-inner {
        padding: 0 6px;
    }

    /* Компактный редактор */
    .editor-wrap {
        padding: 4px;
        margin-bottom: 4px;
        border-radius: 8px;
    }

    .canvas-box {
        border-radius: 6px;
    }

    /* Скрываем подсказку на канвасе */
    .canvas-hint {
        display: none;
    }

    /* Компактные слои */
    .layers {
        padding: 4px 6px;
        margin-top: 4px;
        border-radius: 8px;
    }

    .layers-label {
        font-size: 8px;
        margin-bottom: 2px;
    }

    .layers-label .layer-count {
        font-size: 8px;
    }

    .layers-list {
        gap: 3px;
    }

    .layer-chip {
        padding: 2px 4px 2px 2px;
        border-radius: 4px;
        gap: 3px;
    }

    .layer-chip-img {
        width: 14px;
        height: 14px;
        border-radius: 3px;
    }

    .layer-chip-name {
        font-size: 7px;
    }

    /* Кнопка сброса выделения в слоях */
    .deselect-layer-btn {
        padding: 2px 6px !important;
        font-size: 8px !important;
        border-radius: 4px !important;
    }
    .deselect-layer-btn i {
        font-size: 10px !important;
    }

    /* Компактные контролы */
    .controls {
        margin-top: 4px;
        gap: 4px;
        padding-bottom: env(safe-area-inset-bottom, 4px);
    }

    .ctrl-row {
        gap: 3px;
    }

    .ctrl-btn {
        padding: 4px 2px;
        font-size: 7px;
        min-height: 22px;
        border-radius: 4px;
        gap: 2px;
    }

    .ctrl-btn i {
        font-size: 10px;
    }

    /* Скрываем подписи под иконками */
    .ctrl-btn .ctrl-label {
        display: none;
    }

    /* Убираем кнопки поворота (первая и вторая в первом ряду) */
    .ctrl-row:first-child .ctrl-btn:nth-child(1),
    .ctrl-row:first-child .ctrl-btn:nth-child(2) {
        display: none;
    }
    .ctrl-row:first-child {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Убираем кнопку "Снять" в последнем ряду (оставляем Центр и Сброс) */
    .ctrl-row:last-child .ctrl-btn:nth-child(3) {
        display: none;
    }
    .ctrl-row:last-child {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Кнопка экспорта — крупная и заметная */
    .export-btn {
        padding: 8px;
        font-size: 12px;
        min-height: 36px;
        border-radius: 6px;
        margin-top: 2px;
    }

    .export-btn i {
        font-size: 14px;
    }

    /* Уменьшаем topbar */
    .progress-topbar {
        padding: 8px 12px;
        min-height: 40px;
    }

    .progress-topbar .topbar-title {
        font-size: 14px;
    }

    .progress-topbar .topbar-title .step-badge {
        font-size: 8px;
        padding: 1px 6px;
    }

    .progress-topbar .back-btn,
    .progress-topbar .close-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* Дополнительно для экранов ≤ 320px */
@media (max-width: 320px) {
    .progress-app .app-inner {
        padding: 0 4px;
    }

    .editor-wrap {
        padding: 3px;
        border-radius: 6px;
    }

    .layers {
        padding: 3px 4px;
        border-radius: 6px;
    }

    .layer-chip {
        padding: 1px 3px 1px 1px;
        border-radius: 3px;
    }

    .layer-chip-img {
        width: 12px;
        height: 12px;
        border-radius: 2px;
    }

    .layer-chip-name {
        font-size: 6px;
    }

    .ctrl-btn {
        padding: 3px 1px;
        min-height: 18px;
        font-size: 6px;
    }

    .ctrl-btn i {
        font-size: 8px;
    }

    .export-btn {
        padding: 6px;
        font-size: 10px;
        min-height: 30px;
    }

    .export-btn i {
        font-size: 12px;
    }

    .progress-topbar {
        padding: 6px 8px;
        min-height: 34px;
    }

    .progress-topbar .topbar-title {
        font-size: 12px;
    }

    .progress-topbar .topbar-title .step-badge {
        font-size: 7px;
        padding: 1px 4px;
    }

    .progress-topbar .back-btn,
    .progress-topbar .close-btn {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
}
/* ============================================================
   ДЕСКТОПНАЯ ВЕРСИЯ — КНОПКА ВСЕГДА ВИДНА
   ============================================================ */

@media (min-width: 769px) {
    .progress-panel#progressPanel3.active {
        height: 100%;
        min-height: 0;
    }

    .editor-scroll-area {
        flex: 1;
        overflow-y: auto;
        padding: 0 4px 8px 4px;
    }

    .editor-scroll-area::-webkit-scrollbar {
        width: 4px;
    }
    .editor-scroll-area::-webkit-scrollbar-track {
        background: transparent;
    }
    .editor-scroll-area::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 2px;
    }

    .editor-controls-fixed {
        padding: 12px 20px 16px 20px;
        background: rgba(11, 13, 18, 0.95);
        backdrop-filter: blur(12px);
        border-top: 1px solid var(--border-soft);
    }

    .export-btn {
        padding: 16px 24px;
        min-height: 56px;
        font-size: 16px;
        border-radius: var(--radius);
        box-shadow: 0 4px 20px rgba(124, 131, 255, 0.3);
    }

    .export-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 30px rgba(124, 131, 255, 0.4);
    }

    /* Уменьшаем отступы для компактности */
    .editor-wrap {
        padding: 8px;
        margin-bottom: 8px;
    }

    .layers {
        padding: 8px 12px;
        margin-top: 8px;
    }

    .controls {
        margin-top: 8px;
    }
}

/* ============================================================
   ВКЛАДКА «УСЛУГИ»
   ============================================================ */

/* ---- ЗАГРУЗКА ---- */
.services-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
    color: #94a3b8;
}

.services-loading i {
    font-size: 32px;
    color: #667eea;
}

/* ---- ПУСТОЕ СОСТОЯНИЕ ---- */
.services-empty {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.services-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.services-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 8px;
}

.services-empty-hint {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 20px;
}

/* ---- ШАПКА ---- */
.services-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.services-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.services-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.services-title i {
    color: #667eea;
}

.services-count {
    background: #e2e8f0;
    color: #4a5568;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.services-active-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #718096;
}

.services-active-dot {
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    display: inline-block;
}

.services-refresh-btn {
    padding: 8px 16px;
    background: #e2e8f0;
    border: none;
    border-radius: 8px;
    color: #4a5568;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.services-refresh-btn:hover {
    background: #cbd5e0;
}

.services-refresh-btn:active {
    transform: scale(0.97);
}

/* ---- СЕТКА КАРТОЧЕК ---- */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* ---- КАРТОЧКА УСЛУГИ ---- */
.service-card {
    background: white;
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.2s;
    border-left: 4px solid #2ecc71;
}

.service-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.service-card-inactive {
    border-left-color: #94a3b8;
    opacity: 0.7;
}

.service-card-inactive:hover {
    opacity: 0.9;
}

/* ---- ШАПКА КАРТОЧКИ ---- */
.service-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.service-card-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    color: #1a202c;
    flex: 1;
    min-width: 150px;
}

.service-card-icon {
    font-size: 14px;
}

.service-card-status {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.service-card-status-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.badge-active {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-inactive {
    background: #f5f5f5;
    color: #757575;
}

/* ---- ТОГГЛ В КАРТОЧКЕ ---- */
.service-toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
}

.service-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.service-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #cbd5e0;
    transition: 0.3s;
    border-radius: 20px;
}

.service-toggle-slider::before {
    content: '';
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.3s;
    border-radius: 50%;
}

.service-toggle input:checked + .service-toggle-slider {
    background: #2ecc71;
}

.service-toggle input:checked + .service-toggle-slider::before {
    transform: translateX(16px);
}

.service-toggle:hover .service-toggle-slider {
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.2);
}

/* ---- ТЕЛО КАРТОЧКИ ---- */
.service-card-body {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.service-card-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.service-card-field label {
    font-size: 10px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.service-card-value {
    font-size: 14px;
    font-weight: 500;
    color: #1a202c;
}

.service-card-field input {
    padding: 4px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 13px;
    width: 100%;
    max-width: 80px;
    transition: border-color 0.2s;
}

.service-card-field input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.service-card-unit {
    font-size: 11px;
    color: #94a3b8;
    margin-left: 2px;
}

/* ---- АДАПТИВНОСТЬ ---- */
@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    .service-card-body {
        grid-template-columns: 1fr 1fr;
    }
    
    .services-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .services-refresh-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .service-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .service-card-status {
        width: 100%;
        justify-content: space-between;
    }
    
    .service-card-body {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .service-card-field input {
        max-width: 100%;
    }
}