with open('app/modules/sag/templates/detail.html', 'r', encoding='utf-8') as f:
    text = f.read()

css_start = text.find('<style>')
if css_start != -1:
    css_new = '''<style>
        .time-v1-calendar-container {
            background: var(--bg-surface, #fff);
            border: 1px solid var(--border-color, #e0e0e0);
            border-radius: 12px;
            margin-bottom: 2rem;
            overflow: hidden;
            box-shadow: 0 4px 12px rgba(0,0,0,0.03);
        }
        .time-v1-calendar-header {
            background: var(--bg-element, #f8f9fa);
            border-bottom: 1px solid var(--border-color, #e0e0e0);
            padding: 12px 20px;
            font-weight: 600;
            font-size: 1rem;
            display: flex;
            align-items: center;
            gap: 8px;
            color: var(--text-color);
        }
        .time-v1-calendar-grid {
            display: flex;
            position: relative;
            overflow-x: auto;
        }
        .time-v1-time-axis {
            width: 60px;
            flex-shrink: 0;
            border-right: 1px solid var(--border-color, #f0f0f0);
            position: relative;
            background: var(--bg-element, #fafafa);
            padding-top: 40px; 
        }
        .time-v1-hour-marker {
            position: absolute;
            width: 100%;
            text-align: center;
            font-size: 0.75rem;
            color: var(--text-secondary);
            transform: translateY(-50%);
        }
        .time-v1-tech-col {
            flex: 1;
            min-width: 250px;
            border-right: 1px solid var(--border-color, #f0f0f0);
            position: relative;
        }
        .time-v1-tech-col:last-child {
            border-right: none;
        }
        .time-v1-tech-header {
            text-align: center;
            padding: 8px;
            height: 40px;
            font-weight: 600;
            font-size: 0.85rem;
            border-bottom: 1px solid var(--border-color, #e0e0e0);
            background: var(--bg-element, #f8f9fa);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            position: sticky;
            top: 0;
            z-index: 50;
            color: var(--text-color);
        }
        .time-v1-tech-body {
            position: relative;
            height: 600px;
            background-image: linear-gradient(to bottom, transparent 59px, var(--border-color, #f0f0f0) 60px);
            background-size: 100% 60px; 
        }
        .time-v1-entry-block {
            position: absolute;
            left: 4px;
            right: 4px;
            border-radius: 6px;
            padding: 6px 8px;
            font-size: 0.8rem;
            overflow: hidden;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
            transition: transform 0.2s, box-shadow 0.2s, z-index 0.2s;
            border-left: 4px solid var(--bs-secondary);
            background: var(--bg-surface, #fff);
            cursor: grab;
            z-index: 10;
        }
        .time-v1-entry-block:active { cursor: grabbing; opacity: 0.9; }
        .time-v1-entry-block:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.15);
            z-index: 20;
        }
        .time-v1-entry-pending { border-left-color: #f59e0b; background: rgba(245, 158, 11, 0.05) !important; }
        .time-v1-entry-godkendt { border-left-color: #2fb344; background: rgba(47, 179, 68, 0.05) !important; }
        .time-v1-entry-kladde { border-left-color: #6c757d; background: rgba(108, 117, 125, 0.05) !important; }
        .time-v1-entry-time {
            font-weight: 600;
            font-size: 0.75rem;
            margin-bottom: 2px;
            color: var(--text-color);
        }
        .time-v1-entry-desc {
            color: var(--text-secondary);
            font-size: 0.75rem;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
        .time-v1-unplaced-container {
            padding: 12px 20px;
            border-top: 1px solid var(--border-color);
            background: var(--bg-element);
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            align-items: center;
        }
        .time-v1-unplaced-item {
            background: var(--bg-surface);
            border: 1px solid var(--border-color);
            padding: 4px 10px;
            border-radius: 20px;
            font-size: 0.8rem;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            color: var(--text-color);
        }
'''
    text = text[:css_start] + css_new + text[css_start+7:]
    
    with open('app/modules/sag/templates/detail.html', 'w', encoding='utf-8') as f:
        f.write(text)
    print('CSS added successfully!')