:root {
    /* Light Theme Palette */
    --bg-app: #f8fafc;
    --bg-panel: #ffffff;
    --bg-panel-glass: rgba(255, 255, 255, 0.9);
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent-color: #4f46e5;
    /* Indigo-600 */
    --accent-hover: #4338ca;
    --danger-color: #ef4444;
    --grid-line: #f1f5f9;
    --task-height: 36px;
    --row-height: 56px;
    --sidebar-width: 400px;
    /* Wider for more details */
    --header-height: 64px;
    --timeline-header-height: 56px;

    /* Status Colors */
    --status-todo: #94a3b8;
    --status-inprogress: #3b82f6;
    --status-done: #10b981;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.top-bar {
    height: var(--header-height);
    background-color: rgba(255, 255, 255, 0.8);
    /* Semi-transparent */
    backdrop-filter: blur(12px);
    /* Glassmorphism */
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Logo Left, Controls Center, Actions Right */
    padding: 0 24px;
    z-index: 100;
    /* Higher z-index for overlay */
    box-shadow: 0 4px 20px -1px rgba(0, 0, 0, 0.05);
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo svg {
    color: var(--accent-color);
    filter: drop-shadow(0 2px 4px rgba(79, 70, 229, 0.2));
}

.controls {
    display: flex;
    gap: 24px;
    align-items: center;
}

.view-modes {
    background-color: #f1f5f9;
    padding: 4px;
    border-radius: 999px;
    /* Pill shape container */
    display: flex;
    gap: 2px;
    border: 1px solid var(--border-color);
}

.btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 999px;
    /* Pill shape */
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 10;
    /* Ensure visibility */
    opacity: 1;
    /* Force visibility */
}

.btn:hover {
    color: var(--text-primary);
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn.active {
    background-color: #ffffff;
    color: var(--accent-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3), 0 2px 4px -1px rgba(79, 70, 229, 0.15);
    padding: 8px 20px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent-color));
    color: white;
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

.btn-outline {
    border: 1px solid var(--border-color);
    background-color: transparent;
    transition: all 0.2s;
}

.btn-outline:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background-color: rgba(79, 70, 229, 0.05);
}

.btn-danger {
    background-color: #fee2e2;
    color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #fecaca;
    color: #dc2626;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    position: relative;
    z-index: 10;
}

.actions {
    position: relative;
    z-index: 10;
}

.watermark-link {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
}

.watermark-link:hover {
    color: var(--accent-color);
}

.watermark-link strong {
    color: var(--accent-color);
    font-weight: 700;
}

/* Main Layout */
.gantt-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Sidebar */
.gantt-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 5;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
}

.task-row {
    height: var(--row-height);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.9rem;
    position: relative;
    /* For drag handle positioning if needed */
}

.task-row:hover {
    background-color: #f1f5f9;
}

.task-row.dragging {
    opacity: 0.5;
    background-color: #e2e8f0;
}

.drag-handle {
    cursor: grab;
    color: #cbd5e1;
    margin-right: 8px;
    display: flex;
    align-items: center;
}

.drag-handle:hover {
    color: var(--text-secondary);
}

.sidebar-header {
    height: var(--timeline-header-height);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background-color: #f8fafc;
}

.col-name {
    flex: 1;
    padding-left: 8px;
}

.col-assignee {
    width: 40px;
    text-align: center;
}

.col-priority {
    width: 80px;
    text-align: center;
}

.col-status {
    width: 80px;
    text-align: center;
}

.task-list {
    flex: 1;
    overflow-y: hidden;
    /* Synced with timeline */
    overflow-x: hidden;
}

.task-row.selected {
    background-color: #e0e7ff;
}

.task-name-cell {
    flex: 1;
    padding-left: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

.task-meta-cell {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Badges */
.badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-high {
    background: #fee2e2;
    color: #ef4444;
}

.badge-medium {
    background: #ffedd5;
    color: #f97316;
}

.badge-low {
    background: #dcfce7;
    color: #22c55e;
}

.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #cbd5e1;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Timeline */
.gantt-timeline {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Disable container scroll */
    position: relative;
    background-color: var(--bg-app);
}

.timeline-header {
    height: var(--timeline-header-height);
    background-color: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    overflow-x: hidden;
    /* Hide header scrollbar */
    min-width: 100%;
}


.export-container * {
    -webkit-print-color-adjust: exact !important;
    color-adjust: exact !important;
    print-color-adjust: exact !important;
}

.export-container .btn,
.export-container .drag-handle,
.export-container .resize-handle,
.export-container .connector-dot {
    display: none !important;
    /* Hide UI controls in PDF */
}

.header-cell {
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    background-color: #f8fafc;
}

.month-cell {
    background-color: #f1f5f9;
    border-right: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-primary);
}

.timeline-body {
    flex: 1;
    position: relative;
    overflow: auto;
    /* Handle both scrolls here */
    min-width: 100%;
    overscroll-behavior: contain;
}

.grid-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    pointer-events: none;
    z-index: 0;
}

.grid-line {
    border-right: 1px solid var(--grid-line);
    height: 100%;
    flex-shrink: 0;
}

.grid-line.weekend {
    background-color: #f1f5f9;
}

.tasks-container {
    position: relative;
    z-index: 2;
    min-height: 100%;
}

.task-bar-wrapper {
    height: var(--row-height);
    position: relative;
    width: 100%;
}

.task-bar {
    height: var(--task-height);
    background-color: var(--accent-color);
    border-radius: 6px;
    position: absolute;
    top: 10px;
    /* (56 - 36) / 2 */
    cursor: grab;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.task-bar:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
    z-index: 10;
}

/* Connector Dots */
.connector-dot {
    width: 10px;
    height: 10px;
    background-color: #fff;
    border: 2px solid var(--text-secondary);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    cursor: crosshair;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.connector-dot:hover {
    transform: translateY(-50%) scale(1.2);
    border-color: var(--accent-color);
}

.task-bar:hover .connector-dot {
    opacity: 1;
}

.connector-dot.left {
    left: -6px;
}

.connector-dot.right {
    right: -6px;
}

/* Milestone Styles */
.task-bar.milestone {
    background-color: #f59e0b !important;
    /* Amber-500 */
    width: 24px !important;
    height: 24px !important;
    transform: rotate(45deg);
    border-radius: 4px;
    top: 16px;
    /* Center vertically */
    border: 2px solid #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.task-bar.milestone .task-progress,
.task-bar.milestone .resize-handle {
    display: none;
}

.task-bar.milestone span {
    transform: rotate(-45deg);
    /* Counter-rotate text */
    position: absolute;
    left: 30px;
    top: -5px;
    white-space: nowrap;
    color: var(--text-primary);
    font-weight: 600;
    text-shadow: none;
}

/* Glassmorphic Buttons */
.btn {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

.modal {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.task-bar:active {
    cursor: grabbing;
}

.task-progress {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.25);
    border-radius: 6px 0 0 6px;
    pointer-events: none;
}

.resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: col-resize;
    z-index: 11;
    opacity: 0;
    transition: opacity 0.2s;
}

.task-bar:hover .resize-handle {
    opacity: 1;
}

.resize-handle.left {
    left: 0;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.1), transparent);
    border-radius: 6px 0 0 6px;
}

.resize-handle.right {
    right: 0;
    background: linear-gradient(to left, rgba(0, 0, 0, 0.1), transparent);
    border-radius: 0 6px 6px 0;
}

.dependency-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

path.dep-line {
    fill: none;
    stroke: #94a3b8;
    /* Slightly lighter line than the arrow head */
    stroke-width: 2px;
    /* Thinner line creates a cleaner curve */
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.2s;
}

path.dep-line:hover {
    stroke: #4f46e5;
    /* Highlight color on hover */
    stroke-width: 3px;
    z-index: 100;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #ffffff;
    padding: 0;
    border-radius: 24px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #e2e8f0;
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 32px 40px;
    background: linear-gradient(to bottom, #f8fafc, #ffffff);
    border-bottom: 1px solid #e2e8f0;
}

.modal-header-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    margin: 0 0 4px 0;
}

.modal-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.close-btn {
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f1f5f9;
    color: var(--text-primary);
    transform: rotate(90deg);
}

/* Form Container */
#task-form {
    padding: 0 40px 32px 40px;
    overflow-y: auto;
    max-height: calc(90vh - 180px);
}

/* Section Styling */
.form-section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f1f5f9;
}

.section-header svg {
    color: var(--accent-color);
}

.section-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}

.modal-body {
    padding: 0;
    /* Padding handled by modal-content */
    max-height: 70vh;
    overflow-y: auto;
}

/* Form Styling */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row.triple {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all 0.2s;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Custom Range Input */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    margin-top: -8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #e2e8f0;
    border-radius: 2px;
}

/* Color Input */
input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 100%;
    height: 48px;
    border-radius: 12px;
    padding: 4px;
    background: #fff;
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 8px;
}

/* Progress Input */
.progress-input {
    display: flex;
    align-items: center;
    gap: 16px;
}

.progress-value {
    font-weight: 600;
    color: var(--accent-color);
    font-size: 1.1rem;
    min-width: 50px;
    text-align: right;
}

.progress-bar-track {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(to right, var(--accent-color), #6366f1);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Color Picker */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker-wrapper input[type="color"] {
    width: 80px;
    height: 48px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    cursor: pointer;
}

.color-preview {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

/* Dependency Selector */
.dependency-selector {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    max-height: 180px;
    overflow-y: auto;
    background: #f8fafc;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}

.dep-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.dep-item:hover {
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.dep-item.selected {
    background-color: #e0e7ff;
    border-color: var(--accent-color);
    color: var(--accent-color);
    font-weight: 600;
}

.dep-item input {
    display: none;
    /* Hide checkbox, use card style */
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 24px 40px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    margin-top: auto;
}

.modal-footer .btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-weight: 600;
}

.modal-footer .btn svg {
    width: 16px;
    height: 16px;
}

/* Delete Confirmation */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.confirm-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.confirm-box {
    background: #ffffff;
    padding: 32px;
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    border: 1px solid #f1f5f9;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 420px;
    width: 90%;
}

.confirm-overlay.active .confirm-box {
    transform: scale(1);
}

.confirm-box h3 {
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.confirm-box p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.confirm-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.confirm-actions .btn {
    min-width: 100px;
}

/* Print Styles */
@media print {
    @page {
        size: landscape;
        margin: 1cm;
    }

    body {
        background-color: white;
        height: auto;
        overflow: visible;
    }

    .top-bar,
    .modal-overlay,
    .resize-handle {
        display: none !important;
    }

    .app-container {
        height: auto;
        display: block;
    }

    .gantt-wrapper {
        overflow: visible;
        display: block;
    }

    .gantt-sidebar {
        width: 100%;
        border: none;
        box-shadow: none;
        margin-bottom: 20px;
    }

    .gantt-timeline {
        overflow: visible;
        border: 1px solid #ddd;
    }

    .timeline-header {
        position: static;
    }

    .task-list {
        overflow: visible;
    }

    /* Print Header */
    .print-header {
        display: block !important;
        margin-bottom: 20px;
        text-align: center;
    }

    .print-header h1 {
        font-size: 24px;
        margin-bottom: 5px;
    }

    .print-header p {
        color: #666;
    }
}

.print-header {
    display: none;
}


/* Phase Background Container */
.phase-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    /* Behind grid lines */
    pointer-events: none;
}

/* Individual Phase Overlay */
.phase-overlay {
    position: absolute;
    top: 0;
    bottom: 0;
    /* Semi-transparent background */
    opacity: 0.15;
    border-left: 2px solid rgba(0, 0, 0, 0.1);
    border-right: 2px solid rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s ease;
    display: flex;
    justify-content: center;
    padding-top: 10px;
}

.phase-overlay:hover {
    opacity: 0.3;
    /* Brighten on hover */
}

/* Phase Label */
.phase-label {
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    height: fit-content;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    white-space: nowrap;
    position: sticky;
    top: 10px;
}

/* Rotating Phase Colors */
.phase-color-0 {
    background-color: #a855f7;
}

/* Purple */
.phase-color-1 {
    background-color: #3b82f6;
}

/* Blue */
.phase-color-2 {
    background-color: #10b981;
}

/* Green */
.phase-color-3 {
    background-color: #f59e0b;
}

/* Yellow */
.phase-color-4 {
    background-color: #ef4444;
}

/* Red */
/* --- Phase Grouping in Sidebar --- */
.sidebar-phase-header {
    background-color: #f1f5f9;
    padding: 8px 16px;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 4;
    /* Below header but above rows */
}

/* --- Timeline Phase Overlays --- */
.phase-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    /* Above grid background, below tasks */
}

.phase-overlay {
    position: absolute;
    top: 0;
    bottom: 0;
    opacity: 0.1;
    border-right: 1px dashed rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: flex-end;
    padding-bottom: 8px;
    justify-content: center;
}

.phase-label {
    font-size: 3rem;
    font-weight: 900;
    color: rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    pointer-events: none;
    letter-spacing: 0.1em;
}

/* Phase Colors */
.phase-color-0 {
    background-color: #60a5fa;
}

/* Blue */
.phase-color-1 {
    background-color: #34d399;
}

/* Green */
.phase-color-2 {
    background-color: #f472b6;
}

/* Pink */
.phase-color-3 {
    background-color: #a78bfa;
}

/* Purple */
.phase-color-4 {
    background-color: #fbbf24;
}

/* Amber */

/* --- Timeline Background Enhancements --- */
.grid-background {
    background-image: linear-gradient(to right, transparent 95%, rgba(0, 0, 0, 0.02) 95%);
    background-size: 50px 100%;
    /* Matches default column width, will need JS update if dynamic */
}

.grid-line {
    border-right: 1px dashed var(--grid-line);
}

/* --- Resizable Sidebar --- */
.sidebar-resizer {
    width: 4px;
    background-color: transparent;
    cursor: col-resize;
    position: relative;
    z-index: 20;
    transition: background-color 0.2s;
    flex-shrink: 0;
    margin-left: -2px;
    /* Overlap slightly */
}

.sidebar-resizer:hover,
.sidebar-resizer.resizing {
    background-color: var(--accent-color);
}

/* --- Visual Refinements --- */

/* Sidebar Phase Header */
.sidebar-phase-header {
    background-color: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    gap: 8px;
}

.phase-icon {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

/* Phase Summary Bar */
.phase-summary-bar {
    position: absolute;
    top: 18px;
    /* Centered in 56px row */
    height: 20px;
    background-color: rgba(79, 70, 229, 0.1);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
}

.summary-bar-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background-color: var(--accent-color);
    border-radius: 2px;
    opacity: 0.6;
}

.summary-bracket {
    position: absolute;
    top: 2px;
    bottom: 2px;
    width: 2px;
    background-color: var(--accent-color);
}

.summary-bracket.left {
    left: 0;
}

.summary-bracket.right {
    right: 0;
}

.summary-bar-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-color);
    background-color: var(--bg-app);
    padding: 0 8px;
    z-index: 2;
}

/* Enhanced Task Row */
.task-row {
    transition: background-color 0.1s;
}

.task-row:hover {
    background-color: #f1f5f9;
}

/* --- Refined Phase Summary Bar --- */
.phase-summary-bar {
    background-color: transparent;
    /* Remove block background */
    border-radius: 0;
}

.summary-bar-track {
    height: 4px;
    background-color: #818cf8;
    /* Indigo-400 */
    border-radius: 2px;
    opacity: 0.8;
}

.summary-bar-label {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    /* Pill shape */
    padding: 2px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.summary-bracket {
    width: 2px;
    background-color: #818cf8;
    top: 0;
    bottom: 0;
    height: 12px;
    /* Fixed height for end caps */
    margin: auto 0;
    /* Center vertically */
}