/* SHATTER REVEAL ANIMATION */
.cinematic-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 999999;
    /* Super high z-index */
    pointer-events: none;
    display: none;
    overflow: hidden;
    background: transparent;
    /* Shards provide background */
}

.cinematic-overlay.active {
    display: block;
    pointer-events: auto;
}

.shard {
    position: absolute;
    background: #0f172a;
    /* Match modal bg */
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    /* Subtle grid line */
    transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform, opacity;
    transform-origin: center center;
    opacity: 1;
    backface-visibility: hidden;
}

.loading-message {
    font-family: 'Playfair Display', serif;
    font-size: 4rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
    z-index: 100000;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    transition: all 0.5s ease;
    pointer-events: none;
}

.cinematic-overlay.active .loading-message {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.cinematic-overlay.animate-out .loading-message {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.1);
}

/* REVERT WELCOME BUTTON LAYOUT (Vertical, Wide, Explanatory) */
.welcome-options {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    margin-top: 24px !important;
    grid-template-columns: none !important;
}

.welcome-btn {
    width: 100% !important;
    max-width: 100% !important;
    padding: 24px !important;
    text-align: left !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    height: auto !important;
    border-radius: 12px !important;
}

.welcome-btn i {
    margin-right: 20px !important;
    font-size: 28px !important;
    margin-bottom: 0 !important;
}

.welcome-btn span {
    display: block !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    margin-bottom: 4px !important;
}

.welcome-btn small {
    display: block !important;
    font-size: 0.9rem !important;
    opacity: 0.8 !important;
    font-weight: 400 !important;
}

:root {
    --kco-sidebar: #0F172A;
    --kco-sidebar-hover: #1E293B;
    --kco-sidebar-active: #3b82f6;
    --kco-panel-bg: #FFFFFF;
    --kco-panel-border: #E5E7EB;
    --kco-canvas-bg: #64748b;
    --kco-text-dark: #1e293b;
    --kco-text-gray: #64748b;
    --kco-text-light: #94a3b8;
    --kco-blue: #0F172A;
    --kco-danger: #DC2626;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--kco-canvas-bg);
    height: 100vh;
    margin: 0;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Icon Sidebar */
.icon-sidebar {
    width: 60px;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
    border-right: 1px solid var(--kco-panel-border);
}

.sidebar-logo {
    padding: 8px;
    margin-bottom: 15px;
}

.sidebar-logo img {
    width: 32px;
    height: 32px;
}

.sidebar-btn {
    width: 44px;
    height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 8px;
    color: var(--kco-text-gray);
    transition: all 0.15s;
    margin-bottom: 4px;
}

.sidebar-btn:hover {
    background: #f1f5f9;
    color: var(--kco-sidebar);
}

.sidebar-btn.active {
    background: var(--kco-sidebar);
    color: white;
}

.sidebar-btn i {
    font-size: 16px;
}

.sidebar-btn span {
    font-size: 9px;
    margin-top: 2px;
}

/* Left Panel */
.left-panel {
    width: 280px;
    background: var(--kco-panel-bg);
    border-right: 1px solid var(--kco-panel-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.panel-section {
    padding: 15px;
    border-bottom: 1px solid var(--kco-panel-border);
}

/* Upload Zone */
.kco-upload-zone {
    padding: 20px 15px;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
}

.kco-upload-zone:hover,
.kco-upload-zone.dragover {
    border-color: var(--kco-sidebar-active);
    background: #eff6ff;
}

.kco-upload-zone p {
    color: var(--kco-text-gray);
    font-size: 12px;
    margin-bottom: 12px;
}

.upload-btn {
    background: var(--kco-sidebar);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.upload-btn:hover {
    background: var(--kco-sidebar-hover);
}

.upload-hint {
    color: var(--kco-text-light);
    font-size: 10px;
    margin-top: 10px;
    line-height: 1.4;
}

/* Upload Progress */
.upload-progress {
    margin: 10px 0;
    display: none;
}

.progress-bar {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--kco-sidebar-active);
    width: 0%;
    transition: width 0.2s;
}

.upload-status {
    font-size: 11px;
    color: var(--kco-text-gray);
    margin-top: 5px;
}

/* Thumbnail Grid */
.thumbnail-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    align-items: center;
}

.add-text-btn {
    width: 48px;
    height: 48px;
    border: 2px dashed #cbd5e1;
    background: #f8fafc;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--kco-text-gray);
    font-size: 16px;
    transition: all 0.15s;
}

.add-text-btn:hover {
    border-color: var(--kco-sidebar-active);
    color: var(--kco-sidebar-active);
}

.add-text-btn span {
    font-size: 8px;
    margin-top: 2px;
}

.thumbnail-item {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.15s;
}

.thumbnail-item:hover {
    border-color: var(--kco-sidebar-active);
}

.thumbnail-item.selected {
    border-color: var(--kco-sidebar-active);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-item .close-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: var(--kco-danger);
    border-radius: 50%;
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
    border: 2px solid white;
}

.thumbnail-item:hover .close-btn {
    opacity: 1;
}

/* Object Editor */
.editor-preview {
    width: 100%;
    min-height: 160px;
    background: #f1f5f9;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--kco-text-light);
    position: relative;
    overflow: hidden;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.preview-placeholder i {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.preview-placeholder span {
    font-size: 12px;
}

.selected-image-thumb {
    max-width: 100%;
    max-height: 150px;
    object-fit: contain;
    border-radius: 4px;
}

.powered-by {
    padding: 15px;
    text-align: center;
    font-size: 11px;
    color: var(--kco-text-light);
    margin-top: auto;
}

/* Tab Panels */
.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Settings Panel */
.settings-section {
    margin-bottom: 20px;
}

.settings-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--kco-text-dark);
    margin-bottom: 10px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}

.setting-row label {
    font-size: 11px;
    color: var(--kco-text-gray);
}

.setting-toggle {
    position: relative;
    width: 36px;
    height: 20px;
}

.setting-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.setting-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #cbd5e1;
    border-radius: 20px;
    transition: 0.2s;
}

.setting-toggle .slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.setting-toggle input:checked+.slider {
    background: #22c55e;
}

.setting-toggle input:checked+.slider:before {
    transform: translateX(16px);
}

.dpi-legend-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.dpi-legend-inline span {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 3px;
}

.dpi-optimal {
    background: #dcfce7;
    color: #166534;
}

.dpi-good {
    background: #fef9c3;
    color: #854d0e;
}

.dpi-bad {
    background: #fee2e2;
    color: #991b1b;
}

.dpi-terrible {
    background: #1e293b;
    color: white;
}

.canvas-color-picker {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
}

.color-swatch.active {
    border-color: var(--kco-sidebar-active);
}

.margin-input {
    width: 60px;
    padding: 4px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 11px;
}

/* Image Editor Panel */
.editor-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.editor-actions button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-remove-bg {
    background: #8b5cf6;
    color: white;
}

.btn-remove-bg:hover {
    background: #7c3aed;
}

.btn-upscale {
    background: #0ea5e9;
    color: white;
}

.btn-upscale:hover {
    background: #0284c7;
}

.btn-upscale.disabled {
    background: #94a3b8;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-upscale.disabled:hover {
    background: #94a3b8;
}

.editor-controls {
    margin-top: 15px;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.control-row label {
    font-size: 10px;
    color: var(--kco-text-gray);
    width: 50px;
}

.control-row input {
    flex: 1;
    padding: 6px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 11px;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 12px;
}

.quick-action {
    width: 32px;
    height: 32px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--kco-text-gray);
}

.quick-action:hover {
    background: #f8fafc;
    border-color: var(--kco-sidebar-active);
    color: var(--kco-sidebar-active);
}

/* Processing Overlay */
.processing-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 10;
    border-radius: 8px;
}

.processing-overlay.active {
    display: flex;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--kco-sidebar-active);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.processing-text {
    margin-top: 10px;
    font-size: 11px;
    color: var(--kco-text-gray);
}

/* Add Text Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 360px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--kco-text-dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--kco-text-gray);
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-field {
    margin-bottom: 16px;
}

.modal-field label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--kco-text-gray);
    margin-bottom: 6px;
}

.modal-field input,
.modal-field select,
.modal-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
}

.modal-field textarea {
    resize: none;
    height: 80px;
}

.font-size-row {
    display: flex;
    gap: 10px;
}

.font-size-row select {
    flex: 2;
}

.font-size-row input {
    flex: 1;
}

.style-buttons {
    display: flex;
    gap: 6px;
}

.style-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.style-btn:hover,
.style-btn.active {
    background: var(--kco-sidebar);
    color: white;
    border-color: var(--kco-sidebar);
}

.color-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-input {
    width: 40px;
    height: 36px;
    padding: 2px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: none;
}

.modal-btn-cancel {
    background: #f1f5f9;
    color: var(--kco-text-dark);
}

.modal-btn-confirm {
    background: var(--kco-sidebar);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top Bar */
.top-bar {
    height: 50px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--kco-panel-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 6px;
    background: white;
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.control-group label {
    font-size: 10px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.control-group select {
    padding: 3px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 11px;
    background: white;
    cursor: pointer;
}

/* UIVerse-style buttons */
.btn {
    padding: 6px 12px;
    background: var(--kco-sidebar);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.btn:hover {
    background: var(--kco-sidebar-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn.active {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}

.btn-action {
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--kco-sidebar);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 41, 59, 0.3);
}

.btn-cart {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
    font-weight: 700;
    letter-spacing: 0.2px;
}

.btn-cart:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
    filter: brightness(1.05);
}

.btn-cart:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.3);
}

.btn-save {
    background: #f1f5f9;
    color: var(--kco-text-dark);
    border: 1px solid #e2e8f0;
}

.btn-save:hover {
    background: #e2e8f0;
}

.btn-close-builder {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.btn-close-builder:hover {
    background: #fef2f2;
    color: #ef4444;
    border-color: #fecaca;
}

.btn-toolbar {
    padding: 5px 8px;
    background: #334155;
    color: #e2e8f0;
    border: 1px solid #475569;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.btn-toolbar:hover {
    background: #475569;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-toolbar:active {
    transform: translateY(0);
}

.btn-toolbar.accent-green {
    background: #166534;
    border-color: #22c55e;
}

.btn-toolbar.accent-green:hover {
    background: #22c55e;
}

.btn-toolbar.accent-purple {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border-color: #8b5cf6;
}

.btn-toolbar.accent-purple:hover {
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.4);
}

.btn-toolbar.accent-blue {
    background: #1d4ed8;
    border-color: #3b82f6;
}

.btn-toolbar.accent-blue:hover {
    background: #3b82f6;
}

.btn-toolbar.accent-indigo {
    background: #4338ca;
    border-color: #6366f1;
}

.btn-toolbar.accent-indigo:hover {
    background: #6366f1;
}

.btn-toolbar.accent-red {
    background: #991b1b;
    border-color: #dc2626;
}

.btn-toolbar.accent-red:hover {
    background: #dc2626;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: #475569;
    margin: 0 2px;
    flex-shrink: 0;
}

/* Auth button in top bar */
.btn-auth-login {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border-radius: 8px;
    font-size: 12px;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s ease;
    border: none;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

.btn-auth-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    filter: brightness(1.05);
    color: #fff;
    text-decoration: none;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.user-avatar:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Canvas Container - P60 Structure */
.canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    position: relative;
}

/* Horizontal Ruler Row */
.ruler-row {
    display: flex;
    height: 24px;
    flex-shrink: 0;
    background: #f8fafc;
}

.ruler-corner {
    width: 24px;
    height: 24px;
    background: #e2e8f0;
    border-right: 1px solid #cbd5e1;
    border-bottom: 1px solid #cbd5e1;
    flex-shrink: 0;
}

.ruler-h {
    flex: 1;
    background: #f8fafc;
    border-bottom: 1px solid #cbd5e1;
    position: relative;
    overflow: hidden;
}

.ruler-h-ticks {
    position: absolute;
    height: 100%;
    white-space: nowrap;
}

/* Canvas Row */
.canvas-row {
    flex: 1;
    display: flex;
    min-height: 0;
}

.ruler-v {
    width: 24px;
    background: #f8fafc;
    border-right: 1px solid #cbd5e1;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.ruler-v-ticks {
    position: absolute;
    width: 100%;
}

/* Scrollable Canvas Area - Light grey scrollbars for visibility */
.canvas-scroll {
    flex: 1;
    overflow: scroll;
    background: #64748b;
    position: relative;
    scrollbar-color: #d1d5db #374151;
    -webkit-overflow-scrolling: touch;
}

/* Mobile: move-mode glow on double-tapped objects */
.mobile-move-active .canvas-container {
    outline: 2px solid #22d3ee;
    outline-offset: 2px;
    border-radius: 4px;
}

.mobile-move-badge {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(34, 211, 238, 0.95);
    color: #0f172a;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(34, 211, 238, 0.4);
    pointer-events: none;
    animation: moveBadgePulse 1.5s ease infinite;
}

@keyframes moveBadgePulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: 0.7
    }
}

.canvas-scroll::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

.canvas-scroll::-webkit-scrollbar-track {
    background: #374151;
    border: 1px solid #4b5563;
}

.canvas-scroll::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border: 2px solid #374151;
    border-radius: 4px;
}

.canvas-scroll::-webkit-scrollbar-thumb:hover {
    background: #e5e7eb;
}

.canvas-scroll::-webkit-scrollbar-corner {
    background: #374151;
}

.canvas-scroll-inner {
    display: inline-block;
    padding: 300px 600px;
    background: #64748b;
}

.canvas-wrapper {
    background: white;
    display: inline-block;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Ruler Ticks */
.tick {
    position: absolute;
    box-sizing: border-box;
}

.tick.inch {
    background: transparent;
    font-size: 8px;
    font-weight: 600;
    color: #475569;
}

/* DPI Legend - Draggable */
.dpi-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(30, 41, 59, 0.95);
    color: #f1f5f9;
    padding: 12px;
    border-radius: 8px;
    font-size: 11px;
    cursor: move;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dpi-legend .label {
    color: #94a3b8;
}

.dpi-legend .value {
    font-weight: 600;
}

/* Overlap Warning */
.overlap-warning {
    display: none;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: #fef2f2;
    color: #dc2626;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #fecaca;
    z-index: 100;
}

/* Right Panel */
.right-panel {
    width: 260px;
    background: var(--kco-panel-bg);
    border-left: 1px solid var(--kco-panel-border);
    display: flex;
    flex-direction: row;
    position: relative;
    transition: width 0.3s ease, margin-right 0.3s ease;
    overflow: visible;
    /* Keep toggle visible */
}

.right-panel.collapsed {
    width: 24px;
    /* Width of toggle handle */
    min-width: 24px;
}

.right-panel.collapsed .right-panel-content {
    opacity: 0;
    pointer-events: none;
    width: 0;
    overflow: hidden;
}

.right-panel-toggle {
    position: absolute;
    left: -24px;
    top: 25%;
    transform: translateY(-50%);
    width: 24px;
    height: 60px;
    background: #1e293b;
    border-radius: 8px 0 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 14px;
    z-index: 10;
    transition: background 0.2s, left 0.3s;
}

.right-panel-toggle:hover {
    background: #334155;
}

.right-panel.collapsed .right-panel-toggle {
    left: 0;
    /* Move to visible area when collapsed */
}

.right-panel.collapsed #toggle-icon {
    transform: rotate(180deg);
}

.right-panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: opacity 0.2s;
}

.right-header {
    padding: 15px;
    border-bottom: 1px solid var(--kco-panel-border);
}

.right-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--kco-text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.gang-sheet-item {
    padding: 15px;
    border-bottom: 1px solid var(--kco-panel-border);
}

.gang-sheet-item.active {
    background: #f8fafc;
}

.sheet-info {
    font-size: 12px;
    font-weight: 500;
    color: var(--kco-text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sheet-name {
    font-size: 11px;
    color: var(--kco-text-gray);
    margin-top: 4px;
}

.sheet-stats {
    font-size: 10px;
    color: var(--kco-text-light);
    margin-top: 4px;
}

.sheet-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    font-size: 11px;
}

.sheet-controls input {
    width: 50px;
    padding: 4px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 11px;
}

.right-actions {
    padding: 15px;
}

.drawer-action {
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--kco-text-dark);
}

.drawer-action:hover {
    background: #f8fafc;
}

/* ===== EDIT IMAGE MODAL ===== */
.edit-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.edit-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.edit-modal {
    display: flex;
    width: 100%;
    height: 100%;
}

.edit-modal-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: var(--kco-sidebar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10001;
}

.edit-modal-header h2 {
    color: white;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 15px;
}

.edit-modal-header .back-btn,
.edit-modal-header .close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.edit-modal-header .back-btn:hover,
.edit-modal-header .close-btn:hover {
    opacity: 1;
}

.edit-modal-preview {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 70px 20px 20px 20px;
    background: #1a1a2e;
}

.edit-modal-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.edit-modal-sidebar {
    width: 280px;
    background: white;
    padding-top: 70px;
    display: flex;
    flex-direction: column;
}

.edit-sidebar-section {
    padding: 0;
}

.edit-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background 0.15s;
}

.edit-toggle-item:hover {
    background: #f8fafc;
}

.edit-toggle-item label {
    font-size: 14px;
    font-weight: 500;
    color: var(--kco-text-dark);
    cursor: pointer;
}

.edit-toggle-item .toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #e2e8f0;
    border-radius: 12px;
    transition: background 0.2s;
    cursor: pointer;
}

.edit-toggle-item .toggle-switch.active {
    background: #3b82f6;
}

.edit-toggle-item .toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.edit-toggle-item .toggle-switch.active::after {
    transform: translateX(20px);
}

.edit-modal-footer {
    margin-top: auto;
    padding: 20px;
}

.edit-modal-footer button {
    width: 100%;
    padding: 14px;
    background: var(--kco-sidebar);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.edit-modal-footer button:hover {
    background: #1e293b;
}

.edit-processing {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px 40px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
    z-index: 10002;
}

.edit-processing.active {
    display: flex;
    align-items: center;
    gap: 12px;
}

.edit-processing .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Thumbnail edit button */
.thumbnail-edit-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumbnail:hover .thumbnail-edit-btn {
    opacity: 1;
}

.thumbnail-edit-btn:hover {
    background: #3b82f6;
}

/* Mobile responsive for modal */
@media (max-width: 768px) {
    .edit-modal {
        flex-direction: column;
    }

    .edit-modal-sidebar {
        width: 100%;
        height: auto;
        padding-top: 20px;
        border-top: 1px solid #e5e7eb;
    }

    .edit-modal-preview {
        padding: 70px 10px 10px 10px;
    }
}

/* User Menu & Avatar Styles (Ported from builder.php) */
.user-menu-wrapper {
    position: relative;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: #06b6d4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.user-avatar:hover {
    opacity: 0.9;
}

.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 160px;
    z-index: 1000;
    margin-top: 8px;
}

.user-dropdown.active {
    display: block;
}

.user-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 500;
    color: #1e293b;
}

.user-dropdown a {
    display: block;
    padding: 10px 16px;
    color: #475569;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s;
}

.user-dropdown a:hover {
    background: #f1f5f9;
    color: #3b82f6;
}

.user-dropdown a.sign-out {
    color: #dc2626;
    border-top: 1px solid #e2e8f0;
}

.user-dropdown a.sign-out:hover {
    background: #fef2f2;
    color: #b91c1c;
}

/* Cart Confirm Modal */
.cart-confirm-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.cart-confirm-modal.active {
    display: flex;
}

.cart-confirm-content {
    background: white;
    width: 500px;
    max-width: 90%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.cart-confirm-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.cart-confirm-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
}

.cart-confirm-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #64748b;
    cursor: pointer;
}

.cart-confirm-field {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.cart-confirm-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}

.cart-confirm-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
}

.cart-confirm-checklist {
    padding: 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.cart-confirm-checklist h4 {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #334155;
}

.checklist-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
}

.checklist-icon.pass {
    background: #dcfce7;
    color: #166534;
}

.checklist-icon.fail {
    background: #fee2e2;
    color: #991b1b;
}

.cart-confirm-terms {
    padding: 16px 20px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 12px;
    color: #64748b;
    cursor: pointer;
}

.cart-confirm-terms input {
    margin-top: 2px;
}

.cart-confirm-actions {
    padding: 16px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.cart-confirm-btn {
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.cart-confirm-btn-secondary {
    background: white;
    border: 1px solid #cbd5e1;
    color: #475569;
}

.cart-confirm-btn-secondary:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.cart-confirm-btn-primary {
    background: #3b82f6;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-confirm-btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.cart-confirm-btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 🌑 INITIALIZATION BLACK SCREEN */
body.initializing {
    background-color: #0f172a !important;
    overflow: hidden;
}

body.initializing .app-container {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: none;
}

/* Welcome modal stays visible and interactive during init */
body.initializing #welcome-modal {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

body:not(.initializing) .app-container {
    opacity: 1;
    visibility: visible;
}

/* 🟣 PREMIUM WELCOME MODAL (UIVerse Style) */
#welcome-modal {
    background: #000000;
    z-index: 100000;
}

.welcome-card {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px;
    width: 700px;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    animation: modalPop 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from {
        transform: scale(0.95) translateY(10px);
        opacity: 0;
        filter: blur(10px);
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
        filter: blur(0);
    }
}

.welcome-header h1 {
    font-size: 32px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.welcome-header p {
    color: #94a3b8;
    font-size: 16px;
    margin-bottom: 40px;
}

.welcome-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 30px;
}

.welcome-option {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 20px 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
}

.welcome-option:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    border-left-color: #ffffff;
    border-left-width: 6px;
    transform: translateX(8px);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.option-icon {
    display: none !important;
}

.welcome-option:hover .option-icon {
    transform: scale(1.1) rotate(5deg);
}

/* Colorful accents */
/* Colorful accents REMOVED for B&W style */
.welcome-option.opt-new {}

.welcome-option.opt-new .option-icon {}

.welcome-option.opt-open {}

.welcome-option.opt-open .option-icon {}

.welcome-option.opt-auto {}

.welcome-option.opt-auto .option-icon {}

/* Disabled welcome option (e.g. not logged in) */
.welcome-option.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.welcome-option.disabled:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.08);
    border-left-width: 2px;
    background: rgba(255, 255, 255, 0.02);
    box-shadow: none;
}

.welcome-option h3 {
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 4px;
    z-index: 1;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.welcome-option p {
    color: #94a3b8;
    font-size: 14px;
    z-index: 1;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    text-transform: none;
    line-height: 1.5;
}

.welcome-footer {
    color: #64748b;
    font-size: 13px;
    margin-top: 20px;
    display: none !important;
}

.welcome-footer label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.welcome-footer input {
    accent-color: #64748b;
}

/* 🟢 Sage: Welcome Product Info Header */
.welcome-product-info {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 32px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.welcome-product-img {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.welcome-product-details {
    text-align: left;
    flex: 1;
}

.welcome-product-details h4 {
    color: #f8fafc;
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 4px 0;
    letter-spacing: -0.01em;
}

.welcome-product-details .welcome-size-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 6px;
    color: #a5b4fc;
    font-size: 12px;
    font-weight: 600;
}

.welcome-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 10px 0;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

.welcome-back-link:hover {
    color: #94a3b8;
}

.welcome-back-link i {
    font-size: 12px;
}

@media (max-width: 800px) {
    .welcome-grid {
        grid-template-columns: 1fr;
    }

    .welcome-card {
        padding: 24px;
    }

    .welcome-product-info {
        flex-direction: column;
        text-align: center;
    }

    .welcome-product-details {
        text-align: center;
    }
}

#designs-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.designs-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.designs-modal-card {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.designs-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.designs-modal-body {
    overflow-y: auto;
    padding: 16px;
    flex: 1;
}

.designs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.design-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s;
    cursor: pointer;
}

.design-card:hover {
    border-color: #8b5cf6;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
    transform: translateY(-2px);
}

.design-card-thumb {
    height: 100px;
    background: #f1f5f9;
    overflow: hidden;
}

.design-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.design-card-info {
    padding: 8px 10px 4px;
}

.design-card-name {
    font-weight: 600;
    font-size: 12px;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.design-card-meta {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 2px;
}

.design-card-actions {
    display: flex;
    border-top: 1px solid #f1f5f9;
}

.design-btn-load,
.design-btn-delete {
    flex: 1;
    border: none;
    padding: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.design-btn-load {
    background: #f0f9ff;
    color: #3b82f6;
}

.design-btn-load:hover {
    background: #dbeafe;
}

.design-btn-delete {
    background: #fef2f2;
    color: #ef4444;
}

.design-btn-delete:hover {
    background: #fee2e2;
}

/* ═══════════════════════════════════════════════════════════
       🟡 Willow — Previous Designs Modal (UIVerse Glassmorphism)
       Inspired by: Rare Fox Glass Card + Mighty Dog Window Card 
       ═══════════════════════════════════════════════════════════ */
.pd-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: pdFadeIn 0.2s ease;
}

@keyframes pdFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.pd-modal {
    background: #ffffff;
    border-radius: 16px;
    max-width: 960px;
    width: 92%;
    height: 82vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: pdSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

@keyframes pdSlideUp {
    from {
        transform: translateY(30px) scale(0.97);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Header — Dark gradient */
.pd-header {
    padding: 16px 24px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.pd-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pd-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.pd-header h2 {
    font-size: 17px;
    font-weight: 700;
    color: #f8fafc;
    margin: 0;
    letter-spacing: -0.01em;
}

.pd-count {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
}

.pd-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pd-search {
    position: relative;
    display: flex;
    align-items: center;
}

.pd-search i {
    position: absolute;
    left: 10px;
    color: #64748b;
    font-size: 12px;
    pointer-events: none;
}

.pd-search input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 8px 12px 8px 30px;
    font-size: 13px;
    color: #f1f5f9;
    width: 200px;
    transition: all 0.2s;
    outline: none;
}

.pd-search input::placeholder {
    color: #64748b;
}

.pd-search input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.pd-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #94a3b8;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pd-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Body */
.pd-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f8fafc;
}

.pd-body::-webkit-scrollbar {
    width: 6px;
}

.pd-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Auth Gate */
.pd-auth-gate {
    text-align: center;
    padding: 60px 20px;
}

.pd-auth-icon {
    font-size: 56px;
    color: #cbd5e1;
    margin-bottom: 20px;
}

.pd-auth-gate h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.pd-auth-gate p {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 24px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.pd-btn-login {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: all 0.2s;
}

.pd-btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

/* Grid */
.pd-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 20px;
}

.pd-loading {
    grid-column: 1/-1;
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.pd-loading i {
    font-size: 24px;
    color: #6366f1;
}

.pd-empty {
    grid-column: 1/-1;
    text-align: center;
    padding: 60px 20px;
}

.pd-empty-icon {
    font-size: 64px;
    color: #e2e8f0;
    margin-bottom: 16px;
}

.pd-empty h4 {
    color: #475569;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.pd-empty p {
    color: #94a3b8;
    font-size: 13px;
}

/* Design Card — Mighty Dog Window Style */
.design-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    position: relative;
}

.design-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    border-color: #a5b4fc;
}

.design-card:hover .design-thumb {
    background: #f0f0ff;
}

/* Thumbnail — Inset depth effect */
.design-thumb {
    height: 150px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.06);
    transition: background 0.3s;
}

.design-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.design-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(15, 23, 42, 0.75);
    color: #f8fafc;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Info */
.design-info {
    padding: 14px;
    border-top: 1px solid #f1f5f9;
}

.design-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.design-meta {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* Actions */
.design-actions {
    display: flex;
    gap: 6px;
}

.btn-card {
    flex: 1;
    padding: 7px 6px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.btn-card:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-card.primary {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.btn-card.primary:hover {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

.btn-card.danger {
    color: #ef4444;
}

.btn-card.danger:hover {
    background: #fef2f2;
    border-color: #fecaca;
}

/* Tabs */
.pd-tabs {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.pd-tab {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 0;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.pd-tab:hover {
    color: #cbd5e1;
}

.pd-tab.active {
    color: #6366f1;
}

.pd-tab.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #6366f1;
    border-radius: 2px;
}

@media (max-width:640px) {
    .pd-modal {
        width: 96%;
        height: 90vh;
        border-radius: 12px;
    }

    .pd-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .pd-search input {
        width: 100%;
    }

    .pd-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .design-thumb {
        height: 110px;
    }
}


/* Extracted CSS from builder_js_repair */

#designs-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.designs-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.designs-modal-card {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.designs-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.designs-modal-body {
    overflow-y: auto;
    padding: 16px;
    flex: 1;
}

.designs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.design-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s;
    cursor: pointer;
}

.design-card:hover {
    border-color: #8b5cf6;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
    transform: translateY(-2px);
}

.design-card-thumb {
    height: 100px;
    background: #f1f5f9;
    overflow: hidden;
}

.design-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.design-card-info {
    padding: 8px 10px 4px;
}

.design-card-name {
    font-weight: 600;
    font-size: 12px;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.design-card-meta {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 2px;
}

.design-card-actions {
    display: flex;
    border-top: 1px solid #f1f5f9;
}

.design-btn-load,
.design-btn-delete {
    flex: 1;
    border: none;
    padding: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.design-btn-load {
    background: #f0f9ff;
    color: #3b82f6;
}

.design-btn-load:hover {
    background: #dbeafe;
}

.design-btn-delete {
    background: #fef2f2;
    color: #ef4444;
}

.design-btn-delete:hover {
    background: #fee2e2;
}


/* ═══════════════════════════════════════════════════════════
       🟡 Willow — Previous Designs Modal (UIVerse Glassmorphism)
       Inspired by: Rare Fox Glass Card + Mighty Dog Window Card 
       ═══════════════════════════════════════════════════════════ */
.pd-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: pdFadeIn 0.2s ease;
}

@keyframes pdFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.pd-modal {
    background: #ffffff;
    border-radius: 16px;
    max-width: 960px;
    width: 92%;
    height: 82vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: pdSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

@keyframes pdSlideUp {
    from {
        transform: translateY(30px) scale(0.97);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Header — Dark gradient */
.pd-header {
    padding: 16px 24px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.pd-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pd-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.pd-header h2 {
    font-size: 17px;
    font-weight: 700;
    color: #f8fafc;
    margin: 0;
    letter-spacing: -0.01em;
}

.pd-count {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
}

.pd-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pd-search {
    position: relative;
    display: flex;
    align-items: center;
}

.pd-search i {
    position: absolute;
    left: 10px;
    color: #64748b;
    font-size: 12px;
    pointer-events: none;
}

.pd-search input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 8px 12px 8px 30px;
    font-size: 13px;
    color: #f1f5f9;
    width: 200px;
    transition: all 0.2s;
    outline: none;
}

.pd-search input::placeholder {
    color: #64748b;
}

.pd-search input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.pd-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #94a3b8;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pd-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Body */
.pd-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f8fafc;
}

.pd-body::-webkit-scrollbar {
    width: 6px;
}

.pd-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Auth Gate */
.pd-auth-gate {
    text-align: center;
    padding: 60px 20px;
}

.pd-auth-icon {
    font-size: 56px;
    color: #cbd5e1;
    margin-bottom: 20px;
}

.pd-auth-gate h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.pd-auth-gate p {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 24px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.pd-btn-login {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: all 0.2s;
}

.pd-btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

/* Grid */
.pd-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 20px;
}

.pd-loading {
    grid-column: 1/-1;
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.pd-loading i {
    font-size: 24px;
    color: #6366f1;
}

.pd-empty {
    grid-column: 1/-1;
    text-align: center;
    padding: 60px 20px;
}

.pd-empty-icon {
    font-size: 64px;
    color: #e2e8f0;
    margin-bottom: 16px;
}

.pd-empty h4 {
    color: #475569;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.pd-empty p {
    color: #94a3b8;
    font-size: 13px;
}

/* Design Card — Mighty Dog Window Style */
.design-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    position: relative;
}

.design-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    border-color: #a5b4fc;
}

.design-card:hover .design-thumb {
    background: #f0f0ff;
}

/* Thumbnail — Inset depth effect */
.design-thumb {
    height: 150px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.06);
    transition: background 0.3s;
}

.design-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.design-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(15, 23, 42, 0.75);
    color: #f8fafc;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Info */
.design-info {
    padding: 14px;
    border-top: 1px solid #f1f5f9;
}

.design-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.design-meta {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* Actions */
.design-actions {
    display: flex;
    gap: 6px;
}

.btn-card {
    flex: 1;
    padding: 7px 6px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.btn-card:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-card.primary {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.btn-card.primary:hover {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

.btn-card.danger {
    color: #ef4444;
}

.btn-card.danger:hover {
    background: #fef2f2;
    border-color: #fecaca;
}

/* Tabs */
.pd-tabs {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.pd-tab {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 0;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.pd-tab:hover {
    color: #cbd5e1;
}

.pd-tab.active {
    color: #6366f1;
}

.pd-tab.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #6366f1;
    border-radius: 2px;
}

@media (max-width:640px) {
    .pd-modal {
        width: 96%;
        height: 90vh;
        border-radius: 12px;
    }

    .pd-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .pd-search input {
        width: 100%;
    }

    .pd-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .design-thumb {
        height: 110px;
    }
}