:root {
    --bg-color: #0f1714;
    --card-bg: rgba(20, 35, 28, 0.6);
    --card-border: rgba(52, 211, 153, 0.2);
    --text-primary: #f0fdf4;
    --text-secondary: #a7f3d0;
    
    --primary-color: #10b981;
    --primary-hover: #059669;
    --accent-color: #34d399;
    
    --stage-created: #3b82f6; /* Blue for created */
    --stage-scheduled: #f59e0b; /* Orange for scheduled */
    --stage-executed: #8b5cf6; /* Purple for executed */
    --stage-completed: #10b981; /* Green for completed */
    --stage-approved: #0ea5e9; /* Light blue for approved */
    --stage-invoiced: #ec4899; /* Pink for invoiced */
    
    --font-main: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(16, 185, 129, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(52, 211, 153, 0.05) 0%, transparent 50%);
}

.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary-color);
}

.logo h1 {
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(16, 185, 129, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary-color);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Global Card & Glassmorphism */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--card-border);
    padding: 1.5rem;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Top Pipeline Visualization */
.pipeline-section {
    margin-bottom: 2rem;
}

.pipeline-container {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 1rem;
    position: relative;
    padding: 1rem 0;
    overflow-x: auto;
}

/* Connecting Line */
.pipeline-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 4%;
    right: 4%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    z-index: 0;
    transform: translateY(-50%);
    border-radius: 2px;
}

.pipeline-stage {
    flex: 1;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 1;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.pipeline-stage:hover {
    transform: translateY(-5px);
    filter: brightness(1.2);
}

.pipeline-stage.active {
    transform: translateY(-8px);
}

.pipeline-stage.active .stage-icon-container {
    box-shadow: 0 0 25px 0px var(--stage-color, var(--primary-color));
    border-width: 4px;
    background: rgba(255, 255, 255, 0.05);
}

.stage-icon-container {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--bg-color);
    border: 3px solid var(--stage-color, var(--primary-color));
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    box-shadow: 0 0 20px -5px var(--stage-color, var(--primary-color));
    position: relative;
}

.stage-count {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stage-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Bottom Details Section */
.details-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    position: relative;
    min-height: 200px;
}

.placeholder-message {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--text-secondary);
    font-size: 1.25rem;
    font-weight: 500;
    text-align: center;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px dashed var(--card-border);
    opacity: 0.7;
}

@media (max-width: 1024px) {
    .details-section {
        grid-template-columns: 1fr;
    }
}

.full-width {
    grid-column: 1 / -1;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.pane-header .section-title {
    margin-bottom: 0;
}

.badge {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-color);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Tables */
.table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 500px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Custom Scrollbar for tables */
.table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.table-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
.table-container::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.3);
    border-radius: 4px;
}
.table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 185, 129, 0.5);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    white-space: nowrap;
}

thead th {
    background: rgba(20, 35, 28, 0.9);
    padding: 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

tbody td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: #cbd5e1;
}

tbody tr {
    transition: background-color 0.15s ease;
}

tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.task-type-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.type-labour { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.type-equipment { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.type-storage { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.type-other { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }

.detail-line {
    display: block;
    font-size: 0.8rem;
    color: #94a3b8;
}
.detail-line strong {
    color: #e2e8f0;
    font-weight: 500;
}

.loading {
    text-align: center;
    width: 100%;
    color: var(--accent-color);
    font-style: italic;
    animation: pulse 2s infinite;
}
