/* CR Custom Electric - Man Loader Styles */

/* Color Scheme Variables */
:root {
    --primary-blue: #0056A0;
    --primary-red: #D32F2F;
    --light-blue: #1976D2;
    --dark-blue: #003D82;
    --light-gray: #f8f9fa;
    --border-gray: #e9ecef;
    --text-dark: #1e3c72;

    /* Cell status colors */
    --cell-no-demand: #f5f5f5;
    --cell-empty: #ffebee;
    --cell-short: #fff3e0;
    --cell-full: #e8f5e9;
    --cell-over: #e3f2fd;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--dark-blue) 0%, var(--primary-blue) 100%);
    min-height: 100vh;
    padding: 20px;
}

/* Container */
.container {
    max-width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--light-blue) 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header-logo {
    height: 60px;
    width: auto;
    background: white;
    padding: 8px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
    flex-grow: 1;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
    font-size: 1.1em;
    opacity: 0.95;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
}

/* Header Controls */
.header-controls {
    display: flex;
    gap: 24px;
    align-items: center;
}

.control-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.control-label {
    font-size: 0.75em;
    font-weight: 700;
    color: white;
    opacity: 0.9;
    letter-spacing: 0.5px;
}

/* View Toggle Buttons */
.view-toggle-group {
    display: flex;
    gap: 0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.view-toggle-btn {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border: none;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.2s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.view-toggle-btn:last-child {
    border-right: none;
}

.view-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.view-toggle-btn.active {
    background: white;
    color: var(--primary-blue);
}

/* Division Select Dropdown */
.division-select {
    background: white;
    color: var(--primary-blue);
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.division-select:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.division-select:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* More Menu Dropdown */
.more-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
}

.more-menu .menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: white;
    color: #333;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: background 0.2s ease;
    border-bottom: 1px solid #e0e0e0;
}

.more-menu .menu-item:last-child {
    border-bottom: none;
}

.more-menu .menu-item:hover {
    background: #f5f5f5;
}

/* Division Filter Buttons (Legacy - keeping for backwards compatibility) */
.division-filter-group {
    display: flex;
    gap: 0;
    border-radius: 6px;
    overflow: hidden;
}

.division-filter-btn {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 16px;
    border: none;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.2s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.division-filter-btn:last-child {
    border-right: none;
}

.division-filter-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.division-filter-btn.active {
    background: white;
    color: var(--primary-blue);
}

.add-btn {
    background: white;
    color: var(--primary-blue);
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.2s ease;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.add-btn[title*="Print"] {
    background: #4CAF50;
    color: white;
}

.add-btn[title*="Print"]:hover {
    background: #388E3C;
}

/* Insight Badges (in Header) */
.insight-badges {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.insight-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.insight-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.badge-warning {
    background: #ffc107;
    color: #856404;
}

.badge-warning:hover {
    background: #ffb300;
}

.badge-info {
    background: #17a2b8;
    color: white;
}

.badge-info:hover {
    background: #138496;
}

.badge-success {
    background: #28a745;
    color: white;
    cursor: default;
}

.badge-success:hover {
    transform: none;
}

/* Main Content */
.main-content {
    padding: 20px;
}

/* Schedule Wrapper */
.schedule-wrapper {
    background: white;
}

.schedule-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 15px;
    background: var(--light-gray);
    border-bottom: 2px solid var(--border-gray);
}

.schedule-nav-btn {
    background: var(--primary-blue);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
}

.schedule-nav-btn:hover {
    background: var(--light-blue);
}

.schedule-week-range {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-dark);
    min-width: 250px;
    text-align: center;
}

/* Schedule Body Layout */
.schedule-body {
    display: flex;
    gap: 0;
    overflow-x: auto;
    padding-left: 280px; /* Space for left tray */
    transition: padding-left 0.3s ease;
}

.schedule-body.roster-collapsed {
    padding-left: 0;
}

/* Left Roster Tray (Floating) */
.roster-tray {
    position: fixed;
    left: 0;
    top: 120px; /* Below header */
    bottom: 0;
    width: 260px;
    background: white;
    border-right: 3px solid var(--primary-blue);
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.roster-tray.collapsed {
    transform: translateX(calc(-100% + 50px));
}

.roster-tray-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    background: var(--light-gray);
    border-bottom: 2px solid var(--border-gray);
    flex-shrink: 0;
}

.roster-tray-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.roster-tray-title h3 {
    font-size: 1em;
    color: var(--text-dark);
    margin: 0;
}

.active-day-label {
    font-size: 0.85em;
    color: #666;
    font-weight: normal;
}

.active-day-label.active {
    color: var(--primary-blue);
    font-weight: 600;
}

.roster-tray-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.roster-tray-actions select {
    flex: 1;
    padding: 6px 10px;
    border: 2px solid var(--border-gray);
    border-radius: 6px;
    font-size: 0.85em;
}

.roster-tray-toggle {
    width: 32px;
    height: 32px;
    background: white;
    border: 2px solid var(--border-gray);
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.roster-tray-toggle:hover {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

.roster-tray.collapsed .roster-tray-toggle {
    transform: rotate(180deg);
}

.roster-tray-content {
    padding: 15px;
    overflow-y: auto;
    flex: 1;
}

.roster-workers {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.roster-empty {
    text-align: center;
    color: #999;
    padding: 20px 10px;
    font-size: 0.9em;
}

.roster-drag-over {
    background: #e3f2fd;
}

/* Worker Chips */
.worker-chip {
    background: white;
    border: 2px solid var(--border-gray);
    border-radius: 6px;
    padding: 8px;
    cursor: grab;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.worker-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.worker-chip:active {
    cursor: grabbing;
}

.chip-name {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-dark);
}

.chip-meta {
    font-size: 0.75em;
    color: #666;
    text-transform: uppercase;
}

.worker-chip-foreman {
    border-color: #ff9800;
}

.worker-chip-journeyman {
    border-color: #2196f3;
}

.worker-chip-apprentice {
    border-color: #4caf50;
}

/* Compact Worker Chips (No Progress Bars) */
.worker-chip-compact {
    padding: 8px 10px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    min-height: 40px;
}

.worker-chip-compact .chip-name {
    font-size: 0.9em;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.worker-chip-compact .chip-role {
    font-size: 0.65em;
    color: #666;
    text-transform: uppercase;
    font-weight: 500;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Selected Worker (Click-to-Assign Mode) */
.worker-selected {
    background: #e3f2fd;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px #2196f3;
}

/* Worker Availability States (for active day filtering) */
.worker-chip.worker-available {
    opacity: 1;
    border-width: 2px;
}

.worker-chip.worker-assigned {
    opacity: 0.4;
    filter: grayscale(50%);
}

.worker-chip.worker-on-vacation {
    display: none;
}

.col-day.day-active {
    background: var(--primary-blue);
    color: white;
    cursor: pointer;
}

.col-day.day-active:hover {
    background: var(--light-blue);
}

/* Worker Availability Tracking */
.chip-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chip-availability {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid var(--border-gray);
}

.availability-bar {
    flex: 1;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.availability-fill {
    height: 100%;
    background: #4caf50;
    transition: all 0.3s ease;
}

.status-moderate .availability-fill {
    background: #2196f3;
}

.status-busy .availability-fill {
    background: #ff9800;
}

.status-full .availability-fill {
    background: #dc3545;
}

.availability-text {
    font-size: 0.7em;
    font-weight: 600;
    color: #666;
    white-space: nowrap;
    min-width: 42px;
    text-align: right;
}

.status-available .availability-text {
    color: #4caf50;
}

.status-moderate .availability-text {
    color: #2196f3;
}

.status-busy .availability-text {
    color: #ff9800;
}

.status-full .availability-text {
    color: #dc3545;
}

/* Mini Worker Chips (in cells) */
.worker-chip-mini {
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    padding: 3px 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 1px;
    font-size: 0.7em;
    transition: all 0.2s ease;
    white-space: nowrap;
    max-width: 100%;
}

.worker-chip-mini:hover {
    background: #ffebee;
    border-color: #dc3545;
    transform: translateY(-1px);
}

.chip-name-mini {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chip remove button - hidden, chip itself is clickable now */
.chip-remove {
    display: none;
}

/* Schedule Grid Container */
.schedule-grid-container {
    flex-grow: 1;
    overflow-x: auto;
    padding: 15px;
}

/* Schedule Table */
.schedule-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1400px;
}

.schedule-table thead {
    background: white;
}

.week-headers {
    position: sticky;
    top: 0;
    z-index: 12;
    background: white;
}

.day-headers {
    position: sticky;
    top: 42px; /* Height of week-headers row */
    z-index: 12;
    background: white;
}

.schedule-table th {
    background: var(--light-gray);
    border: 1px solid var(--border-gray);
    padding: 8px;
    font-size: 0.85em;
    font-weight: 600;
    text-align: center;
}

.col-job {
    min-width: 130px;
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--light-gray);
    z-index: 13;
}

.col-week-header {
    background: var(--primary-blue);
    color: white;
    font-size: 0.9em;
    padding: 10px;
    transition: all 0.3s ease;
}

.col-week-header.week-complete {
    background: #28a745;
    box-shadow: 0 0 0 3px #28a745;
    border: 2px solid white;
}

.col-day {
    min-width: 70px;
    font-size: 0.8em;
    position: relative;
    transition: background 0.3s ease;
}

/* Day header when fully staffed */
.col-day.day-fully-staffed {
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    color: white;
    font-weight: 600;
}

.col-day.day-fully-staffed small {
    color: rgba(255, 255, 255, 0.9);
}

/* JobTread action icons in day headers */
.day-jobtread-actions {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.col-day:hover .day-jobtread-actions {
    opacity: 1;
}

.jobtread-icon {
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
    display: inline-block;
}

.jobtread-icon:hover {
    transform: scale(1.2);
    background: rgba(255, 255, 255, 0.2);
}

.jobtread-push:hover {
    background: rgba(76, 175, 80, 0.3);
}

.jobtread-delete:hover {
    background: rgba(244, 67, 54, 0.3);
}

.col-job-name {
    background: white;
    border: 1px solid var(--border-gray);
    padding: 10px;
    position: sticky;
    left: 0;
    z-index: 5;
}

.sched-job-name {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.sched-job-div {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
}

/* Staffing Status Indicator */
.staffing-status-indicator {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    cursor: help;
    white-space: nowrap;
}

.staffing-status-indicator.status-ahead {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #1976d2;
}

.staffing-status-indicator.status-on-track {
    background: #e8f5e9;
    color: #388e3c;
    border: 1px solid #388e3c;
}

.staffing-status-indicator.status-behind {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #f57c00;
}

.staffing-status-indicator.status-critical {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #c62828;
}

/* Crew Board Styles */
.crew-board-table .col-worker {
    min-width: 150px;
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--light-gray);
    z-index: 13;
}

.col-worker-name {
    background: white;
    border: 1px solid var(--border-gray);
    padding: 12px;
    position: sticky;
    left: 0;
    z-index: 5;
    font-weight: 600;
}

.foreman-star {
    color: #ff9800;
    font-size: 1.1em;
    margin-left: 4px;
}

.worker-role-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 4px;
}

.col-day-crew {
    min-width: 80px;
    font-size: 0.8em;
}

.crew-day-cell {
    border: 1px solid var(--border-gray);
    padding: 8px;
    min-width: 80px;
    min-height: 50px;
    vertical-align: middle;
    text-align: center;
    font-size: 0.75em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.crew-day-cell:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    z-index: 1;
}

.crew-board-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 15px;
    background: white;
    border-top: 2px solid var(--border-gray);
}

.crew-board-legend .legend-item {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

/* Schedule Cells */
.schedule-cell {
    border: 1px solid var(--border-gray);
    padding: 4px;
    min-width: 70px;
    min-height: 60px;
    vertical-align: top;
    transition: all 0.2s ease;
    position: relative;
    overflow: visible;
}

.schedule-cell.drag-over {
    background: #bbdefb !important;
    border-color: var(--primary-blue);
}

/* Selected cell (keyboard navigation) */
.schedule-cell.cell-selected {
    box-shadow: inset 0 0 0 3px var(--primary-blue) !important;
    border: 3px solid var(--primary-blue) !important;
    z-index: 10;
    position: relative;
}

/* Crew Copy Handle */
.crew-copy-handle {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: var(--primary-blue);
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.schedule-cell:hover .crew-copy-handle {
    opacity: 1;
}

.crew-copy-handle:hover {
    transform: scale(1.1);
    background: var(--light-blue);
}

.crew-copy-handle:active {
    cursor: grabbing;
}

.schedule-cell.copying-crew {
    background: #e3f2fd !important;
    border: 2px solid var(--primary-blue);
}

.schedule-cell.crew-copy-target {
    background: #c8e6c9 !important;
    border: 2px dashed var(--primary-blue);
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Typeahead Dropdown */
.typeahead-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--primary-blue);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 2px;
}

/* Ensure cell with dropdown has high z-index and can overflow */
.schedule-cell:has(.typeahead-dropdown) {
    z-index: 10001 !important;
    position: relative;
}

.typeahead-header {
    padding: 6px 8px;
    background: #f5f5f5;
    border-bottom: 1px solid var(--border-gray);
    font-size: 0.7em;
    font-weight: 600;
    color: #666;
}

.typeahead-item {
    padding: 8px;
    cursor: pointer;
    font-size: 0.8em;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

.typeahead-item:hover,
.typeahead-item.selected {
    background: #e3f2fd;
}

.typeahead-role {
    color: #666;
    font-size: 0.9em;
    margin-left: 4px;
}

/* Click-to-Assign Mode */
.click-assign-mode {
    cursor: pointer;
}

.click-assign-mode:hover {
    box-shadow: 0 0 0 2px #2196f3;
}

.cell-demand-row {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-bottom: 3px;
}

.demand-input {
    width: 32px;
    padding: 2px;
    border: 1px solid var(--border-gray);
    border-radius: 3px;
    font-size: 0.8em;
    text-align: center;
}

.assigned-count {
    font-size: 0.7em;
    color: #666;
    margin-left: auto;
}

.cell-workers {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 2px;
}

/* Cell Status Colors */
.cell-no-demand {
    background: var(--cell-no-demand);
}

.cell-empty {
    background: var(--cell-empty);
}

.cell-short {
    background: var(--cell-short);
}

.cell-full {
    background: var(--cell-full);
}

.cell-over {
    background: var(--cell-over);
}

.schedule-empty-row {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1.1em;
}

/* Job Row Drag and Drop */
.job-row {
    cursor: grab;
    transition: all 0.2s ease;
    position: relative;
}

.job-row:active {
    cursor: grabbing;
}

.job-row.dragging {
    opacity: 0.5;
    background: #e3f2fd;
}

.job-row:hover {
    background: #f5f5f5;
}

.job-row.drop-above::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-blue);
    z-index: 100;
    box-shadow: 0 0 8px var(--primary-blue);
}

.job-row.drop-below::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-blue);
    z-index: 100;
    box-shadow: 0 0 8px var(--primary-blue);
}

/* Job Name Cell with Hover Actions */
.job-name-cell {
    position: relative;
}

.job-info-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.job-drag-handle {
    width: 32px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #999;
    cursor: grab;
    background: linear-gradient(to right, transparent, rgba(0,0,0,0.05));
    border-right: 2px solid var(--border-gray);
    margin-right: 8px;
    padding: 0 4px;
    transition: all 0.2s ease;
    user-select: none;
    letter-spacing: -2px;
}

.job-drag-handle:hover {
    color: var(--primary-blue);
    background: linear-gradient(to right, transparent, rgba(0, 86, 160, 0.1));
    border-right-color: var(--primary-blue);
}

.job-drag-handle:active {
    cursor: grabbing;
    background: linear-gradient(to right, transparent, rgba(0, 86, 160, 0.2));
}

.job-info {
    flex: 1;
}

.job-actions {
    display: flex;
    gap: 4px;
    opacity: 1;
}

.job-action-btn {
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    padding: 0;
    width: 26px;
    height: 26px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.job-action-btn:hover {
    transform: scale(1.1);
}

.edit-btn {
    color: #2196f3;
    border-color: #2196f3;
}

.edit-btn:hover {
    background: #2196f3;
    color: white;
}

.archive-btn {
    color: #ff9800;
    border-color: #ff9800;
}

.archive-btn:hover {
    background: #ff9800;
    color: white;
}

.remove-btn {
    color: #dc3545;
    border-color: #dc3545;
}

.remove-btn:hover {
    background: #dc3545;
    color: white;
}

/* Vacation Row Styles */
.vacation-row {
    background: #fff8e1;
    border-top: 2px solid #ff9800;
    position: sticky;
    top: 144px; /* Below week-headers (42px) + day-headers (42px) + tally-row (~60px) */
    z-index: 11;
}

.vacation-row td {
    background: #fff8e1;
}

.vacation-row .col-job-name {
    background: #fff8e1;
    z-index: 13;
}

.cell-vacation {
    background: #fffde7;
    min-height: 60px;
}

.cell-vacation .cell-workers {
    min-height: 40px;
}

/* Archived Jobs Section */
.archived-section {
    margin-top: 30px;
    padding: 20px;
    background: var(--light-gray);
    border-radius: 8px;
    border: 2px solid var(--border-gray);
}

.archived-toggle-btn {
    background: white;
    border: 2px solid var(--border-gray);
    border-radius: 6px;
    padding: 12px 20px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-align: left;
    color: var(--text-dark);
    transition: all 0.2s ease;
}

.archived-toggle-btn:hover {
    background: #f5f5f5;
    border-color: var(--primary-blue);
}

.archived-jobs-list {
    margin-top: 15px;
    display: grid;
    gap: 10px;
}

.archived-job-card {
    background: white;
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.archived-job-card:hover {
    border-color: var(--primary-blue);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.archived-job-info {
    flex: 1;
}

.archived-job-info strong {
    display: block;
    font-size: 1.1em;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.archived-job-location {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

.btn-unarchive {
    background: #28a745;
    color: white;
    padding: 8px 16px;
    font-size: 0.9em;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-unarchive:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

/* Tally Row Styles */
.tally-row {
    background: #f0f4f8;
    font-weight: 600;
    border-top: 3px solid var(--primary-blue);
    border-bottom: 3px solid var(--primary-blue);
    position: sticky;
    top: 84px; /* Below week-headers (42px) + day-headers (42px) */
    z-index: 11;
}

.tally-row td {
    background: #f0f4f8;
}

.tally-row .col-job-name {
    background: #f0f4f8;
    z-index: 13;
}

.tally-legend {
    display: flex;
    gap: 10px;
    margin-top: 5px;
    font-size: 0.7em;
    font-weight: 500;
    color: #666;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 3px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot.needed {
    background: #ff9800;
}

.legend-dot.assigned {
    background: #2196f3;
}

.legend-dot.available {
    background: #4caf50;
}

.tally-cell {
    border: 1px solid var(--border-gray);
    padding: 8px;
    text-align: center;
    vertical-align: middle;
    transition: background 0.3s ease;
    position: relative;
}

.tally-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.9em;
}

.tally-needed {
    font-weight: 700;
    color: #ff9800;
}

.tally-assigned {
    font-weight: 700;
    color: #2196f3;
}

.tally-separator {
    color: #999;
    font-weight: 400;
}

.tally-available {
    font-weight: 700;
    color: #4caf50;
}

.tally-neutral {
    background: #f5f5f5;
}

.tally-short {
    background: #ffebee;
}

.tally-perfect {
    background: #e8f5e9;
}

.tally-over {
    background: #fff3e0;
}

/* Tally Box Display - Matches Cell UI */
.tally-box-display {
    position: relative;
    width: 100%;
    height: 32px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tally-box-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(0, 0, 0, 0.08);
    transition: width 0.3s ease;
}

.tally-short .tally-box-bar {
    background: rgba(255, 152, 0, 0.3);
}

.tally-perfect .tally-box-bar {
    background: rgba(76, 175, 80, 0.3);
}

.tally-over .tally-box-bar {
    background: rgba(33, 150, 243, 0.3);
}

.tally-box-text {
    position: relative;
    z-index: 1;
    font-size: 0.95em;
    font-weight: 600;
    color: #333;
}

/* Old Progress Bar Styles - Commented Out */
/*
.progress-bar-wrapper {
    position: relative;
    width: 100%;
}

.progress-bar-track {
    width: 100%;
    height: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--light-blue), var(--primary-blue));
    border-radius: 10px;
    transition: width 0.3s ease;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

.tally-short .progress-bar-fill {
    background: linear-gradient(90deg, #ff9800, #f57c00);
}

.tally-perfect .progress-bar-fill {
    background: linear-gradient(90deg, #4caf50, #388e3c);
}

.tally-over .progress-bar-fill {
    background: linear-gradient(90deg, #2196f3, #1976d2);
}

.progress-bar-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-bottom: 5px;
    z-index: 10;
}

.progress-bar-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

.tally-cell:hover .progress-bar-tooltip {
    opacity: 1;
}
*/

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-small {
    max-width: 450px;
    padding: 25px;
}

.modal-message {
    font-size: 1em;
    color: #495057;
    margin: 15px 0 20px 0;
    line-height: 1.5;
}

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

.modal-actions button {
    flex: 1;
    max-width: 150px;
}

/* Print Modal Styles */
.print-week-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.print-week-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.print-week-option:hover {
    border-color: var(--primary-blue);
    background: var(--light-gray);
}

.print-week-option input[type="radio"] {
    min-width: 20px;
    min-height: 20px;
    cursor: pointer;
}

.print-week-option input[type="radio"]:checked {
    accent-color: var(--primary-blue);
}

.print-week-option:has(input:checked) {
    border-color: var(--primary-blue);
    background: #e3f2fd;
}

.option-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.option-content strong {
    color: var(--text-dark);
    font-size: 1em;
}

.option-date {
    color: #666;
    font-size: 0.9em;
}

/* Foreman Print Layout - Hidden on screen */
.foreman-print-container {
    display: none;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--primary-red);
}

.modal-header h2 {
    color: var(--text-dark);
    font-size: 1.8em;
}

.close-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

.close-btn:hover {
    background: #c82333;
}

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

label {
    display: block;
    margin-bottom: 5px;
    color: #495057;
    font-weight: 600;
    font-size: 0.95em;
}

input, select {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--light-blue) 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    width: 100%;
    margin-top: 10px;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 86, 160, 0.4);
}

.btn-secondary {
    background: white;
    color: var(--text-dark);
    border: 2px solid var(--border-gray);
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    width: 100%;
    margin-top: 10px;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--light-gray);
    border-color: var(--text-dark);
}

.btn-remove {
    background: #dc3545;
    color: white;
    padding: 6px 12px;
    font-size: 0.85em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-remove:hover {
    background: #c82333;
}

/* Item Cards */
.item-card {
    background: white;
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-info {
    flex-grow: 1;
}

.item-info strong {
    display: block;
    font-size: 1.1em;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.details {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    margin-right: 5px;
}

.badge-foreman {
    background: #ff9800;
    color: white;
}

.badge-journeyman {
    background: #2196f3;
    color: white;
}

.badge-apprentice {
    background: #4caf50;
    color: white;
}

.badge-commercial {
    background: #673ab7;
    color: white;
}

.badge-residential {
    background: #009688;
    color: white;
}

.badge-both {
    background: #795548;
    color: white;
}

.badge-vacation {
    background: #ff9800;
    color: white;
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: #999;
    font-size: 1em;
}

/* ========================================================================== */
/* MOBILE OPTIMIZATIONS - Touch-Friendly Design                              */
/* ========================================================================== */

/* Mobile Assignment Modals */
.assign-modal-jobs,
.assign-modal-workers,
.job-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.assign-job-btn,
.assign-worker-btn,
.menu-action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: white;
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    min-height: 48px; /* Touch target */
}

.assign-job-btn:hover,
.assign-worker-btn:hover,
.menu-action-btn:hover {
    border-color: var(--primary-blue);
    background: var(--light-gray);
    transform: translateX(4px);
}

.assign-job-name,
.assign-worker-name {
    font-weight: 600;
    color: var(--text-dark);
}

.assign-job-stats,
.assign-worker-role {
    font-size: 0.85em;
    color: #666;
    margin-top: 4px;
}

.assign-worker-icon {
    font-size: 24px;
}

.assign-worker-info {
    flex: 1;
}

.assign-vacation-btn {
    background: #fff3e0;
    border-color: #ff9800;
}

.menu-action-danger {
    color: var(--primary-red);
    border-color: var(--primary-red);
}

/* Mobile Roster */
.mobile-roster {
    padding: 16px;
}

.roster-header-mobile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.roster-header-mobile h3 {
    font-size: 1.2em;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-count {
    background: var(--primary-blue);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
}

.mobile-roster-section {
    margin-bottom: 20px;
}

.mobile-roster-section h4 {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-worker-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-worker-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 56px; /* Larger touch target */
}

.mobile-worker-chip:active {
    transform: scale(0.98);
}

.mobile-worker-chip-foreman {
    border-left: 4px solid #2196F3;
}

.mobile-worker-chip-journeyman {
    border-left: 4px solid #4CAF50;
}

.mobile-worker-chip-apprentice {
    border-left: 4px solid #FF9800;
}

.mobile-worker-chip-scheduled {
    background: #f5f5f5;
    border-color: #ddd;
    cursor: default;
}

.mobile-worker-chip-vacation {
    background: #fff3e0;
    border-color: #ff9800;
}

.worker-icon {
    font-size: 28px;
    line-height: 1;
}

.worker-info {
    flex: 1;
}

.worker-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1em;
}

.worker-role {
    font-size: 0.85em;
    color: #666;
    margin-top: 2px;
}

.worker-action {
    font-size: 24px;
    color: var(--primary-blue);
    font-weight: bold;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.worker-status {
    font-size: 0.85em;
    color: #666;
}

.worker-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f44336;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile Job Cards */
.mobile-job-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
}

.mobile-job-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #ddd;
}

.mobile-job-card.status-empty {
    border-left-color: #f44336;
    background: #ffebee;
}

.mobile-job-card.status-short {
    border-left-color: #ff9800;
    background: #fff3e0;
}

.mobile-job-card.status-full {
    border-left-color: #4CAF50;
    background: #e8f5e9;
}

.mobile-job-card.status-over {
    border-left-color: #2196F3;
    background: #e3f2fd;
}

.job-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.job-card-title {
    flex: 1;
}

.job-card-title h3 {
    font-size: 1.1em;
    margin-bottom: 6px;
    color: var(--text-dark);
}

.job-menu-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: -6px;
}

.job-menu-btn:active {
    background: rgba(0, 0, 0, 0.05);
}

.job-card-location {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 12px;
}

.job-card-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.stat-box {
    flex: 1;
    text-align: center;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-gray);
}

.stat-label {
    display: block;
    font-size: 0.75em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 1.5em;
    font-weight: bold;
    color: var(--text-dark);
}

.stat-input {
    border: none;
    background: transparent;
    text-align: center;
    width: 100%;
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-blue);
    padding: 4px;
}

.stat-input:focus {
    outline: 2px solid var(--primary-blue);
    border-radius: 4px;
}

.job-card-status {
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    margin-bottom: 12px;
}

.job-card-status.status-empty {
    background: #ffcdd2;
    color: #c62828;
}

.job-card-status.status-short {
    background: #ffe0b2;
    color: #e65100;
}

.job-card-status.status-full {
    background: #c8e6c9;
    color: #2e7d32;
}

.job-card-status.status-over {
    background: #bbdefb;
    color: #1565c0;
}

.job-card-status.status-none {
    background: #f5f5f5;
    color: #999;
}

.job-card-crew h4 {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.crew-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.crew-member {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-gray);
    min-height: 48px;
}

.crew-member-foreman {
    border-left: 3px solid #2196F3;
}

.crew-member-journeyman {
    border-left: 3px solid #4CAF50;
}

.crew-member-apprentice {
    border-left: 3px solid #FF9800;
}

.crew-icon {
    font-size: 24px;
}

.crew-info {
    flex: 1;
}

.crew-name {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
}

.crew-role {
    display: block;
    font-size: 0.8em;
    color: #666;
    margin-top: 2px;
}

.crew-remove-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f44336;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.crew-remove-btn:active {
    transform: scale(0.95);
}

.job-card-empty {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
}

.job-assign-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
}

.job-assign-btn:active {
    transform: scale(0.98);
    background: var(--dark-blue);
}

.mobile-no-jobs {
    padding: 40px 20px;
    text-align: center;
}

.mobile-no-jobs p {
    color: #999;
    margin-bottom: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        border-radius: 0;
        min-height: 100vh;
    }

    header {
        padding: 16px;
        border-radius: 0;
    }

    .header-logo {
        height: 40px;
        padding: 6px 12px;
    }

    header h1 {
        font-size: 1.5em;
    }

    header p {
        font-size: 0.9em;
    }

    .header-actions {
        display: flex;
        gap: 8px;
    }

    .add-btn {
        padding: 8px 16px;
        font-size: 0.85em;
        min-height: 44px; /* Touch target */
    }

    .schedule-nav {
        padding: 12px 16px;
    }

    .schedule-nav-btn {
        min-width: 44px; /* Touch target */
        min-height: 44px;
        padding: 8px 16px;
        font-size: 1.2em;
    }

    .schedule-week-range {
        font-size: 1em;
        cursor: pointer;
        padding: 8px 12px;
        border-radius: 8px;
        transition: background 0.2s;
    }

    .schedule-week-range:active {
        background: rgba(255, 255, 255, 0.1);
    }

    .schedule-body {
        flex-direction: column;
    }

    .schedule-roster {
        width: 100%;
        border-right: none;
        border-bottom: 2px solid var(--border-gray);
    }

    .schedule-grid-container {
        width: 100%;
    }

    /* Bottom Sheet Modal Animation for Mobile */
    .modal {
        align-items: flex-end; /* Align to bottom on mobile */
    }

    .modal.active {
        animation: modalFadeIn 0.2s ease-out;
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 85vh;
        margin: 0;
        border-radius: 20px 20px 0 0;
        transform-origin: bottom;
        animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .modal-content.modal-small {
        width: 100%;
        max-height: 70vh;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    @keyframes modalFadeIn {
        from {
            background: rgba(0, 0, 0, 0);
        }
        to {
            background: rgba(0, 0, 0, 0.7);
        }
    }

    /* Pull handle for bottom sheets */
    .modal-header::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: #ddd;
        border-radius: 2px;
        margin: -8px auto 12px;
    }

    /* Larger touch targets in modals */
    .btn-primary,
    .btn-secondary {
        min-height: 48px;
        padding: 12px 24px;
    }

    input[type="text"],
    input[type="number"],
    select {
        min-height: 48px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .close-btn {
        width: 36px;
        height: 36px;
        font-size: 28px;
    }

    /* Hide desktop schedule components on mobile */
    @supports (-webkit-touch-callout: none) {
        /* iOS specific */
        input[type="number"] {
            font-size: 16px;
        }
    }
}

/* ========================================================================== */
/* PRINT STYLES - Professional Print Layout                                  */
/* ========================================================================== */

@media print {
    /* Reset page margins and setup */
    @page {
        size: landscape;
        margin: 0.3in 0.4in;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    body {
        background: white;
        padding: 0;
        font-size: 9pt;
    }

    /* Hide everything except foreman print layout */
    .container,
    header,
    .main-content,
    .schedule-wrapper,
    .schedule-nav,
    .schedule-body,
    .modal {
        display: none !important;
    }

    /* Show and style foreman print layout */
    .foreman-print-container {
        display: block !important;
        width: 100%;
        max-width: 100%;
    }

    .print-header {
        border-bottom: 2px solid black;
        padding-bottom: 5px;
        margin-bottom: 8px;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
    }

    .print-title h1 {
        font-size: 13pt;
        font-weight: bold;
        margin: 0 0 3px 0;
        letter-spacing: 0.3px;
    }

    .print-title h2 {
        font-size: 10pt;
        font-weight: normal;
        margin: 0;
    }

    .print-date {
        font-size: 7pt;
        color: #666;
        text-align: right;
    }

    /* Print Schedule Table */
    .print-schedule-table {
        width: 100%;
        border-collapse: collapse;
    }

    .print-schedule-table th,
    .print-schedule-table td {
        border: 1px solid #333;
        padding: 4px 3px;
        vertical-align: middle;
    }

    .print-schedule-table thead th {
        background: #e0e0e0 !important;
        font-weight: bold;
        text-align: center;
        font-size: 9pt;
        padding: 5px 3px;
    }

    .print-worker-col {
        width: 120px;
        text-align: left !important;
    }

    .print-day-col {
        width: auto;
    }

    .print-date-num {
        font-size: 7pt;
        font-weight: normal;
        color: #666;
        margin-top: 1px;
    }

    .print-worker-row td {
        font-size: 9pt;
    }

    .print-worker-name {
        font-size: 9pt;
        font-weight: bold;
    }

    .print-cell {
        text-align: center;
        line-height: 1.2;
    }

    .print-off {
        color: #999;
        font-style: italic;
        font-size: 8pt;
    }

    .print-vacation {
        background: #f5f5f5 !important;
        font-weight: bold;
        font-size: 8pt;
    }

    .print-assigned {
        background: white;
    }

    .print-job-name {
        font-weight: bold;
        font-size: 9pt;
        margin-bottom: 1px;
    }

    .print-crew-size {
        font-size: 7pt;
        color: #666;
    }

    /* Prevent page breaks */
    .print-worker-row {
        page-break-inside: avoid;
    }

    thead {
        display: table-header-group;
    }
}

/* ============================================================================
   New Features: Planning Mode, Weekly Overview, Utilization, Suggestions
   ============================================================================ */

/* Planning Mode Button */
.toggle-btn.active {
    background: #2196F3;
    color: white;
    font-weight: 600;
}

/* Planning Mode - Larger demand count */
.planning-count {
    font-size: 18px;
    font-weight: bold;
    color: #2196F3;
}

/* Smart Suggestions Panel */
.suggestions-panel {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.suggestions-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.suggestions-panel h3 {
    margin: 0;
    font-size: 16px;
    color: #856404;
}

.suggestions-summary {
    margin-bottom: 12px;
    padding: 8px 12px;
    background: rgba(255, 193, 7, 0.2);
    border-radius: 4px;
    font-size: 14px;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.suggestion-item {
    background: white;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 12px;
}

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

.suggestion-job {
    font-weight: 600;
    color: #333;
}

.suggestion-date {
    font-size: 12px;
    color: #666;
    background: rgba(0,0,0,0.05);
    padding: 2px 8px;
    border-radius: 12px;
}

.suggestion-details {
    margin-bottom: 8px;
}

.suggestion-shortage {
    font-size: 13px;
    color: #856404;
}

.suggestion-workers {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 12px;
}

.suggestion-label {
    color: #666;
    font-weight: 500;
}

.suggestion-worker {
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.suggestion-more {
    color: #666;
    font-style: italic;
}

.suggestion-no-workers {
    font-size: 12px;
    color: #dc3545;
    font-style: italic;
}

/* Worker Utilization Panel */
.utilization-panel {
    background: white;
    border: 2px solid #2196F3;
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.utilization-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.utilization-panel h3 {
    margin: 0;
    font-size: 16px;
    color: #1976D2;
}

.utilization-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.utilization-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.utilization-item.util-low {
    background: #fff3cd;
    border-color: #ffc107;
}

.utilization-item.util-full {
    background: #d4edda;
    border-color: #28a745;
}

.util-icon {
    font-size: 18px;
}

.util-worker {
    display: flex;
    flex-direction: column;
    min-width: 120px;
}

.util-worker strong {
    font-size: 14px;
    color: #333;
}

.util-role {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
}

.util-bar-container {
    flex: 1;
}

.util-bar {
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.util-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #ffc107 70%, #dc3545 100%);
    transition: width 0.3s ease;
}

.util-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 80px;
}

.util-days {
    font-size: 12px;
    color: #666;
}

.util-percent {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

/* Weekly Overview Modal */
.modal-wide .modal-content {
    max-width: 95vw;
    width: 1200px;
}

.overview-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #dee2e6;
}

.overview-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.overview-table-wrapper {
    overflow-x: auto;
}

.overview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.overview-table thead {
    background: #343a40;
    color: white;
}

.overview-table th {
    padding: 12px 8px;
    text-align: center;
    border: 1px solid #495057;
    font-weight: 600;
}

.overview-worker-col {
    min-width: 150px;
    text-align: left !important;
}

.overview-day-col {
    min-width: 100px;
}

.overview-date-num {
    font-size: 11px;
    font-weight: normal;
    opacity: 0.9;
}

.overview-worker-row {
    border-bottom: 1px solid #dee2e6;
}

.overview-worker-row:hover {
    background: #f8f9fa;
}

.overview-worker-name {
    padding: 12px;
    font-weight: 600;
    background: #f8f9fa;
    border-right: 2px solid #dee2e6;
}

.overview-cell {
    padding: 10px 8px;
    text-align: center;
    border: 1px solid #dee2e6;
    vertical-align: middle;
}

.overview-cell.cell-vacation {
    background: #ffeaa7;
    font-weight: 600;
    color: #d63031;
}

.overview-cell.cell-off {
    background: #f1f3f5;
    color: #adb5bd;
    font-weight: 500;
}

.overview-cell.cell-full {
    background: #d4edda;
}

.overview-cell.cell-short {
    background: #fff3cd;
}

.overview-job-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.overview-crew-info {
    font-size: 11px;
    color: #666;
}

/* Enhanced Coverage Indicators */
.cell-no-demand {
    background: #f8f9fa;
}

.cell-empty {
    background: #ffe6e6;
    border: 2px solid #ff4444;
}

.cell-short {
    background: #fff3cd;
    border: 2px solid #ffc107;
}

.cell-full {
    background: #d4edda;
    border: 2px solid #28a745;
}

.cell-over {
    background: #d1ecf1;
    border: 2px solid #17a2b8;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .suggestions-panel,
    .utilization-panel {
        font-size: 13px;
    }

    .utilization-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .util-bar-container {
        width: 100%;
    }

    .util-stats {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
    }

    .modal-wide .modal-content {
        max-width: 100%;
        width: 100%;
    }

    .overview-table {
        font-size: 11px;
    }

    .overview-worker-col {
        min-width: 100px;
    }

    .overview-day-col {
        min-width: 70px;
    }
}
