* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.controls {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    align-items: center;
}

.control-group {
    display: flex;
    flex-direction: row;
    gap: 5px;
    align-items: center;
}

.control-group label {
    font-weight: 600;
    color: #555;
}

.control-group input,
.control-group select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.scenario-controls {
    display: flex;
    gap: 5px;
    align-items: center;
}

.scenario-controls select {
    flex: 1;
    min-width: 200px;
}

.scenario-controls button {
    padding: 8px 12px;
    font-size: 14px;
    min-width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: #667eea;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.swim-lane-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.swim-lane-container h2 {
    margin-bottom: 20px;
    color: #333;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.swim-lane {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 400px;
    position: relative;
}

.department {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    position: relative;
}

.department-header {
    font-weight: bold;
    font-size: 1.1rem;
    color: #495057;
    margin-bottom: 15px;
    padding: 10px;
    background: #fff;
    border-radius: 5px;
    border-left: 4px solid #667eea;
}

.department-steps {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.process-step {
    background: #fff;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    min-width: 200px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.process-step:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.step-title {
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.step-cost {
    color: #28a745;
    font-weight: 600;
    font-size: 0.9rem;
}

.step-duration {
    color: #6c757d;
    font-size: 0.8rem;
    margin-top: 5px;
}

.step-arrow {
    color: #667eea;
    font-size: 1.5rem;
    align-self: center;
}

.cost-analysis {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cost-summary h3 {
    margin-bottom: 20px;
    color: #333;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.cost-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.cost-card h4 {
    font-size: 0.9rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.cost-card span {
    font-size: 1.8rem;
    font-weight: bold;
}

.charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.chart-wrapper {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.chart-wrapper h3 {
    margin-bottom: 15px;
    color: #495057;
    text-align: center;
}

.chart-wrapper canvas {
    max-height: 300px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.chart-toggle {
    display: flex;
    gap: 15px;
}

.chart-toggle label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    cursor: pointer;
}

.chart-toggle input[type="radio"] {
    margin: 0;
}

.scenario-comparison {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.scenario-comparison h3 {
    margin-bottom: 20px;
    color: #333;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.comparison-table {
    overflow-x: auto;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.comparison-table th,
.comparison-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.comparison-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.comparison-table tr:hover {
    background: #f8f9fa;
}

.process-editor,
.scenario-editor,
.product-editor,
.capital-cost-editor {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.process-editor h3,
.scenario-editor h3,
.product-editor h3,
.capital-cost-editor h3 {
    margin-bottom: 20px;
    color: #333;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.form-buttons button {
    padding: 10px 20px;
}

#deleteStep {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

#cancelEdit {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

@media (max-width: 768px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .department-steps {
        flex-direction: column;
        align-items: stretch;
    }
    
    .step-arrow {
        transform: rotate(90deg);
    }
}

.positive-change {
    color: #28a745;
    font-weight: bold;
}

.negative-change {
    color: #dc3545;
    font-weight: bold;
}

.neutral-change {
    color: #6c757d;
    font-weight: bold;
}

/* Product Yield Section */
.product-yield-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.product-yield-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.product-yield-header h4 {
    margin: 0;
    color: #333;
}

.product-yield-table {
    overflow-x: auto;
    margin-bottom: 15px;
}

.product-yield-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.product-yield-table th,
.product-yield-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.product-yield-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.product-yield-table tr:hover {
    background: #f8f9fa;
}

.product-yield-table .total-row {
    background: #e9ecef;
    border-top: 2px solid #667eea;
}

.product-yield-table .total-row:hover {
    background: #e9ecef;
}

.product-yield-table input {
    width: 80px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.product-yield-table input:focus {
    outline: none;
    border-color: #667eea;
}

.yield-status {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    border-radius: 5px;
    font-weight: 600;
}

.yield-indicator {
    padding: 5px 15px;
    border-radius: 20px;
    color: white;
    transition: all 0.3s;
}

.yield-indicator.valid {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.yield-indicator.warning {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
}

.yield-indicator.invalid {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.yield-warning {
    background: #fff3cd;
    color: #856404;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ffeaa7;
    margin-bottom: 15px;
}

.yield-warning p {
    margin: 0;
    font-size: 14px;
}

.product-actions {
    display: flex;
    gap: 5px;
}

.product-actions button {
    padding: 4px 8px;
    font-size: 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-product {
    background: #007bff;
    color: white;
}

.edit-product:hover {
    background: #0056b3;
}

.delete-product {
    background: #dc3545;
    color: white;
}

.delete-product:hover {
    background: #c82333;
}

/* Capital Costs Section */
.capital-costs-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.capital-costs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.capital-costs-header h4 {
    margin: 0;
    color: #333;
}

.capital-costs-table {
    overflow-x: auto;
    margin-bottom: 15px;
}

.capital-costs-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.capital-costs-table th,
.capital-costs-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.capital-costs-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.capital-costs-table tr:hover {
    background: #f8f9fa;
}

.capital-costs-table .total-row {
    background: #e9ecef;
    border-top: 2px solid #667eea;
}

.capital-costs-table .total-row:hover {
    background: #e9ecef;
}

.capital-costs-table input {
    width: 100px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.capital-costs-table input:focus {
    outline: none;
    border-color: #667eea;
}