/* Custom styles for Construction Schedule App */
/* Mobile-first design with large touch targets (minimum 44px) */

:root {
    --primary: #2c3e50;
    --primary-dark: #1a252f;
    --accent: #3498db;
    --success: #27ae60;
    --danger: #e74c3c;
    --text: #333333;
    --text-light: #666666;
    --bg: #f8f9fa;
    --border: #e0e0e0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text);
    line-height: 1.6;
}

/* PWA safe area top inset + a little breathing room below iOS status bar */
.safe-area-top-pad {
    padding-top: 0;
}

/* Header is rendered by shared PHP include outside page wrappers; keep it below iOS status area. */
.app-header {
    padding-top: constant(safe-area-inset-top);
    padding-top: env(safe-area-inset-top, 0px);
}

/* Schedule Chart (Gantt) – sticky Tasks column on horizontal scroll */
#ganttView .gantt-col-tasks {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 100px;
    width: 1%;
    white-space: nowrap;
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.04);
}
#ganttView .gantt-col-tasks .gantt-task-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (min-width: 641px) {
    #ganttView .gantt-col-tasks {
        max-width: none;
        width: auto;
    }
    #ganttView .gantt-col-tasks .gantt-task-name {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
}
/* Header row sticky on vertical scroll; date headers move with horizontal scroll */
#ganttView thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 1px 0 0 #e5e7eb;
}
#ganttView thead .gantt-col-tasks {
    left: 0;
    top: 0;
    z-index: 3;
    background: #f3f4f6;
}
#ganttView tbody tr:hover .gantt-col-tasks {
    background: #f3f4f6;
}
#ganttView .gantt-col-tasks-phase {
    background: #f3f4f6;
}
@media (max-width: 640px) {
    #ganttView .gantt-col-tasks {
        min-width: 80px;
        max-width: 140px;
        width: auto;
    }
}

/* Chart view: scroll area height is set by JS (updateGanttScrollHeight) */
#ganttView .gantt-scroll-area {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 200px;
}

/* Diagonal hashes on completed task pills in Chart view */
#ganttView .gantt-pill-completed {
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 3px,
        rgba(255, 255, 255, 0.35) 3px,
        rgba(255, 255, 255, 0.35) 6px
    );
}

/* Primary color utilities */
.bg-primary {
    background-color: var(--primary);
}

.bg-primary-dark {
    background-color: var(--primary-dark);
}

.text-primary {
    color: var(--primary);
}

.focus\:ring-primary:focus {
    --tw-ring-color: var(--primary);
}

/* Touch-friendly buttons - minimum 44px height */
button, 
input[type="submit"],
a.button {
    min-height: 44px;
    min-width: 44px;
}

/* Project card styles */
.project-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s;
}

.project-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.project-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: capitalize;
}

.project-status.planning {
    background-color: #e3f2fd;
    color: #1976d2;
}

.project-status.active {
    background-color: #e8f5e9;
    color: #388e3c;
}

.project-status.completed {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.project-status.on_hold {
    background-color: #fff3e0;
    color: #f57c00;
}

/* Form inputs - larger on mobile */
input[type="email"],
input[type="password"],
input[type="text"] {
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 44px;
}

/* Loading spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .project-card {
        padding: 2rem;
    }
}

/* Accessibility */
*:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Phase card styles */
.phase-card {
    margin-bottom: 1rem;
    overflow: visible;
}

.phase-header {
    border-bottom: 1px solid var(--border);
}

.project-task-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.project-task-type-badge--inspection {
    background: #dcfce7;
    color: #166534;
}

.project-task-type-badge--delivery {
    background: #dbeafe;
    color: #1d4ed8;
}

.project-task-type-badge--admin {
    background: #e5e7eb;
    color: #374151;
}

.project-task-type-badge--milestone {
    background: #ede9fe;
    color: #6d28d9;
}

.task-item--type-inspection {
    border-left: 4px solid #16a34a;
    background: #f0fdf4;
}

.project-task-checklist-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
}

.project-task-checklist-checkbox {
    width: 18px;
    height: 18px;
}

.project-task-checklist-text {
    width: 100%;
    min-height: 38px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 8px 10px;
}

.project-task-checklist-delete {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    min-height: 38px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #b91c1c;
    background: #fff;
}

.phase-tasks {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.phase-tasks.expanded {
    max-height: 100000px;
    overflow: visible;
}

.phase-tasks.hidden {
    display: none;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

/* Task item styles */
.task-item {
    border-left: 4px solid transparent;
    transition: all 0.2s;
}

.task-item:hover {
    border-left-color: var(--primary);
}

.task-status-btn {
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.task-status-btn:hover {
    transform: scale(1.2);
}

.task-status-btn.text-gray-500 {
    color: #6b7280;
}

.task-status-btn.text-yellow-600 {
    color: #d97706;
}

.task-status-btn.text-green-600 {
    color: #16a34a;
}

.task-status-btn.text-red-600 {
    color: #dc2626;
}

/* Modal styles */
#phaseModal,
#taskModal {
    z-index: 1000;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Form styles */
textarea {
    font-size: 16px; /* Prevents zoom on iOS */
    resize: vertical;
}

select {
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 44px;
}

/* Completion bar */
#projectCompletionBar {
    transition: width 0.3s ease;
}

/* Phase toggle animation */
.phase-toggle svg {
    transition: transform 0.2s;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .task-item {
        padding: 0.75rem;
        overflow: visible;
    }
    
    /* Task actions: full-width row so all icons wrap and show; no clipping */
    .task-item-actions {
        width: 100%;
        min-width: 0;
        justify-content: flex-start;
    }
    
    .modal-content {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
}

/* Swipe actions for mobile (future enhancement) – use overflow: visible so action row is not clipped */
.task-item {
    position: relative;
    overflow: visible;
}

/* Mobile Actions dropdown: raise task card above next task so dropdown is visible */
.task-item.task-actions-open {
    z-index: 50;
}

/* Notification styles */
.notification-container {
    position: relative;
}

.notification-badge {
    font-size: 0.75rem;
    line-height: 1;
}

.notification-dropdown {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.notification-item {
    transition: background-color 0.2s;
}

.notification-item:hover {
    background-color: #f3f4f6 !important;
}

/* Assignment status badges */
.assignment-status {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.assignment-status.pending {
    background-color: #fef3c7;
    color: #92400e;
}

.assignment-status.confirmed {
    background-color: #d1fae5;
    color: #065f46;
}

.assignment-status.checked-in {
    background-color: #dbeafe;
    color: #1e40af;
}

.assignment-status.completed {
    background-color: #e0e7ff;
    color: #3730a3;
}

/* Subcontractor card styles */
.sub-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.sub-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Conflict warning styles */
.conflict-warning {
    border-left: 4px solid #f59e0b;
    background-color: #fffbeb;
}

.conflict-error {
    border-left: 4px solid #ef4444;
    background-color: #fef2f2;
}

/* Calendar/schedule view styles */
.calendar-day {
    min-height: 100px;
    border: 1px solid var(--border);
    padding: 0.5rem;
    position: relative;
}

.calendar-day.weekend {
    background-color: #f9fafb;
}

.calendar-day.today {
    background-color: #eff6ff;
    border-color: var(--primary);
}

.calendar-day.has-tasks {
    background-color: #f0fdf4;
}

.calendar-day.has-conflicts {
    background-color: #fef2f2;
    border-color: #ef4444;
}

.calendar-task-item {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    margin-bottom: 0.25rem;
    border-radius: 4px;
    background-color: white;
    border-left: 3px solid var(--primary);
}

/* Subcontractor view - large buttons for mobile */
.sub-view .action-button {
    min-height: 56px;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1rem 2rem;
}

/* Mobile-specific styles for subcontractors */
@media (max-width: 768px) {
    .notification-dropdown {
        width: calc(100vw - 2rem);
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
    
    .sub-view .action-button {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .calendar-day {
        min-height: 80px;
    }
}

/* ==================== PHASE 4 STYLES ==================== */

/* Photo gallery styles */
#photoGalleryModal {
    z-index: 2000;
}

.photo-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.photo-thumbnail {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.photo-thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.photo-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.photo-lightbox img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

/* Issue card styles */
.issue-card {
    border-left: 4px solid;
    transition: all 0.2s;
}

.issue-card.severity-low {
    border-left-color: #3b82f6;
    background-color: #eff6ff;
}

.issue-card.severity-medium {
    border-left-color: #f59e0b;
    background-color: #fffbeb;
}

.issue-card.severity-high {
    border-left-color: #f97316;
    background-color: #fff7ed;
}

.issue-card.severity-critical {
    border-left-color: #ef4444;
    background-color: #fef2f2;
}

.issue-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Daily log styles */
.daily-log-card {
    border-left: 4px solid #3b82f6;
    background-color: #f8fafc;
}

.daily-log-date {
    font-weight: 600;
    color: var(--primary);
}

.daily-log-summary {
    color: var(--text-light);
    line-height: 1.6;
}

/* Voice note styles */
.voice-note-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.voice-note-player {
    flex: 1;
}

.voice-note-duration {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Recording button animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.recording-indicator {
    animation: pulse 1s ease-in-out infinite;
}

/* Photo capture button */
.capture-photo-btn,
.view-photos-btn,
.flag-issue-btn,
.record-voice-btn {
    transition: all 0.2s;
}

.capture-photo-btn:hover,
.view-photos-btn:hover,
.flag-issue-btn:hover,
.record-voice-btn:hover {
    transform: scale(1.1);
}

/* Offline queue indicator */
#offlineQueueIndicator {
    animation: pulse 2s ease-in-out infinite;
}

/* Photo upload progress */
.upload-progress {
    position: relative;
    width: 100%;
    height: 4px;
    background-color: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    background-color: var(--primary);
    transition: width 0.3s ease;
}

/* Issue severity badges */
.severity-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.severity-badge.low {
    background-color: #dbeafe;
    color: #1e40af;
}

.severity-badge.medium {
    background-color: #fef3c7;
    color: #92400e;
}

.severity-badge.high {
    background-color: #fed7aa;
    color: #9a3412;
}

.severity-badge.critical {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Photo type filter */
.photo-type-filter {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.photo-type-filter button {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.photo-type-filter button.active {
    background-color: var(--primary);
    color: white;
}

/* Responsive photo gallery */
@media (max-width: 768px) {
    .photo-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .photo-lightbox {
        padding: 1rem;
    }
    
    .issue-card {
        padding: 0.75rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .photo-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1025px) {
    .photo-gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Swipe gestures for photo gallery on mobile */
.photo-lightbox {
    touch-action: pan-y;
}

/* Print styles */
@media print {
    #logoutButton,
    #logoutButtonDetail,
    #addPhaseButton,
    .add-task-btn,
    .edit-phase-btn,
    .delete-phase-btn,
    .edit-task-btn,
    .delete-task-btn,
    .assign-sub-btn,
    .notification-container,
    .capture-photo-btn,
    .view-photos-btn,
    .flag-issue-btn,
    .record-voice-btn {
        display: none;
    }
    
    .phase-tasks {
        max-height: none !important;
    }
}

/* ==================== PHASE 5 STYLES ==================== */

/* Inspection Status Badges */
.inspection-status {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: capitalize;
}

.inspection-status.not_scheduled {
    background-color: #e5e7eb;
    color: #6b7280;
}

.inspection-status.scheduled {
    background-color: #dbeafe;
    color: #2563eb;
}

.inspection-status.passed {
    background-color: #d1fae5;
    color: #059669;
}

.inspection-status.failed {
    background-color: #fee2e2;
    color: #dc2626;
}

.inspection-status.pending_reschedule {
    background-color: #fed7aa;
    color: #ea580c;
}

/* Permit Status Badges */
.permit-status {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: capitalize;
}

.permit-status.not_applied {
    background-color: #e5e7eb;
    color: #6b7280;
}

.permit-status.pending {
    background-color: #fef3c7;
    color: #d97706;
}

.permit-status.approved {
    background-color: #d1fae5;
    color: #059669;
}

.permit-status.expired {
    background-color: #fee2e2;
    color: #dc2626;
}

.permit-status.rejected {
    background-color: #fee2e2;
    color: #dc2626;
}

/* Permit Expiration Warnings */
.permit-expiration-warning {
    padding: 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.permit-expiration-warning.notice {
    background-color: #eff6ff;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

.permit-expiration-warning.warning {
    background-color: #fef3c7;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.permit-expiration-warning.critical {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.permit-expiration-warning.expired {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #dc2626;
}

/* Selection Status Badges */
.selection-status {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: capitalize;
}

.selection-status.pending {
    background-color: #fee2e2;
    color: #dc2626;
}

.selection-status.selected {
    background-color: #fef3c7;
    color: #d97706;
}

.selection-status.ordered {
    background-color: #dbeafe;
    color: #2563eb;
}

.selection-status.delivered {
    background-color: #d1fae5;
    color: #059669;
}

/* Selection Deadline Indicators */
.selection-deadline {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-weight: 600;
}

.selection-deadline.overdue {
    background-color: #fee2e2;
    color: #dc2626;
}

.selection-deadline.urgent {
    background-color: #fef3c7;
    color: #d97706;
}

.selection-deadline.normal {
    background-color: #e5e7eb;
    color: #6b7280;
}

/* Milestone Timeline */
.milestone-timeline {
    position: relative;
    padding-left: 2rem;
}

.milestone-timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #e5e7eb;
}

.milestone-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.milestone-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 0.25rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background-color: #e5e7eb;
    border: 2px solid white;
    z-index: 1;
}

.milestone-item.completed::before {
    background-color: #10b981;
}

.milestone-item.in_progress::before {
    background-color: #3b82f6;
    animation: pulse 2s infinite;
}

.milestone-item.upcoming::before {
    background-color: #e5e7eb;
}

/* Completion Percentage Circle */
.completion-circle {
    position: relative;
    width: 8rem;
    height: 8rem;
}

.completion-circle svg {
    transform: rotate(-90deg);
}

.completion-circle .circle-bg {
    stroke: #e5e7eb;
}

.completion-circle .circle-progress {
    stroke: #4a90e2;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}

/* Customer Portal Styles */
.customer-portal {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.customer-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.customer-message {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    margin-bottom: 0.5rem;
}

.customer-message.from-customer {
    background-color: #4a90e2;
    color: white;
    margin-left: auto;
}

.customer-message.from-builder {
    background-color: #e5e7eb;
    color: #333;
}

/* Message Thread */
.message-thread {
    max-height: 20rem;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
}

.message-thread::-webkit-scrollbar {
    width: 6px;
}

.message-thread::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.message-thread::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.message-thread::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Photo Gallery for Customer */
.customer-photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.customer-photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.customer-photo-item:hover {
    transform: scale(1.05);
}

.customer-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Selection Item Card */
.selection-card {
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}

.selection-card.overdue {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.selection-card.urgent {
    border-color: #f59e0b;
    background-color: #fffbeb;
}

.selection-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Mobile-specific adjustments for Phase 5 */
@media (max-width: 768px) {
    .inspection-status,
    .permit-status,
    .selection-status {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    .completion-circle {
        width: 6rem;
        height: 6rem;
    }

    .customer-photo-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .milestone-timeline {
        padding-left: 1.5rem;
    }
}

/* ==================== PHASE 6: FINANCIAL TRACKING STYLES ==================== */

/* Budget Cards */
.budget-summary-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    transition: box-shadow 0.2s;
}

.budget-summary-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.budget-progress-bar {
    height: 0.5rem;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.budget-progress-fill {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s;
}

.budget-progress-fill.on-budget {
    background-color: #10b981;
}

.budget-progress-fill.approaching {
    background-color: #f59e0b;
}

.budget-progress-fill.over-budget {
    background-color: #ef4444;
}

/* Budget Variance Indicators */
.budget-variance.positive {
    color: #ef4444;
    font-weight: 600;
}

.budget-variance.negative {
    color: #10b981;
    font-weight: 600;
}

/* Change Order Cards */
.change-order-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s;
}

.change-order-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.change-order-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: capitalize;
}

.change-order-status.draft {
    background-color: #f3f4f6;
    color: #374151;
}

.change-order-status.pending_approval {
    background-color: #fef3c7;
    color: #92400e;
}

.change-order-status.approved {
    background-color: #d1fae5;
    color: #065f46;
}

.change-order-status.rejected {
    background-color: #fee2e2;
    color: #991b1b;
}

.change-order-status.completed {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Payment Status Badges */
.payment-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: capitalize;
}

.payment-status.pending {
    background-color: #fef3c7;
    color: #92400e;
}

.payment-status.paid {
    background-color: #d1fae5;
    color: #065f46;
}

.payment-status.overdue {
    background-color: #fee2e2;
    color: #991b1b;
}

.payment-status.partial {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Expense Cards */
.expense-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 0.75rem;
    transition: box-shadow 0.2s;
}

.expense-card:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.expense-category-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: #f3f4f6;
    color: #374151;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Financial Report Sections */
.financial-section {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
}

.financial-metric {
    text-align: center;
}

.financial-metric-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.financial-metric-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.financial-metric-value.positive {
    color: #10b981;
}

.financial-metric-value.negative {
    color: #ef4444;
}

/* Change Order Items */
.change-order-item {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem;
    background-color: #f9fafb;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

.change-order-item input {
    flex: 1;
    min-width: 0;
}

.change-order-item .item-quantity {
    width: 6rem;
}

.change-order-item .item-price {
    width: 8rem;
}

/* Payment Schedule */
.payment-schedule-item {
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.payment-schedule-item.overdue {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.payment-schedule-item.due {
    border-color: #f59e0b;
    background-color: #fffbeb;
}

/* Expense Receipt Link */
.expense-receipt-link {
    color: #3b82f6;
    text-decoration: underline;
    font-size: 0.875rem;
}

.expense-receipt-link:hover {
    color: #2563eb;
}

/* Budget Line Items Table */
.budget-line-items-table {
    width: 100%;
    border-collapse: collapse;
}

.budget-line-items-table th {
    background-color: #f9fafb;
    font-weight: 600;
    text-align: left;
    padding: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
}

.budget-line-items-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.budget-line-items-table tr:hover {
    background-color: #f9fafb;
}

/* Mobile-specific adjustments for Phase 6 */
@media (max-width: 768px) {
    .budget-summary-card {
        padding: 1rem;
    }

    .financial-section {
        padding: 1rem;
    }

    .financial-metric-value {
        font-size: 1.25rem;
    }

    .change-order-card,
    .expense-card,
    .payment-schedule-item {
        padding: 0.75rem;
    }

    .change-order-item {
        flex-direction: column;
        align-items: stretch;
    }

    .change-order-item input {
        width: 100%;
    }

    .budget-line-items-table {
        font-size: 0.875rem;
    }

    .budget-line-items-table th,
    .budget-line-items-table td {
        padding: 0.5rem;
    }
}
