/* ============================================
   LEAN TOOLS - Инструменты Lean
   ============================================ */

.lean-tools-section {
    padding: 12px 20px 20px;
}

/* Sub-tabs navigation */
.lean-tools-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    padding: 6px;
    background: #f8fafc;
    border-radius: 12px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.lean-tool-tab {
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.lean-tool-tab:hover {
    background: #e2e8f0;
    color: #334155;
}

.lean-tool-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Tool content area */
.lean-tool-content {
    min-height: 400px;
}

/* ============================================
   ISHIKAWA DIAGRAM (Fishbone/Cause-Effect)
   ============================================ */

.ishikawa-container {
    padding: 20px;
}

.ishikawa-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.ishikawa-header h2 {
    margin: 0;
    font-size: 24px;
    color: #1e293b;
}

.ishikawa-actions {
    display: flex;
    gap: 12px;
}

/* Diagrams list */
.ishikawa-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.ishikawa-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ishikawa-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.ishikawa-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.ishikawa-card-problem {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ishikawa-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #94a3b8;
}

/* Ishikawa diagram canvas */
.ishikawa-diagram {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    min-height: 500px;
}

.ishikawa-problem-input {
    text-align: center;
    margin-bottom: 24px;
}

.ishikawa-problem-input input {
    width: 100%;
    max-width: 500px;
    padding: 16px 20px;
    font-size: 18px;
    font-weight: 600;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    text-align: center;
    transition: border-color 0.2s;
}

.ishikawa-problem-input input:focus {
    outline: none;
    border-color: #667eea;
}

/* Categories (6M) */
.ishikawa-categories {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 24px;
}

@media (max-width: 768px) {
    .ishikawa-categories {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .ishikawa-categories {
        grid-template-columns: 1fr;
    }
}

.ishikawa-category {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
}

.ishikawa-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ishikawa-category-title {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ishikawa-category-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.ishikawa-add-cause {
    background: transparent;
    border: none;
    color: #667eea;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.ishikawa-add-cause:hover {
    background: #eef2ff;
}

.ishikawa-causes-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ishikawa-cause {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    color: #475569;
}

.ishikawa-cause input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13px;
    color: #475569;
}

.ishikawa-cause input:focus {
    outline: none;
}

.ishikawa-cause-delete {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 2px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.ishikawa-cause-delete:hover {
    opacity: 1;
}

/* Category colors */
.category-man .ishikawa-category-color { background: #3b82f6; }
.category-machine .ishikawa-category-color { background: #8b5cf6; }
.category-material .ishikawa-category-color { background: #f59e0b; }
.category-method .ishikawa-category-color { background: #10b981; }
.category-measurement .ishikawa-category-color { background: #ec4899; }
.category-environment .ishikawa-category-color { background: #6366f1; }

/* ============================================
   5 WHY ANALYSIS
   ============================================ */

.five-why-container {
    padding: 20px;
}

.five-why-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.five-why-header h2 {
    margin: 0;
    font-size: 24px;
    color: #1e293b;
}

/* 5 Why list */
.five-why-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.five-why-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.five-why-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

/* 5 Why analysis editor */
.five-why-editor {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
}

.five-why-problem {
    margin-bottom: 32px;
}

.five-why-problem label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
}

.five-why-problem textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s;
}

.five-why-problem textarea:focus {
    outline: none;
    border-color: #667eea;
}

.five-why-chain {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.five-why-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.five-why-number {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.five-why-step-content {
    flex: 1;
}

.five-why-step-content label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 6px;
}

.five-why-step-content input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.five-why-step-content input:focus {
    outline: none;
    border-color: #667eea;
}

.five-why-arrow {
    text-align: center;
    color: #94a3b8;
    font-size: 20px;
    margin: 8px 0;
    padding-left: 56px;
}

.five-why-root-cause {
    margin-top: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #dcfce7 0%, #d1fae5 100%);
    border: 2px solid #10b981;
    border-radius: 12px;
}

.five-why-root-cause h4 {
    margin: 0 0 8px 0;
    color: #047857;
    font-size: 14px;
}

.five-why-root-cause p {
    margin: 0;
    color: #065f46;
    font-size: 16px;
    font-weight: 500;
}

/* ============================================
   VALUE STREAM MAPPING (VSM)
   ============================================ */

.vsm-container {
    padding: 20px;
}

.vsm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.vsm-header h2 {
    margin: 0;
    font-size: 24px;
    color: #1e293b;
}

/* VSM list */
.vsm-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.vsm-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vsm-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

/* VSM Editor */
.vsm-editor {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
}

.vsm-process-flow {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    overflow-x: auto;
    padding: 20px 0;
}

.vsm-process-step {
    min-width: 200px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    flex-shrink: 0;
}

.vsm-process-step.supplier {
    background: #dbeafe;
    border-color: #3b82f6;
}

.vsm-process-step.customer {
    background: #dcfce7;
    border-color: #10b981;
}

.vsm-process-step.process {
    background: #fef3c7;
    border-color: #f59e0b;
}

/* Step type border-top colour coding (Toyota 7 wastes) */
.vsm-process-step[data-stype="value"]      { border-top: 4px solid #22c55e; }
.vsm-process-step[data-stype="transport"]  { border-top: 4px solid #f59e0b; }
.vsm-process-step[data-stype="inspection"] { border-top: 4px solid #d97706; }
.vsm-process-step[data-stype="storage"]    { border-top: 4px solid #ef4444; }

.vsm-step-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.vsm-step-type-badge.value      { background:#dcfce7; color:#16a34a; }
.vsm-step-type-badge.transport  { background:#fef3c7; color:#b45309; }
.vsm-step-type-badge.inspection { background:#fef9c3; color:#92400e; }
.vsm-step-type-badge.storage    { background:#fee2e2; color:#b91c1c; }

/* Kaizen burst button */
.vsm-kaizen-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    transition: transform .15s;
    flex-shrink: 0;
}
.vsm-kaizen-btn:hover { transform: scale(1.2); }

/* Kaizen issue pill on step */
.vsm-issue-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff1f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    color: #991b1b;
    margin-top: 4px;
    cursor: pointer;
}
.vsm-issue-pill:hover { background: #ffe4e6; }

/* map_type toggle pill */
.vsm-maptype-toggle {
    display: inline-flex;
    background: #f1f5f9;
    border-radius: 20px;
    padding: 2px;
    gap: 2px;
}
.vsm-maptype-btn {
    padding: 4px 14px;
    border: none;
    border-radius: 18px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s;
    background: transparent;
    color: #64748b;
}
.vsm-maptype-btn.active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.vsm-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.vsm-step-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
}

.vsm-step-metrics {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vsm-metric {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.vsm-metric-label {
    color: #64748b;
}

.vsm-metric-value {
    font-weight: 600;
    color: #334155;
}

.vsm-arrow {
    display: flex;
    align-items: center;
    color: #94a3b8;
    font-size: 24px;
    padding-top: 40px;
}

.vsm-add-step {
    min-width: 100px;
    height: 120px;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #94a3b8;
    font-size: 32px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.vsm-add-step:hover {
    border-color: #667eea;
    color: #667eea;
    background: #eef2ff;
}

/* VSM Timeline */
.vsm-timeline {
    margin-top: 24px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
}

.vsm-timeline-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.vsm-timeline-metric {
    text-align: center;
}

.vsm-timeline-metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

.vsm-timeline-metric-label {
    font-size: 12px;
    color: #64748b;
}

.vsm-timeline-metric.highlight .vsm-timeline-metric-value {
    color: #667eea;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.lean-tool-empty {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.lean-tool-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.lean-tool-empty h3 {
    margin: 0 0 8px 0;
    color: #334155;
    font-size: 18px;
}

.lean-tool-empty p {
    margin: 0 0 24px 0;
    font-size: 14px;
}

/* ============================================
   MODALS FOR LEAN TOOLS
   ============================================ */

.lean-tool-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.lean-tool-modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
}

.lean-tool-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.lean-tool-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #1e293b;
}

.lean-tool-modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
}

.lean-tool-modal-close:hover {
    color: #1e293b;
}

.lean-tool-modal-body {
    padding: 24px;
}

.lean-tool-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    position: sticky;
    bottom: 0;
    background: white;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
    .lean-tools-tabs {
        gap: 4px;
        padding: 4px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .lean-tools-tabs::-webkit-scrollbar {
        display: none;
    }

    .lean-tool-tab {
        padding: 10px 14px;
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .lean-tools-section {
        padding: 12px;
    }

    .ishikawa-header,
    .five-why-header,
    .vsm-header {
        flex-direction: column;
        align-items: stretch;
    }

    .ishikawa-actions {
        justify-content: center;
    }
}


/* ============================================
   AI VISION ANALYSIS — Phase 13.2
   ============================================ */

.ai-vision-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    vertical-align: middle;
    margin-left: 6px;
}

.ai-vision-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.ai-vision-btn:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

/* Modal overlay */
.ai-vision-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: aiVisionFadeIn 0.2s ease;
}

@keyframes aiVisionFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ai-vision-modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.ai-vision-modal-header {
    padding: 14px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    flex-shrink: 0;
}

.ai-vision-provider {
    font-size: 10px;
    background: rgba(255,255,255,0.25);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
}

.ai-vision-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.8;
}

.ai-vision-modal-close:hover { opacity: 1; }

.ai-vision-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.ai-vision-photo {
    width: 100%;
    border-radius: 10px;
    margin-bottom: 16px;
    cursor: pointer;
    transition: transform 0.2s;
}

.ai-vision-photo:hover { transform: scale(1.02); }

/* Results content */
.ai-vision-desc {
    font-size: 14px;
    color: #1d1d1f;
    line-height: 1.5;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.ai-vision-overall {
    text-align: center;
    font-size: 16px;
    margin-bottom: 12px;
    color: #374151;
}

/* Score bars */
.ai-vision-scores {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.ai-vision-score-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-vision-score-label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    min-width: 130px;
    flex-shrink: 0;
}

.ai-vision-bar-bg {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.ai-vision-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.ai-vision-score-val {
    font-size: 12px;
    font-weight: 700;
    color: #1d1d1f;
    min-width: 30px;
    text-align: right;
}

/* Badges */
.ai-vision-severity,
.ai-vision-condition {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    color: white;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 12px;
}

.ai-vision-anomaly-badge {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.ai-vision-category {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 12px;
    padding: 4px 10px;
    background: #f3f4f6;
    border-radius: 6px;
    display: inline-block;
}

/* Sections */
.ai-vision-section {
    margin-bottom: 12px;
}

.ai-vision-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 6px;
}

.ai-vision-list {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    color: #4b5563;
    line-height: 1.6;
}

.ai-vision-list li {
    margin-bottom: 2px;
}

/* Gemba waste items */
.ai-vision-waste-item {
    display: flex;
    gap: 8px;
    padding: 6px 10px;
    background: #fefce8;
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 13px;
}

.ai-vision-waste-type {
    font-weight: 700;
    color: #92400e;
    white-space: nowrap;
    min-width: 100px;
}

.ai-vision-apply-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.ai-vision-apply-btn:hover { opacity: 0.88; }

/* Mobile responsive */
@media (max-width: 600px) {
    .ai-vision-modal {
        max-width: 100%;
        max-height: 90vh;
        border-radius: 12px;
    }

    .ai-vision-score-label {
        min-width: 90px;
        font-size: 11px;
    }

    .ai-vision-btn {
        padding: 3px 8px;
        font-size: 10px;
    }
}

/* ── 3M Resource chips in VSM step editor ── */
.vsm-resources-section { background: #f8fafc; border-radius: 6px; padding: 8px 10px; }
.vsm-res-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all .15s;
    user-select: none;
}
.vsm-res-chip:hover { border-color: #94a3b8; background: #f1f5f9; }
.vsm-res-chip--active {
    background: #ede9fe;
    border-color: #8b5cf6;
    color: #6d28d9;
    font-weight: 600;
}

/* ── VSM Compact Cards ─────────────────────────────────── */
.vsm-process-step.vsm-compact {
    min-width: 160px;
    max-width: 175px;
    cursor: pointer;
    transition: box-shadow .15s, transform .1s;
    padding: 10px 10px 8px;
    position: relative;
}
.vsm-process-step.vsm-compact:hover {
    box-shadow: 0 4px 16px rgba(102,126,234,.25);
    transform: translateY(-2px);
}
.vsm-compact__header { display:flex; align-items:center; justify-content:space-between; margin-bottom:4px; }
.vsm-compact__name { font-weight:700; font-size:12px; color:#1e293b; line-height:1.3; margin-bottom:5px; }
.vsm-compact__metrics { display:flex; flex-wrap:wrap; gap:4px; margin-bottom:5px; }
.vsm-compact__metrics span { font-size:10px; color:#64748b; background:#f1f5f9; padding:1px 5px; border-radius:3px; }
.vsm-compact__metrics b { color:#334155; }
.vsm-compact__badges { display:flex; flex-wrap:wrap; gap:3px; }
.vsm-mini-badge { font-size:10px; padding:1px 5px; border-radius:10px; font-weight:600; }
.vsm-mini-badge.eq  { background:#dbeafe; color:#1d4ed8; }
.vsm-mini-badge.mat { background:#dcfce7; color:#15803d; }
.vsm-mini-badge.op  { background:#fef3c7; color:#92400e; }
.vsm-mini-badge.mrp { background:#ede9fe; color:#6d28d9; }
.vsm-mini-badge.issue { background:#fee2e2; color:#dc2626; }
.vsm-compact__del {
    background:none; border:none; color:#ef4444; cursor:pointer;
    font-size:14px; line-height:1; padding:0; flex-shrink:0;
}
/* Supplier/Customer/Inventory compact */
.vsm-process-step.vsm-compact.supplier,
.vsm-process-step.vsm-compact.customer,
.vsm-process-step.vsm-compact.inventory { min-width:130px; max-width:145px; }
.vsm-compact__title-input {
    border:none; background:transparent; font-weight:700; font-size:12px;
    color:#1e293b; width:100%; min-width:0; outline:none;
}
.vsm-compact__title-input:focus { border-bottom:1px solid #667eea; }
.vsm-compact__details { font-size:10px; color:#64748b; margin-top:4px; line-height:1.3; }

/* ── VSM Step Edit Modal ────────────────────────────────── */
.vsm-step-modal-overlay {
    position:fixed; inset:0; background:rgba(15,23,42,.55);
    z-index:9000; display:flex; align-items:center; justify-content:center;
    padding:16px;
}
.vsm-step-modal {
    background:#fff; border-radius:16px;
    width:100%; max-width:620px; max-height:90vh;
    display:flex; flex-direction:column;
    box-shadow: 0 20px 60px rgba(15,23,42,.4);
}
.vsm-step-modal__head {
    padding:18px 24px 14px; border-bottom:1px solid #e2e8f0;
    display:flex; align-items:center; justify-content:space-between; flex-shrink:0;
}
.vsm-step-modal__head h3 { margin:0; font-size:16px; color:#1e293b; }
.vsm-step-modal__close {
    background:none; border:none; font-size:22px; cursor:pointer; color:#94a3b8;
    line-height:1; padding:0;
}
.vsm-step-modal__body { padding:20px 24px; overflow-y:auto; flex:1; }
.vsm-step-modal__foot {
    padding:14px 24px; border-top:1px solid #e2e8f0;
    display:flex; justify-content:flex-end; gap:10px; flex-shrink:0;
}
.vsm-modal-section { margin-bottom:18px; }
.vsm-modal-section h4 { font-size:12px; font-weight:700; color:#64748b; letter-spacing:.5px; text-transform:uppercase; margin:0 0 10px; }
.vsm-modal-label { font-size:12px; color:#475569; margin-bottom:4px; display:block; }
.vsm-modal-input {
    width:100%; padding:8px 12px; border:1px solid #e2e8f0; border-radius:8px;
    font-size:13px; color:#1e293b; box-sizing:border-box;
}
.vsm-modal-input:focus { outline:none; border-color:#667eea; }
.vsm-modal-select { appearance:none; background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center; padding-right:32px; }
.vsm-modal-metrics-grid {
    display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px;
}
.vsm-modal-metric { }
.vsm-modal-metric input { padding:6px 8px; border:1px solid #e2e8f0; border-radius:6px; font-size:13px; width:100%; box-sizing:border-box; text-align:right; }
.vsm-modal-metric input:focus { outline:none; border-color:#667eea; }
.vsm-modal-metric label { font-size:11px; color:#94a3b8; display:block; margin-bottom:3px; }
.vsm-modal-chips { display:flex; flex-wrap:wrap; gap:5px; }
.vsm-modal-bom-tag { font-size:11px; background:#ede9fe; color:#6d28d9; border:1px solid #c4b5fd; border-radius:10px; padding:2px 8px; }
.vsm-modal-issue-row { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.vsm-modal-issue-text { flex:1; font-size:12px; color:#334155; background:#fef2f2; border:1px solid #fecaca; border-radius:6px; padding:5px 8px; }
.vsm-modal-issue-del { background:none; border:none; color:#ef4444; cursor:pointer; font-size:14px; }
.vsm-modal-add-issue { display:flex; gap:8px; margin-top:6px; }
.vsm-modal-add-issue input { flex:1; padding:6px 10px; border:1px solid #e2e8f0; border-radius:6px; font-size:12px; }
