/* =============================================
   SCHEDULER VIEW - Widok harmonogramu CRM
   ============================================= */

/* ===== OVERLAY ===== */
.scheduler-overlay {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gray-50);
    z-index: 90;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.scheduler-overlay.active {
    display: flex;
}

/* ===== SCHEDULER HEADER ===== */
.scheduler-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
    gap: 12px;
    flex-wrap: wrap;
}

.scheduler-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.scheduler-nav .btn {
    padding: 6px 10px;
    font-size: var(--text-base);
}

.scheduler-week-label {
    padding: 6px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: var(--text-md);
    font-weight: 600;
    background: var(--bg-surface);
    cursor: pointer;
    color: var(--gray-800);
    min-width: 220px;
    text-align: center;
    transition: background var(--transition-fast), border-color var(--transition-fast);
    white-space: nowrap;
}

.scheduler-week-label:hover {
    background: var(--gray-50);
    border-color: var(--primary);
}

.scheduler-week-label.month-active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Wyszukiwarka w nagłówku schedulera */
.sched-header-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    margin-left: 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    min-width: 180px;
    max-width: 280px;
}

.sched-header-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
    background: var(--bg-surface);
}

.sched-header-search i.fa-search {
    color: var(--gray-400);
    font-size: var(--text-xs);
    flex-shrink: 0;
}

.sched-header-search input {
    border: none;
    background: transparent;
    outline: none;
    flex: 1;
    font-size: var(--text-sm);
    color: var(--gray-700);
    min-width: 0;
}

.sched-header-search input::placeholder {
    color: var(--gray-400);
}

.sched-header-search .task-search-clear {
    display: none;
    border: none;
    background: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0 2px;
    font-size: var(--text-2xs);
}

.sched-header-search.has-query .task-search-clear {
    display: block;
}

.sched-header-search.has-query i.fa-search {
    color: var(--primary);
}

.scheduler-close-btn {
    margin-left: auto;
}

/* ===== WEEK OVERVIEW ===== */
.scheduler-week-overview {
    padding: 4px 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.sched-week-row {
    display: flex;
    gap: 3px;
}

.sched-week-day {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px 4px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 40px;
}

.sched-week-day:hover {
    background: var(--gray-100);
    border-color: var(--primary);
}

.sched-week-day.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.sched-week-day.empty {
    opacity: 0.5;
}

.sched-week-dayname {
    font-size: var(--text-2xs);
    font-weight: 600;
    text-transform: uppercase;
}

.sched-week-daynum {
    font-size: var(--text-sm);
    font-weight: 700;
}

.sched-week-day.active .sched-week-daynum {
    color: white;
}

.sched-week-count {
    font-size: var(--text-3xs);
    background: var(--gray-200);
    padding: 0px 5px;
    border-radius: 10px;
    margin-top: 0;
}

.sched-week-day.active .sched-week-count {
    background: rgba(255,255,255,0.3);
    color: white;
}

/* ===== TECH CHIPS FILTER ===== */
.scheduler-tech-filter {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 5px 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--gray-200);
    overflow-x: auto;
    flex-shrink: 0;
}

.sched-chip-row {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
}

.sched-chip-row-label {
    font-size: var(--text-2xs);
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    white-space: nowrap;
    min-width: 52px;
    letter-spacing: 0.3px;
}

.scheduler-tech-filter::-webkit-scrollbar {
    height: 4px;
}

.scheduler-tech-filter::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-sm);
}

.sched-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    cursor: pointer;
    font-size: var(--text-sm);
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.sched-chip-name-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
}

.sched-chip-firstname {
    font-size: var(--text-sm);
    font-weight: 600;
}

.sched-chip-lastname {
    font-size: var(--text-2xs);
    font-weight: 400;
    opacity: 0.7;
}

.sched-chip:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.sched-chip.active {
    border: 2px solid var(--chip-color, var(--primary));
    background: var(--bg-surface);
    color: #333;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--chip-color, var(--primary)) 35%, transparent);
    font-weight: 600;
    padding: 3px 9px; /* kompensacja grubszej ramki */
}

.sched-chip.sched-chip-pom {
    font-size: 11px;
    padding: 3px 9px;
    border-width: 2px;
}

.sched-chip.sched-chip-pom.open { border-color: #15803d; color: #14532d; background: #dcfce7; }
.sched-chip.sched-chip-pom.hold { border-color: #a16207; color: #713f12; background: #fef3c7; }
.sched-chip.sched-chip-pom.cancelled { border-color: #b91c1c; color: #7f1d1d; background: #fee2e2; }
.sched-chip.sched-chip-pom.other { border-color: #c2410c; color: #7c2d12; background: #ffedd5; }
.sched-chip.sched-chip-pom.missing { border-color: #4b5563; color: #111827; background: #e5e7eb; }

.sched-chip.sched-chip-pom:not(.active) {
    opacity: 0.55;
    filter: grayscale(0.15);
}

.sched-chip-row.sched-pom-filter-row .sched-chip-row-label {
    min-width: 40px;
}

.sched-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sched-chip-count {
    font-size: var(--text-2xs);
    background: rgba(0,0,0,0.1);
    padding: 1px 5px;
    border-radius: 10px;
}

.sched-chip.active .sched-chip-count {
    background: color-mix(in srgb, var(--chip-color, var(--primary)) 20%, transparent);
    color: #333;
    font-weight: 700;
}

/* ===== MAIN CONTENT SPLIT ===== */
.scheduler-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.scheduler-grid-area {
    flex: 1;
    overflow: auto;
    padding: 0;
}

.scheduler-analysis-panel {
    width: 340px;
    border-left: 1px solid var(--gray-200);
    background: var(--bg-surface);
    overflow-y: auto;
    padding: 16px;
    flex-shrink: 0;
}

/* ===== SCHED GRID ===== */
.sched-grid-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    height: 100%;
}

.sched-grid {
    display: flex;
    min-height: 100%;
}

.sched-col {
    flex-shrink: 0;
    border-right: 1px solid var(--gray-200);
}

.sched-time-col {
    width: 60px;
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--gray-50);
}

.sched-col-header {
    min-height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--gray-200);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
    position: sticky;
    top: 0;
    z-index: 3;
    gap: 2px;
    white-space: nowrap;
    overflow: hidden;
}

.sched-time-header {
    color: var(--gray-400);
    font-size: var(--text-lg);
}

.sched-tech-name {
    font-weight: 700;
    font-size: var(--text-base);
    display: flex;
    align-items: center;
    gap: 6px;
}

.sched-tech-name-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
}

.sched-tech-firstname {
    font-weight: 700;
}

.sched-tech-lastname {
    font-size: 0.8em;
    font-weight: 400;
    opacity: 0.7;
}

.sched-tech-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sched-tech-task-count {
    font-size: var(--text-xs);
    color: var(--gray-500);
}

/* Hotel badge w nagłówku kolumny dziennej */
.sched-tech-hotel {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: var(--text-xs);
    color: var(--primary, #3b82f6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.sched-tech-hotel i {
    font-size: 9px;
    flex-shrink: 0;
}

/* Hotel travel badge — widok dzienny (absolute positioned) */
.sched-day-hotel-badge {
    position: absolute;
    left: 4px;
    right: 4px;
    height: 16px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    font-weight: 600;
    color: var(--primary, #3b82f6);
    background: #eff6ff;
    border: 1px dashed #93c5fd;
    border-radius: 3px;
    padding: 0 5px;
    z-index: 3;
    white-space: nowrap;
    overflow: hidden;
}
.sched-day-hotel-badge i {
    font-size: 8px;
    flex-shrink: 0;
}
.sched-dhb-time {
    color: var(--gray-500);
    font-weight: 400;
    margin-left: auto;
}
.sched-day-hotel-badge.warn {
    color: var(--warning, #f59e0b);
    background: #fffbeb;
    border-color: #fcd34d;
}
.sched-day-hotel-badge.danger {
    color: var(--danger, #ef4444);
    background: #fef2f2;
    border-color: #fca5a5;
}

.sched-tech-col {
    min-width: 80px;
    transition: background var(--transition-normal);
}

.sched-tech-col.sched-drag-over {
    background: rgba(79, 70, 229, 0.05);
}

/* ===== COL BODY ===== */
.sched-col-body {
    position: relative;
}

.sched-time-slot {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 4px;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-100);
    font-feature-settings: "tnum" 1, "lnum" 1;
}

.sched-slots-bg {
    position: relative;
    width: 100%;
}

.sched-hour-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--gray-200);
    z-index: 0;
}

.sched-half-hour-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--gray-100);
    opacity: 0.7;
    z-index: 0;
}

/* ===== TASK BLOCKS ===== */
.sched-task-block {
    position: absolute;
    /* left i width ustawiane dynamicznie przez JS dla overlapping */
    box-sizing: border-box;
    border-radius: var(--radius-sm);
    padding: 4px 6px 4px 8px;
    cursor: grab;
    overflow: hidden;
    z-index: 1;
    transition: box-shadow var(--transition-fast), transform var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    font-size: calc(9px * var(--sched-font-scale, 1));
    text-align: left;
    font-feature-settings: "tnum" 1, "lnum" 1;
}

/* Full mode: emphasised left bar + soft shadow on hover for clearer hierarchy */
.sched-task-block:not(.sched-compact) {
    border-left-width: 4px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}
.sched-task-block:not(.sched-compact):hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

/* ===== ADAPTIVE HEIGHT TIERS ===== */
/* Inline row used for tiny/small blocks */
.sched-task-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
}
.sched-task-inline .sched-task-time {
    flex-shrink: 0;
}
.sched-task-inline .sched-task-address {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sched-inline-sep {
    flex-shrink: 0;
    color: var(--gray-400);
    font-size: calc(8px * var(--sched-font-scale, 1));
}

/* Tiny: < 28px — single line, minimal padding */
.sched-task-block.sched-h-tiny {
    padding: 1px 3px;
    gap: 0;
    justify-content: center;
}
.sched-task-block.sched-h-tiny .sched-task-time {
    font-size: calc(8px * var(--sched-font-scale, 1));
}
.sched-task-block.sched-h-tiny .sched-task-address {
    font-size: calc(8px * var(--sched-font-scale, 1));
}

/* Small: < 42px — one line with full time range + city */
.sched-task-block.sched-h-small {
    padding: 2px 4px;
    gap: 0;
    justify-content: center;
}

/* Medium: < 60px — two lines, tighter spacing */
.sched-task-block.sched-h-medium {
    padding: 2px 4px;
    gap: 0;
}

.sched-task-block:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(2px);
    z-index: 2;
}

.sched-task-block.sched-dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: scale(0.95);
}

.sched-task-block.status-complete {
    opacity: 0.7;
}

.sched-task-block.status-complete::after {
    content: '✔';
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: calc(14px * var(--sched-font-scale, 1));
    color: var(--success);
    font-weight: bold;
}

.sched-task-block.status-cancelled {
    opacity: 0.4;
    text-decoration: line-through;
}

/* Status inny niż Planned - czerwona czcionka */
.sched-task-block.status-not-planned,
.sched-task-block.status-not-planned .sched-task-time,
.sched-task-block.status-not-planned .sched-task-address,
.sched-task-block.status-not-planned .sched-compact-time,
.sched-task-block.status-not-planned .sched-compact-city,
.sched-task-block.status-not-planned .sched-compact-line {
    color: #e53935;
}

.sched-week-task.status-not-planned.status-not-planned,
.sched-week-task.status-not-planned.status-not-planned .task-time,
.sched-week-task.status-not-planned.status-not-planned .task-city,
.sched-week-task.status-not-planned.status-not-planned .wt-type,
.sched-week-task.status-not-planned.status-not-planned .wt-top,
.sched-week-task.status-not-planned.status-not-planned .wt-bottom {
    color: #e53935;
}

.status-task-item.status-not-planned,
.status-task-item.status-not-planned .status-task-tech,
.status-task-item.status-not-planned .status-task-date,
.status-task-item.status-not-planned .status-task-addr {
    color: #e53935;
}

/* ===== ZMODYFIKOWANE ZADANIA ===== */
.sched-task-block.sched-task-modified {
    box-shadow: 0 0 0 2px #e5393588, var(--shadow-sm);
    animation: modified-pulse 2s ease-in-out infinite;
}

@keyframes modified-pulse {
    0%, 100% { box-shadow: 0 0 0 2px #e5393588; }
    50% { box-shadow: 0 0 0 3px #e53935cc, 0 0 8px #e5393544; }
}

.sched-task-modified-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: var(--text-sm);
    color: #e53935;
    background: #ffebee;
    border: 1px solid #e5393555;
    border-radius: var(--radius-sm);
    padding: 0;
    cursor: pointer;
    transition: all 0.12s;
}

.sched-task-modified-badge:hover {
    background: #e53935;
    color: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    transform: scale(1.05);
}

.sched-task-modified-badge i {
    font-size: var(--text-sm);
    line-height: 1;
}

/* Week view modified task */
.sched-week-task.sched-task-modified {
    box-shadow: 0 0 0 2px #e5393588;
    animation: modified-pulse 2s ease-in-out infinite;
}

.sched-week-mod-icon {
    position: absolute;
    top: -2px;
    right: -2px;
    color: #e53935;
    font-size: var(--text-md);
    cursor: pointer;
    padding: 4px 5px;
    min-width: 24px;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: #ffebee;
    border: 1px solid #e5393540;
    transition: all var(--transition-fast);
    line-height: 1;
    z-index: 5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.sched-week-mod-icon:hover {
    color: white;
    background: #e53935;
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(229,57,53,0.35);
}

/* ===== SHOOTING KEPT (House visit exception — red border) ===== */
.sched-task-block.sched-task-shooting-kept,
.sched-week-task.sched-task-shooting-kept {
    box-shadow: 0 0 0 2.5px #cc0000, 0 0 8px #cc000044;
    animation: shooting-kept-pulse 3s ease-in-out infinite;
    position: relative;
}

.sched-task-block.sched-task-shooting-kept::before,
.sched-week-task.sched-task-shooting-kept::before {
    content: '\f015';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    color: #cc0000;
    background: #fff0f0;
    border: 1px solid #cc000066;
    border-radius: 3px;
    padding: 1px 3px;
    line-height: 1;
    z-index: 5;
}

@keyframes shooting-kept-pulse {
    0%, 100% { box-shadow: 0 0 0 2.5px #cc0000; }
    50% { box-shadow: 0 0 0 3px #cc0000cc, 0 0 10px #cc000044; }
}

/* ===== MULTI-SELECT ===== */
.sched-task-block.sched-task-selected.sched-task-selected,
.sched-week-task.sched-task-selected.sched-task-selected {
    outline: 2.5px solid #1976d2;
    outline-offset: -2px;
    box-shadow: 0 0 0 3px #1976d240;
    z-index: 10;
}

.sched-task-block.sched-task-selected::after,
.sched-week-task.sched-task-selected::after {
    content: '';
    position: absolute;
    inset: 0;
    background: #1976d210;
    pointer-events: none;
    border-radius: inherit;
}

.sched-multi-select-badge {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1565c0;
    color: white;
    border-radius: var(--radius-xl);
    padding: 7px 18px;
    font-size: var(--text-base);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px #0005;
    z-index: 9999;
    pointer-events: none;
    animation: fadeInUp 0.2s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== CHIP SEPARATOR ===== */
.sched-chip-separator {
    display: inline-block;
    width: 1px;
    height: 20px;
    background: var(--gray-300);
    margin: 0 4px;
    vertical-align: middle;
}

/* Group chip partial selection */
.sched-chip.sched-chip-group.partial {
    border-style: dashed;
    border-color: var(--gray-400);
    background: var(--gray-50);
}

.sched-task-time {
    font-weight: 700;
    font-size: calc(11px * var(--sched-font-scale, 1));
    color: var(--gray-700);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.sched-task-address {
    font-weight: 600;
    font-size: calc(11px * var(--sched-font-scale, 1));
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.sched-task-street {
    font-weight: 400;
    font-size: calc(8px * var(--sched-font-scale, 1));
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.sched-task-type {
    font-size: calc(9px * var(--sched-font-scale, 1));
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.sched-task-status {
    font-size: calc(9px * var(--sched-font-scale, 1));
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sched-task-status.status-complete { color: var(--success); }
.sched-task-status.status-planned { color: var(--primary); }
.sched-task-status.status-progress { color: var(--warning); }
.sched-task-status.status-cancelled { color: var(--danger); }
.sched-task-status.status-sent-back { color: #f59e0b; }

/* Distance warnings on tasks */
.sched-task-warning,
.sched-task-distance {
    font-size: calc(9px * var(--sched-font-scale, 1));
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    margin-top: 1px;
}

.sched-task-warning i {
    font-size: calc(12px * var(--sched-font-scale, 1));
}

.sched-task-warning.danger {
    color: var(--danger);
    font-weight: 700;
}

.sched-task-warning.warn {
    color: var(--warning);
    font-weight: 600;
}

.sched-task-distance {
    color: var(--gray-400);
}

/* ===== EMPTY STATE ===== */
.sched-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--gray-400);
    gap: 10px;
}

.sched-empty i {
    font-size: 48px;
}

.sched-empty .hint {
    font-size: var(--text-base);
    color: var(--gray-400);
}

/* ===== TASK DETAIL POPUP ===== */
.sched-task-detail {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    z-index: 200;
    width: 400px;
    max-width: 90vw;
    animation: schedDetailIn 0.2s ease;
}

@keyframes schedDetailIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.sched-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.sched-detail-header h3 {
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sched-detail-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sched-detail-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-base);
}

.sched-detail-row i {
    color: var(--gray-400);
    width: 16px;
    text-align: center;
}

.sched-detail-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-200);
}

.sched-detail-reassign {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sched-detail-reassign label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-500);
}

.sched-detail-reassign select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
}

/* ===== ANALYSIS PANEL ===== */
.sched-analysis-section {
    margin-bottom: 20px;
}

.sched-analysis-section h4 {
    font-size: var(--text-base);
    color: var(--gray-600);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sched-stats-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sched-stat-card {
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.sched-stat-name {
    font-weight: 700;
    font-size: var(--text-sm);
    color: var(--gray-700);
}

.sched-stat-value {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--gray-800);
}

.sched-stat-detail {
    display: flex;
    gap: 12px;
    font-size: var(--text-xs);
    color: var(--gray-500);
    margin-top: 4px;
}

.sched-stat-detail span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

/* ===== ISSUES LIST ===== */
.sched-issues-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sched-issue {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    line-height: 1.4;
}

.sched-issue.danger {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
}

.sched-issue.warning {
    background: rgba(245, 158, 11, 0.08);
    color: var(--warning);
}

.sched-issue.info {
    background: rgba(59, 130, 246, 0.08);
    color: #3b82f6;
}

.sched-issue i { margin-top: 2px; flex-shrink: 0; }

/* ===== SUGGESTIONS ===== */
.sched-suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sched-suggestion {
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius);
    padding: 10px 12px;
}

.sched-suggestion-text {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.sched-suggestion-detail {
    font-size: var(--text-xs);
    color: var(--gray-500);
    line-height: 1.4;
    margin-bottom: 8px;
}

.sched-all-good {
    text-align: center;
    padding: 20px;
    color: var(--success);
    font-size: var(--text-md);
    font-weight: 600;
}

.sched-all-good i {
    font-size: 24px;
    display: block;
    margin-bottom: 4px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .scheduler-analysis-panel {
        width: 280px;
    }
    
    .sched-tech-col {
        min-width: 160px;
    }
}

@media (max-width: 768px) {
    .scheduler-body {
        flex-direction: column;
    }
    
    .scheduler-analysis-panel {
        width: 100%;
        max-height: 250px;
        border-left: none;
        border-top: 1px solid var(--gray-200);
    }
    
    .scheduler-header {
        padding: 8px 12px;
        gap: 8px;
    }
    
    .scheduler-date-label {
        font-size: var(--text-md);
        min-width: auto;
    }
}

/* ===== SCHEDULER TOGGLE BUTTON ===== */
.btn.scheduler-toggle.active {
    background: var(--primary);
    color: white;
}

/* ===== VIEW TOGGLE & ZOOM ===== */
.sched-view-toggle {
    display: flex;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.sched-view-toggle .btn {
    border: none;
    border-radius: 0;
    padding: 5px 10px;
    font-size: var(--text-sm);
    background: var(--bg-surface);
    color: var(--gray-500);
}

.sched-view-toggle .btn.active {
    background: var(--primary);
    color: white;
}

.sched-view-toggle .btn:first-child {
    border-right: 1px solid var(--gray-300);
}

.sched-zoom-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 2px 4px;
    background: var(--bg-surface);
}

.sched-zoom-controls .btn {
    border: none;
    padding: 3px 6px;
    font-size: var(--text-sm);
    background: transparent;
    color: var(--gray-600);
    min-width: auto;
}

.sched-zoom-controls .btn:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.sched-zoom-label {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--gray-600);
    min-width: 36px;
    text-align: center;
    user-select: none;
}

.sched-header-sep {
    width: 1px;
    height: 24px;
    background: var(--gray-300);
    margin: 0 4px;
}

/* ===== COMPACT VIEW ===== */
.sched-task-block.sched-compact {
    padding: 2px 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0;
    border-left-width: 3px;
    /* Visual differentiation from full mode: subtle background, no shadow */
    box-shadow: none;
    font-feature-settings: "tnum" 1, "lnum" 1;
}

.sched-task-block.sched-compact:hover {
    box-shadow: var(--shadow-sm);
}

.sched-compact-line {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    overflow: hidden;
    line-height: 1.15;
}

.sched-compact-time {
    font-weight: 700;
    font-size: calc(10px * var(--sched-font-scale, 1));
    color: var(--gray-700);
    white-space: nowrap;
    flex: 0 0 auto;
    letter-spacing: -0.01em;
}

.sched-compact-sep {
    color: var(--gray-400);
    font-weight: 600;
    flex: 0 0 auto;
}

.sched-compact-city {
    font-weight: 600;
    font-size: calc(10px * var(--sched-font-scale, 1));
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
    min-width: 0;
}

.sched-compact-check {
    color: var(--success);
    font-size: calc(10px * var(--sched-font-scale, 1));
    flex-shrink: 0;
}

.sched-compact .sched-task-warning,
.sched-compact .sched-task-distance {
    font-size: calc(9px * var(--sched-font-scale, 1));
    margin-top: 0;
}

/* ===== SCHEDULER HEADER RIGHT ===== */
.scheduler-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.sched-badge {
    font-size: var(--text-2xs);
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--danger);
    color: white;
    font-weight: 700;
    margin-left: 4px;
    padding: 0 4px;
}

/* ===== TRASH BADGE & ANIMATIONS ===== */
.trash-badge {
    background: #dc2626;
}

/* Pulse animation on trash button when item is added */
@keyframes trash-pulse {
    0%   { transform: scale(1);   box-shadow: none; }
    30%  { transform: scale(1.15); box-shadow: 0 0 12px rgba(220,38,38,0.5); }
    60%  { transform: scale(1.05); box-shadow: 0 0 6px rgba(220,38,38,0.3); }
    100% { transform: scale(1);   box-shadow: none; }
}
#trash-btn.trash-pulse {
    animation: trash-pulse 0.6s ease-out;
}
#trash-btn.trash-has-items {
    color: #dc2626;
}
#trash-btn.trash-has-items i.fa-trash {
    color: #dc2626;
}

/* Fade-out animation for deleted tasks */
@keyframes task-fade-out {
    0%   { opacity: 1; transform: scale(1) translateX(0); background-color: inherit; }
    40%  { opacity: 0.7; background-color: rgba(220,38,38,0.12); }
    100% { opacity: 0; transform: scale(0.95) translateX(30px); }
}
.task-deleting {
    animation: task-fade-out 0.45s ease-out forwards;
    pointer-events: none;
}

/* ===== HISTORY PANEL ===== */
.sched-history-panel {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    width: 480px;
    max-width: 90vw;
    max-height: 80vh;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    z-index: 210;
    display: flex;
    flex-direction: column;
    animation: schedDetailIn 0.2s ease;
}

.sched-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.sched-history-header h3 {
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sched-history-actions {
    display: flex;
    gap: 6px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--gray-100);
    flex-wrap: wrap;
}

.sched-history-list {
    overflow-y: auto;
    flex: 1;
    padding: 8px 12px;
}

.sched-history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--gray-400);
    gap: 8px;
}

.sched-history-empty i { font-size: 32px; }

.sched-history-item {
    display: flex;
    gap: 10px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--gray-100);
    align-items: flex-start;
}

.sched-history-item:last-child { border-bottom: none; }

.sched-history-nr {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--gray-400);
    min-width: 28px;
    padding-top: 2px;
}

.sched-history-content {
    flex: 1;
    min-width: 0;
}

.sched-history-address {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.sched-history-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-sm);
    margin-bottom: 4px;
}

.sched-history-from {
    color: var(--danger);
    font-weight: 600;
}

.sched-history-arrow {
    color: var(--gray-400);
    font-size: var(--text-2xs);
}

.sched-history-to {
    color: var(--success);
    font-weight: 600;
}

.sched-history-time {
    display: flex;
    gap: 12px;
    font-size: var(--text-xs);
    color: var(--gray-400);
}

.sched-history-time span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== WIDOK TYGODNIOWY - TECHNICY OBOK SIEBIE ===== */
.sched-view-sep {
    width: 1px;
    height: 20px;
    background: var(--gray-300);
    margin: 0 4px;
}

.sched-week-wrapper {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sched-week-scroll {
    flex: 1;
    overflow: auto;
    padding: 10px;
}

/* Nagłówek z technikami - sticky */
.sched-week-tech-header-row {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg-surface);
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 5px;
}

.sched-week-day-label-corner {
    width: 70px;
    min-width: 70px;
    padding: 6px 4px;
    font-weight: 600;
    font-size: var(--text-2xs);
    color: var(--gray-500);
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    left: 0;
    z-index: 21;
}

.sched-week-tech-col-header {
    padding: 5px 4px;
    text-align: center;
    background: var(--gray-50);
    border-left: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    flex: 0 0 auto;
    box-sizing: border-box;
}

.sched-week-tech-col-header .tech-name {
    font-weight: 700;
    font-size: var(--text-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.15;
}

.sched-week-tech-col-header .tech-name .sched-tech-firstname {
    font-weight: 700;
}

.sched-week-tech-col-header .tech-name .sched-tech-lastname {
    font-size: var(--text-2xs);
    font-weight: 400;
    opacity: 0.7;
}

.sched-week-tech-col-header .tech-count {
    font-size: var(--text-2xs);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Separator między grupami (technicy | konstrukcja) */
.sched-week-group-sep {
    width: 3px;
    min-width: 3px;
    background: linear-gradient(to bottom, var(--gray-300), var(--gray-200));
    flex-shrink: 0;
}

.sched-week-group-sep-day {
    width: 3px;
    min-width: 3px;
    background: linear-gradient(to bottom, transparent, var(--gray-300), transparent);
    flex-shrink: 0;
}

/* Ikony grup */
.sched-group-icon {
    font-size: 8px;
    opacity: 0.6;
}
.sched-group-icon.tech { color: var(--primary); }
.sched-group-icon.konstr { color: var(--warning); }

/* Sekcje dni */
.sched-week-day-section {
    display: flex;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    margin-bottom: 6px;
    background: var(--bg-surface);
    overflow: hidden;
    min-width: fit-content;
}

.sched-week-day-section.empty {
    opacity: 0.6;
}

.sched-week-day-section.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary-light);
}

.sched-week-day-label {
    width: 70px;
    min-width: 70px;
    padding: 6px 4px;
    background: var(--gray-50);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    cursor: pointer;
    transition: background var(--transition-fast);
    position: sticky;
    left: 0;
    z-index: 5;
}

.sched-week-day-label:hover {
    background: var(--primary-light);
}

.sched-week-day-section.active .sched-week-day-label {
    background: var(--primary);
    color: white;
}

.sched-week-day-label .day-name {
    font-size: var(--text-2xs);
    font-weight: 600;
    text-transform: uppercase;
}

.sched-week-day-label .day-num {
    font-size: 16px;
    font-weight: 700;
}

.sched-week-day-label .day-count {
    font-size: var(--text-3xs);
    background: rgba(0, 0, 0, 0.1);
    padding: 1px 6px;
    border-radius: 10px;
}

.sched-week-day-section.active .sched-week-day-label .day-count {
    background: rgba(255, 255, 255, 0.3);
}

/* Kontener kolumn techników w dniu */
.sched-week-day-techs {
    display: flex;
    flex: 0 0 auto;
}

.sched-week-tech-col {
    border-left: 1px solid var(--gray-100);
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-height: 40px;
    flex: 0 0 auto;
    box-sizing: border-box;
}

.sched-week-tech-col:first-child {
    border-left: none;
}

.sched-week-tech-col.empty {
    background: var(--gray-50);
    justify-content: center;
    align-items: center;
}

.sched-week-no-tasks {
    color: var(--gray-300);
    font-size: var(--text-lg);
}

/* Wiersz nakładających się zadań — renderowane obok siebie (flex row) zamiast pod sobą.
   Każde zadanie w wierszu zajmuje równą część dostępnej szerokości. */
.sched-week-overlap-row {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 3px;
    width: 100%;
}

.sched-week-overlap-row > .sched-week-task {
    flex: 1 1 0;
    min-width: 0;
}

.sched-week-overlap-row > .sched-week-task:hover {
    transform: none;
}

/* Bloki zadań */
.sched-week-task {
    border-radius: var(--radius-sm);
    padding: 3px 5px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
    align-items: stretch;
    gap: 1px;
    transition: transform 0.1s, box-shadow 0.1s;
    overflow: hidden;
    border-left: 3px solid transparent;
}

.sched-week-task:hover {
    transform: translateX(2px);
    box-shadow: var(--shadow-sm);
}

/* ---- Widok KOMPAKTOWY ---- */
.sched-week-task.compact {
    padding: 1px 4px;
    gap: 0;
    border-radius: var(--radius-xs);
    border-left-width: 2px;
    opacity: 0.92;
    min-height: auto !important;
}

.sched-week-task.compact .wt-top {
    display: flex;
    align-items: center;
    gap: 3px;
    overflow: hidden;
}

.sched-week-task.compact .wt-bottom {
    display: flex;
    align-items: center;
    gap: 3px;
    overflow: hidden;
}

.sched-week-task.compact .task-time {
    font-weight: 700;
    font-size: var(--text-3xs);
    color: var(--gray-600);
    white-space: nowrap;
    letter-spacing: -0.3px;
    flex-shrink: 0;
}

.sched-week-task.compact .task-city {
    font-size: var(--text-3xs);
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.sched-week-task.compact .wt-type {
    font-size: 7px;
    font-weight: 600;
    padding: 0 3px;
    border-radius: 2px;
    background: rgba(0,0,0,0.05);
    color: var(--gray-400);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    flex-shrink: 0;
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Hide verbose textual "zmieniono" badges inside week view to reduce clutter.
   Use the corner badge (.sched-week-mod-icon) instead. */
.sched-week-task .sched-task-modified-badge {
    /* keep visible: now icon-only badge */
    display: inline-flex;
}

/* Tune corner badge for compact and full week blocks */
.sched-week-task.compact .sched-week-mod-icon {
    top: 2px;
    right: 4px;
    font-size: var(--text-sm);
    padding: 2px 3px;
    min-width: 18px;
    min-height: 18px;
}

.sched-week-task.full .sched-week-mod-icon {
    top: -4px;
    right: -4px;
    font-size: var(--text-md);
    padding: 3px 4px;
    min-width: 22px;
    min-height: 22px;
}

/* ---- Widok NORMALNY (pełny) ---- */
.sched-week-task.full {
    padding: 4px 6px;
    gap: 1px;
    border-radius: 5px;
    border-left-width: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.sched-week-task.full .task-time {
    font-weight: 700;
    font-size: var(--text-2xs);
    color: var(--gray-700);
    white-space: nowrap;
}

.sched-week-task.full .task-city {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
}

.sched-week-task.full .task-street {
    font-size: var(--text-3xs);
    font-weight: 400;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
}

.sched-week-task.full .wt-type {
    font-size: 8px;
    font-weight: 600;
    padding: 0px 4px;
    border-radius: var(--radius-xs);
    background: rgba(0,0,0,0.06);
    color: var(--gray-500);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    flex-shrink: 0;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Wiersze wt-top i wt-bottom */
.wt-top {
    display: flex;
    align-items: center;
    gap: 3px;
    overflow: hidden;
    flex-wrap: nowrap;
}

.wt-bottom {
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ---- Dojazdy między zadaniami (weekly) ---- */
.sched-week-travel {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    font-size: var(--text-2xs);
    font-weight: 600;
    color: var(--gray-400);
    border-left: 2px dotted var(--gray-300);
    margin: 1px 0 1px 6px;
    line-height: 1.2;
    cursor: default;
}

.sched-week-travel i {
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.sched-week-travel.warn {
    color: var(--warning);
    border-left-color: var(--warning);
}

.sched-week-travel.danger {
    color: var(--danger);
    border-left-color: var(--danger);
    font-weight: 700;
}

.sched-week-travel.late {
    color: var(--danger);
    border-left-color: var(--danger);
}

.sched-week-travel .wt-late {
    font-weight: 700;
    color: var(--danger);
    margin-left: 2px;
    font-size: 8px;
}

/* Brak GPS */
.sched-week-travel.no-gps,
.sched-task-distance.no-gps {
    color: var(--gray-300);
    font-style: italic;
    border-left-color: var(--gray-200);
}

/* Hotel travel badge */
.sched-week-travel.hotel {
    color: var(--primary, #3b82f6);
    border-left: 2px dotted var(--primary, #3b82f6);
    opacity: 0.75;
}
.sched-week-travel.hotel.warn {
    color: var(--warning);
    border-left-color: var(--warning);
    opacity: 1;
}
.sched-week-travel.hotel.danger {
    color: var(--danger);
    border-left-color: var(--danger);
    opacity: 1;
}
.sched-week-travel .wt-time {
    font-size: 8px;
    color: var(--gray-400);
    margin-left: 1px;
}

/* W trybie kompaktowym dojazdy wyświetlane zawsze (mniejsza skala) */

/* Panel analizy tygodniowej na dole */
.sched-week-analysis {
    margin-top: 15px;
    background: var(--bg-surface);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}

.sched-week-pom-legend {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-25, #fafafa);
}

.sched-week-inline-pom-legend {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0 10px;
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: #ffffff;
}

.sched-week-pom-pill {
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    padding: 2px 10px;
    border: 1px solid transparent;
}

.sched-week-pom-pill.open { background: #86efac; border-color: #15803d; color: #14532d; }
.sched-week-pom-pill.hold { background: #fde047; border-color: #a16207; color: #713f12; }
.sched-week-pom-pill.cancelled { background: #fca5a5; border-color: #b91c1c; color: #7f1d1d; }
.sched-week-pom-pill.other { background: #fdba74; border-color: #c2410c; color: #7c2d12; }
.sched-week-pom-pill.missing { background: #d1d5db; border-color: #4b5563; color: #111827; }

.sched-week-analysis-header {
    padding: 10px 15px;
    font-weight: 600;
    font-size: var(--text-base);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sched-week-analysis-header i {
    color: var(--primary);
}

.sched-week-analysis-content {
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sched-week-tech-stat {
    flex: 1;
    min-width: 180px;
    max-width: 250px;
    background: var(--gray-50);
    border-radius: 6px;
    padding: 8px;
}

.sched-week-tech-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 8px;
    margin-bottom: 8px;
}

.sched-week-tech-stat-header span:first-child {
    font-weight: 700;
    font-size: var(--text-sm);
}

.sched-week-tech-stat-header .stat-total {
    font-size: var(--text-2xs);
    color: var(--gray-500);
}

.sched-week-mini-chart {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 50px;
    padding: 0 4px;
}

.sched-week-mini-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.sched-week-mini-bar .bar {
    width: 16px;
    border-radius: 2px 2px 0 0;
    min-height: 2px;
}

.sched-week-mini-bar .day {
    font-size: 8px;
    color: var(--gray-500);
    font-weight: 600;
}

.sched-week-mini-bar .count {
    font-size: var(--text-3xs);
    font-weight: 700;
    color: var(--gray-700);
}

/* Przycisk widoku dziennego/tygodniowego */
#sched-view-day-btn.active,
#sched-view-week-btn.active {
    background: var(--primary);
    color: white;
}

/* ===== MINI MAP OVERLAY (w schedulerze) ===== */
.mini-map-overlay {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 320px;
    height: 240px;
    min-width: 200px;
    min-height: 150px;
    max-width: 80vw;
    max-height: 70vh;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    z-index: 95;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    resize: both;
    border: 2px solid var(--gray-300);
}

.mini-map-overlay .mini-map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: var(--gray-800);
    color: white;
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: move;
    flex-shrink: 0;
    user-select: none;
}

.mini-map-overlay .mini-map-header i {
    font-size: var(--text-sm);
}

.mini-map-overlay .mini-map-header .mini-map-actions {
    display: flex;
    gap: 6px;
}

.mini-map-overlay .mini-map-header .mini-map-actions button {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: var(--text-sm);
    padding: 2px;
}

.mini-map-overlay .mini-map-header .mini-map-actions button:hover {
    color: white;
}

.mini-map-overlay .mini-map-body {
    flex: 1;
    position: relative;
}

.mini-map-overlay .mini-map-body #mini-map-container {
    width: 100%;
    height: 100%;
}

/* Minimap hotel markers */
.minimap-hotel-icon {
    background: none !important;
    border: none !important;
}
.minimap-hotel-label {
    background: rgba(255, 255, 255, 0.92);
    border: 1.5px solid #6366f1;
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    color: #4338ca;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
    line-height: 1.3;
}

/* ===== SCHEDULER CONTEXT MENU (prawy klik na zadanie) ===== */
.sched-context-menu {
    position: fixed;
    background: var(--bg-surface);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    min-width: 200px;
    padding: 6px 0;
    z-index: 10000;
    display: none;
}

.sched-context-menu.active {
    display: block;
}

.sched-context-menu .sched-ctx-header {
    padding: 8px 14px;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sched-context-menu .sched-ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: var(--text-base);
    transition: background var(--transition-fast);
}

.sched-context-menu .sched-ctx-item:hover {
    background: var(--gray-50);
}

.sched-context-menu .sched-ctx-item i {
    width: 16px;
    color: var(--gray-400);
}

.sched-context-menu .sched-ctx-separator {
    height: 1px;
    background: var(--gray-200);
    margin: 4px 0;
}

.sched-context-menu .sched-ctx-danger {
    color: var(--danger);
}
.sched-context-menu .sched-ctx-danger i {
    color: var(--danger);
}
.sched-context-menu .sched-ctx-danger:hover {
    background: #fee2e2;
}

.sched-context-menu .sched-ctx-disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}

/* ===== LOCKED TASK STYLING ===== */
.sched-task-locked {
    background-image: repeating-linear-gradient(
        -45deg,
        transparent, transparent 5px,
        rgba(0,0,0,0.04) 5px, rgba(0,0,0,0.04) 10px
    ) !important;
    cursor: not-allowed !important;
}

.sched-task-locked::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1.5px dashed rgba(100,100,100,0.35);
    border-radius: inherit;
    pointer-events: none;
}

.sched-lock-icon {
    font-size: 8px;
    color: #b91c1c;
    opacity: 0.7;
    flex-shrink: 0;
}

.sched-week-task.sched-task-locked {
    cursor: not-allowed !important;
}

.sched-task-block.sched-task-locked {
    position: relative;
}

/* ===== TIME EDIT MODAL ===== */
.time-edit-modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 10001;
}

.time-edit-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 24px;
    z-index: 10002;
    min-width: 320px;
    max-width: 400px;
}

.time-edit-modal h3 {
    margin-bottom: 4px;
    font-size: var(--text-lg);
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-edit-modal .time-edit-address {
    font-size: var(--text-sm);
    color: var(--gray-500);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-edit-modal .time-edit-address > span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Copy-raw-address inline button (used in detail/edit modals, history rows, sidebar list) */
.sched-copy-raw,
.task-copy-raw {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: var(--gray-500);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11px;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sched-copy-raw:hover,
.task-copy-raw:hover {
    background: var(--gray-100);
    color: var(--primary);
    border-color: var(--gray-200);
}

.sched-detail-address-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sched-detail-address-row > strong {
    flex: 1;
    min-width: 0;
}

.task-item .task-copy-raw {
    opacity: 0;
    margin-left: auto;
}

.task-item:hover .task-copy-raw,
.task-item:focus-within .task-copy-raw {
    opacity: 1;
}

.time-edit-modal .time-edit-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.time-edit-modal .time-edit-row label {
    font-size: var(--text-base);
    font-weight: 600;
    min-width: 80px;
    color: var(--gray-600);
}

.time-edit-modal .time-edit-row input[type="time"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: var(--text-md);
    font-family: inherit;
}

.time-edit-modal .time-edit-row input[type="time"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.time-edit-modal .time-edit-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* ===== TASK EDIT - SELECT, DATE, CHECKBOX ===== */
.time-edit-modal .task-edit-select,
.time-edit-modal input[type="date"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: var(--text-md);
    font-family: inherit;
    background: var(--bg-surface);
    cursor: pointer;
}

.time-edit-modal .task-edit-select:focus,
.time-edit-modal input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.time-edit-modal .time-edit-checkbox-row {
    margin-top: 4px;
    margin-bottom: 8px;
}

.time-edit-modal .task-edit-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--gray-600);
    min-width: auto;
}

.time-edit-modal .task-edit-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

#multiday-fields {
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin-bottom: 12px;
    border: 1px dashed var(--gray-300);
}

/* ===== MULTI-DAY TASK INDICATORS ===== */
.sched-multiday-icon {
    font-size: var(--text-3xs);
    color: #8b5cf6;
    margin: 0 2px;
    vertical-align: middle;
}

.sched-task-multiday {
    font-size: var(--text-3xs);
    color: #8b5cf6;
    font-weight: 600;
    padding: 1px 4px;
    background: #8b5cf610;
    border-radius: var(--radius-xs);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sched-week-multiday {
    border-right: 2px dashed #8b5cf6;
}

/* ===== HISTORY DIFF MARKERS ===== */
.sched-history-item.no-change {
    opacity: 0.4;
    text-decoration: line-through;
}

.sched-history-diff-label {
    font-size: var(--text-2xs);
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 600;
    margin-left: 6px;
}

.sched-history-diff-label.changed {
    background: #fef3c7;
    color: #92400e;
}

.sched-history-diff-label.reverted {
    background: #d1fae5;
    color: #065f46;
}

.sched-history-diff-label.time-changed {
    background: #dbeafe;
    color: #1e40af;
}

.sched-history-diff-label.date-changed {
    background: #fce7f3;
    color: #9d174d;
}

/* ===== TRAVEL BLOCKS (dojazdy między zadaniami) ===== */
.sched-travel-block {
    position: absolute;
    box-sizing: border-box;
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    z-index: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-3xs);
    font-weight: 600;
    background: repeating-linear-gradient(
        -45deg,
        rgba(59, 130, 246, 0.06),
        rgba(59, 130, 246, 0.06) 4px,
        rgba(59, 130, 246, 0.12) 4px,
        rgba(59, 130, 246, 0.12) 8px
    );
    border: 1px dashed rgba(59, 130, 246, 0.35);
    color: #3b82f6;
    overflow: hidden;
    pointer-events: none;
}

.sched-travel-block i {
    font-size: var(--text-3xs);
    flex-shrink: 0;
}

.sched-travel-block .travel-dist {
    margin-left: auto;
    opacity: 0.7;
    font-size: 8px;
}

.sched-travel-block.late {
    background: repeating-linear-gradient(
        -45deg,
        rgba(239, 68, 68, 0.06),
        rgba(239, 68, 68, 0.06) 4px,
        rgba(239, 68, 68, 0.12) 4px,
        rgba(239, 68, 68, 0.12) 8px
    );
    border: 1px dashed rgba(239, 68, 68, 0.5);
    color: var(--danger);
}

/* ===== PRZYCISK DOJAZDY/SPÓŹNIENIA (aktywny stan) ===== */
#sched-travel-btn.active {
    background: var(--info);
    color: white;
}

#sched-delays-btn.active {
    background: var(--warning);
    color: white;
}

/* ===== PANEL SPÓŹNIEŃ (delays) ===== */
.sched-delays-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.delays-count {
    font-weight: 700;
    font-size: var(--text-md);
    color: #dc2626;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sched-delays-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sched-delay-item {
    background: var(--bg-surface);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}

.sched-delay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #fef2f2;
}

.delay-tech {
    font-weight: 700;
    font-size: var(--text-base);
    color: var(--gray-800);
}

.delay-badge {
    font-size: var(--text-xs);
    font-weight: 700;
    color: white;
    background: var(--danger);
    padding: 2px 8px;
    border-radius: 10px;
}

.sched-delay-body {
    padding: 8px 12px;
}

.delay-route {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: var(--text-sm);
}

.delay-from {
    font-weight: 600;
    color: var(--gray-700);
}

.delay-arrow {
    color: var(--gray-400);
    font-size: var(--text-2xs);
}

.delay-to {
    font-weight: 600;
    color: var(--gray-700);
}

.delay-details {
    display: flex;
    gap: 16px;
    font-size: var(--text-xs);
    color: var(--gray-500);
}

.delay-details span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== TABELA DOJAZDÓW ===== */
.sched-travel-table {
    font-size: var(--text-xs);
    width: 100%;
}

.sched-travel-table-header {
    display: grid;
    grid-template-columns: 80px 1fr 1fr 70px 70px 90px 100px;
    gap: 4px;
    padding: 6px 8px;
    background: var(--gray-100);
    font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase;
    font-size: var(--text-2xs);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.sched-travel-row {
    display: grid;
    grid-template-columns: 80px 1fr 1fr 70px 70px 90px 100px;
    gap: 4px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--gray-100);
    align-items: center;
}

.sched-travel-row:hover {
    background: var(--gray-50);
}

.sched-travel-row.tt-late {
    background: #fef2f2;
}

.sched-travel-row.tt-tight {
    background: #fffbeb;
}

.sched-travel-row .tt-tech {
    font-weight: 600;
    color: var(--gray-700);
}

.sched-travel-row .tt-from,
.sched-travel-row .tt-to {
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sched-travel-row .tt-from small,
.sched-travel-row .tt-to small {
    color: var(--gray-400);
    font-size: var(--text-2xs);
    margin-left: 4px;
}

.sched-travel-row .tt-status {
    font-weight: 600;
}

.sched-travel-row.tt-late .tt-status {
    color: var(--danger);
}

.sched-travel-row.tt-tight .tt-status {
    color: var(--warning);
}

.sched-travel-row.tt-ok .tt-status {
    color: var(--success);
}

/* ========================================================
   ABSENCES / URLOPY - Modal + Overlay
   ======================================================== */

/* Modal overlay */
.abs-modal-overlay {
    display: none;
    z-index: 10000;
}
.abs-modal-overlay.active {
    display: flex;
}
.abs-modal {
    max-width: 960px;
    width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}
.abs-modal .modal-body {
    overflow-y: auto;
    padding: 0;
    flex: 1;
    min-height: 0;
}

/* Tabs */
.abs-modal-tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-100);
    background: var(--gray-50);
    padding: 0 8px;
    gap: 0;
    flex-shrink: 0;
}
.abs-tab {
    padding: 10px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--gray-500);
    border-bottom: 3px solid transparent;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 6px;
}
.abs-tab:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}
.abs-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Tab content */
.abs-tab-content {
    padding: 16px;
}

/* Form */
.abs-form {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 16px;
}
.abs-form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.abs-form-row:last-child {
    margin-bottom: 0;
}
.abs-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 100px;
}
.abs-field label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.abs-field input,
.abs-field select {
    padding: 6px 8px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    font-family: inherit;
    background: var(--bg-surface);
}
.abs-field input:focus,
.abs-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}
.abs-add-btn {
    margin-top: 8px;
    width: 100%;
}

/* Termination warning */
.abs-termination-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #fff3e0;
    border: 1px solid #ffcc80;
    border-left: 4px solid #e65100;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    font-size: var(--text-sm);
    color: #bf360c;
}

.abs-termination-warning i {
    color: #e65100;
    font-size: 18px;
    flex-shrink: 0;
}

/* List */
.abs-list {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}
.abs-list-header {
    padding: 8px 12px;
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}
.abs-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--gray-100);
    gap: 8px;
    transition: background var(--transition-fast);
}
.abs-list-item:last-child {
    border-bottom: none;
}
.abs-list-item:hover {
    background: var(--gray-50);
}
.abs-item-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}
.abs-item-icon {
    font-size: var(--text-md);
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}
.abs-item-tech {
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--gray-800);
}
.abs-item-type {
    font-size: var(--text-sm);
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    background: currentColor;
    background: color-mix(in srgb, currentColor 10%, transparent);
}
.abs-item-dates {
    font-size: var(--text-sm);
    color: var(--gray-500);
    font-family: 'SF Mono', monospace;
}
.abs-item-dayname {
    font-size: var(--text-xs);
    color: var(--gray-400);
}
.abs-item-hours {
    font-size: var(--text-sm);
    color: var(--gray-600);
    font-weight: 600;
    font-family: 'SF Mono', monospace;
}
.abs-item-note {
    font-size: var(--text-xs);
    color: var(--gray-400);
    font-style: italic;
}
.abs-remove-btn {
    flex-shrink: 0;
    color: var(--gray-400);
}
.abs-remove-btn:hover {
    color: var(--danger);
}

/* Empty state */
.abs-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    color: var(--gray-400);
    font-size: var(--text-base);
}
.abs-empty i {
    font-size: var(--text-xl);
    color: var(--success);
}

/* === SCHEDULER OVERLAYS === */

/* Absence overlay (na kolumnie technika w widoku dziennym) */
.abs-overlay {
    position: absolute;
    left: 2px;
    right: 2px;
    z-index: 2;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    box-sizing: border-box;
}

/* Full day absence overlay */
.abs-overlay-fullday {
    background: color-mix(in srgb, var(--abs-color) 8%, transparent);
    border: 2px dashed var(--abs-color, #3b82f6);
    opacity: 0.85;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 6px 8px;
}
.abs-overlay-fullday .abs-overlay-label {
    color: var(--abs-color, #3b82f6);
    font-weight: 700;
    font-size: var(--text-base);
    text-shadow: none;
    width: 100%;
    text-align: left;
}
.abs-overlay-fullday .abs-overlay-note {
    font-size: var(--text-xs);
    color: var(--abs-color, #3b82f6);
    opacity: 0.7;
    margin-top: 2px;
}

/* Holiday overlay */
.abs-overlay-holiday {
    background: rgba(239, 68, 68, 0.06);
    border: 2px dashed rgba(239, 68, 68, 0.35);
}
.abs-overlay-holiday .abs-overlay-label {
    color: var(--danger);
    font-weight: 700;
    font-size: var(--text-base);
}

/* Hour block overlay */
.abs-overlay-hourblock {
    background: color-mix(in srgb, var(--abs-color) 12%, transparent);
    border: 1.5px solid var(--abs-color, #f59e0b);
    border-radius: var(--radius-sm);
}
.abs-overlay-hourblock .abs-overlay-label {
    color: var(--abs-color, #f59e0b);
    font-weight: 600;
    font-size: var(--text-2xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    padding: 0 4px;
}

/* Blocked column (dimmed) */
.sched-tech-col.abs-blocked .sched-col-body {
    opacity: 0.35;
    pointer-events: none;
}
.sched-tech-col.abs-blocked .sched-col-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: repeating-linear-gradient(90deg, transparent, transparent 4px, var(--danger) 4px, var(--danger) 8px);
}
.sched-tech-col.abs-blocked .sched-col-header {
    position: relative;
}

/* Week view absence badges */
.abs-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 5px;
    border-radius: var(--radius-xs);
    font-size: var(--text-2xs);
    font-weight: 600;
    border: 1px solid;
    margin: 1px 0;
    white-space: nowrap;
}
.abs-badge-holiday {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Week view blocked cell */
.sched-week-tech-col.abs-week-blocked {
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 8px,
        rgba(239, 68, 68, 0.04) 8px,
        rgba(239, 68, 68, 0.04) 16px
    );
}
.sched-week-tech-col.abs-week-blocked .sched-week-no-tasks {
    color: var(--gray-300);
}

/* Week overview holiday marker */
.sched-week-day.sched-week-holiday {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.04);
}
.sched-week-day.sched-week-holiday .sched-week-dayname {
    color: var(--danger);
}

/* === ABSENCE CONFLICT INDICATORS === */

/* Column-level warning banner (vacation + tasks) */
.sched-col-abs-warning {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    margin-top: 2px;
    border-radius: var(--radius-xs);
    font-size: var(--text-2xs);
    font-weight: 700;
    color: var(--abs-color, #f59e0b);
    background: color-mix(in srgb, var(--abs-color, #f59e0b) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--abs-color, #f59e0b) 30%, transparent);
    animation: absConflictPulse 2s ease-in-out infinite;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sched-tech-col.abs-has-conflict .sched-col-header {
    position: relative;
}
.sched-tech-col.abs-has-conflict .sched-col-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: repeating-linear-gradient(90deg, transparent, transparent 4px, #f59e0b 4px, #f59e0b 8px);
}

/* Task block conflict badge (day view) */
.sched-task-abs-badge {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 1px 5px;
    border-radius: var(--radius-xs);
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 3;
    position: relative;
}
.sched-task-abs-badge.critical {
    background: rgba(239, 68, 68, 0.18);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.4);
}
.sched-task-abs-badge.warning {
    background: rgba(245, 158, 11, 0.18);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

/* Task block conflict classes (day view) */
.sched-task-block.sched-task-abs-conflict {
    outline: 2px dashed #f59e0b;
    outline-offset: -1px;
    animation: absConflictPulse 2s ease-in-out infinite;
}
.sched-task-block.sched-task-abs-conflict-critical {
    outline: 2px dashed #ef4444;
    outline-offset: -1px;
    animation: absConflictPulse 1.5s ease-in-out infinite;
}

/* Week view task conflict classes */
.sched-week-task.sched-task-abs-conflict {
    outline: 2px dashed #f59e0b;
    outline-offset: -1px;
    animation: absConflictPulse 2s ease-in-out infinite;
}
.sched-week-task.sched-task-abs-conflict-critical {
    outline: 2px dashed #ef4444;
    outline-offset: -1px;
    animation: absConflictPulse 1.5s ease-in-out infinite;
}

/* Conflict icon in compact/week views */
.sched-abs-conflict-icon {
    color: #ef4444;
    font-size: 10px;
    margin-right: 2px;
    animation: absConflictPulse 1.5s ease-in-out infinite;
}

@keyframes absConflictPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ===== FINAL STATUS COLOR OVERRIDES (must stay at end) =====
   These selectors intentionally have high specificity to override
   compact/full typography colors defined earlier in the file. */

/* COMPLETED -> green text */
.sched-task-block.status-complete .sched-task-time,
.sched-task-block.status-complete .sched-task-address,
.sched-task-block.status-complete .sched-task-street,
.sched-task-block.status-complete .sched-task-type,
.sched-task-block.status-complete .sched-compact-time,
.sched-task-block.status-complete .sched-compact-city,
.sched-task-block.status-complete .sched-compact-line,
.sched-week-task.status-complete.compact .task-time,
.sched-week-task.status-complete.compact .task-city,
.sched-week-task.status-complete.compact .wt-type,
.sched-week-task.status-complete.full .task-time,
.sched-week-task.status-complete.full .task-city,
.sched-week-task.status-complete.full .task-street,
.sched-week-task.status-complete.full .wt-type,
.status-task-item.status-complete,
.status-task-item.status-complete .status-task-tech,
.status-task-item.status-complete .status-task-date,
.status-task-item.status-complete .status-task-addr {
    color: var(--success);
}

/* SENT BACK -> amber text */
.sched-task-block.status-sent-back .sched-task-time,
.sched-task-block.status-sent-back .sched-task-address,
.sched-task-block.status-sent-back .sched-task-street,
.sched-task-block.status-sent-back .sched-task-type,
.sched-task-block.status-sent-back .sched-compact-time,
.sched-task-block.status-sent-back .sched-compact-city,
.sched-task-block.status-sent-back .sched-compact-line,
.sched-week-task.status-sent-back.compact .task-time,
.sched-week-task.status-sent-back.compact .task-city,
.sched-week-task.status-sent-back.compact .wt-type,
.sched-week-task.status-sent-back.full .task-time,
.sched-week-task.status-sent-back.full .task-city,
.sched-week-task.status-sent-back.full .task-street,
.sched-week-task.status-sent-back.full .wt-type,
.status-task-item.status-sent-back,
.status-task-item.status-sent-back .status-task-tech,
.status-task-item.status-sent-back .status-task-date,
.status-task-item.status-sent-back .status-task-addr {
    color: #b45309;
}

/* ========================================================
   TRASH TABS (Kosz — dwuzakładkowy)
   ======================================================== */
.trash-tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    background: var(--gray-50);
    padding: 0 8px;
    gap: 0;
    flex-shrink: 0;
}

.trash-tab {
    padding: 10px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-500);
    border-bottom: 3px solid transparent;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.trash-tab:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

.trash-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.trash-tab-badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--gray-400);
    color: #fff;
    min-width: 18px;
    text-align: center;
}

.trash-tab-badge.shooting-badge {
    background: #c62828;
}

/* ========================================================
   SHOOTING TRASH TABLE
   ======================================================== */
.shooting-trash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #ffebee 0%, #fff3e0 100%);
    border-bottom: 1px solid var(--gray-200);
    flex-wrap: wrap;
    gap: 8px;
}

.shooting-trash-summary {
    font-size: var(--text-sm);
    color: #c62828;
}

.shooting-trash-summary i {
    margin-right: 4px;
}

.shooting-trash-actions {
    display: flex;
    gap: 6px;
}

.shooting-trash-table {
    overflow-x: auto;
    padding: 0;
}

.shooting-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.shooting-table thead th {
    background: var(--gray-100);
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--gray-600);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.shooting-table tbody td {
    padding: 8px 10px;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-100);
}

.shooting-table tbody tr:hover {
    background: var(--gray-50);
}

.shooting-row .addr-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shooting-row .shooting-val {
    color: #c62828;
    font-weight: 700;
}

.shooting-row .action-cell {
    white-space: nowrap;
    display: flex;
    gap: 4px;
}

/* ========================================================
   SHOOTING LENGTH ALERTS (sidebar)
   ======================================================== */

/* === ABSENCE CONFLICT ALERTS === */
.alerts-subtitle.absence-conflict-critical {
    color: #c62828;
    background: #ffebee;
    border-left: 4px solid #ef4444;
    display: flex;
    align-items: center;
    gap: 6px;
}
.alerts-subtitle.absence-conflict-warning {
    color: #e65100;
    background: #fff8e1;
    border-left: 4px solid #f59e0b;
    display: flex;
    align-items: center;
    gap: 6px;
}
.alert-item.absence-conflict-critical {
    border-left: 4px solid #ef4444;
    background: linear-gradient(90deg, #ffebee 0%, transparent 40%);
}
.alert-item.absence-conflict-warning {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(90deg, #fff8e1 0%, transparent 40%);
}

.alerts-subtitle.shooting-critical {
    color: #c62828;
    background: #ffebee;
    border-left: 4px solid #c62828;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.alerts-subtitle.shooting-warning {
    color: #e65100;
    background: #fff3e0;
    border-left: 4px solid #e65100;
}

.alert-item.shooting-critical {
    border-left: 4px solid #c62828;
    background: linear-gradient(90deg, #ffebee 0%, transparent 40%);
}

.alert-item.shooting-warning {
    border-left: 4px solid #e65100;
    background: linear-gradient(90deg, #fff3e0 0%, transparent 40%);
}

.alerts-subtitle.shooting-warning-sibling {
    color: #5c6bc0;
    background: #e8eaf6;
    border-left: 4px solid #5c6bc0;
}

.alert-item.shooting-warning-sibling {
    border-left: 4px solid #7986cb;
    background: linear-gradient(90deg, #e8eaf6 0%, transparent 40%);
}
.alert-item.shooting-warning-sibling .alert-reason em {
    color: #5c6bc0;
    font-style: normal;
    font-weight: 500;
}

/* === PRE-CANCELLED TASKS (CSV status=Cancelled) === */
.alerts-subtitle.pre-cancelled {
    color: #78909c;
    background: #eceff1;
    border-left: 4px solid #90a4ae;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.alerts-subtitle.pre-cancelled .alerts-subtitle-hint {
    font-size: 11px;
    font-weight: 400;
    color: #90a4ae;
    font-style: italic;
}
.alert-item.pre-cancelled {
    border-left: 4px solid #b0bec5;
    background: linear-gradient(90deg, #eceff1 0%, transparent 40%);
    opacity: 0.7;
}
.alert-item.pre-cancelled .alert-address {
    text-decoration: line-through;
    color: #78909c;
}
.alert-item.pre-cancelled .alert-reason strong {
    color: #78909c;
}

/* ========================================================
   SHOOTING CANCEL BANNER (persistent notification)
   ======================================================== */
.shooting-cancel-banner {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    z-index: 11000;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2), 0 2px 8px rgba(0,0,0,0.1);
    border: 2px solid #c62828;
    min-width: 420px;
    max-width: 720px;
    width: auto;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    overflow: hidden;
}

.shooting-cancel-banner.scb-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.shooting-cancel-banner.scb-closing {
    animation: scb-slideout 0.3s ease forwards;
}

@keyframes scb-slideout {
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px);
    }
}

.scb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: linear-gradient(135deg, #c62828 0%, #e53935 100%);
    color: #fff;
}

.scb-title {
    font-weight: 700;
    font-size: var(--text-base);
    display: flex;
    align-items: center;
    gap: 8px;
}

.scb-title i {
    font-size: 16px;
}

.scb-close {
    color: #fff !important;
    opacity: 0.8;
}

.scb-close:hover {
    opacity: 1;
    background: rgba(255,255,255,0.15) !important;
}

.scb-content {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.scb-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
}

.scb-section.scb-critical {
    background: #ffebee;
    border-left: 4px solid #c62828;
}

.scb-section.scb-warning {
    background: #fff3e0;
    border-left: 4px solid #e65100;
}

.scb-section.scb-kept {
    background: #e8f5e9;
    border-left: 4px solid #2e7d32;
}

.scb-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.scb-critical .scb-icon { color: #c62828; }
.scb-warning .scb-icon { color: #e65100; }
.scb-kept .scb-icon { color: #2e7d32; }

.scb-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.scb-text strong {
    font-size: var(--text-sm);
}

.scb-text span {
    font-size: 12px;
    color: var(--gray-600);
}

/* Details collapsible */
.scb-details {
    padding: 0 16px 12px;
    max-height: 300px;
    overflow-y: auto;
}

.scb-details-title {
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    margin: 10px 0 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.scb-details-title.critical { color: #c62828; }
.scb-details-title.warning  { color: #e65100; }
.scb-details-title.kept     { color: #2e7d32; }

.scb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-bottom: 8px;
}

.scb-table thead th {
    background: var(--gray-100);
    padding: 5px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
}

.scb-table tbody td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--gray-100);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.scb-table tbody tr:hover {
    background: var(--gray-50);
}

.scb-val-critical { color: #c62828; font-weight: 700; }
.scb-val-warning  { color: #e65100; font-weight: 700; }
.scb-val-kept     { color: #2e7d32; font-weight: 700; }

/* Sibling table */
.scb-details-title.sibling {
    color: #5c6bc0;
    border-bottom-color: #c5cae9;
}
.scb-details-title.sibling i { color: #5c6bc0; }
.scb-table-sibling { border-color: #c5cae9; }
.scb-sibling-row { background: #f3f0ff; }
.scb-sibling-row:hover { background: #ede7f6 !important; }
.scb-sibling-row em { color: #5c6bc0; font-style: normal; font-weight: 500; }

/* Kept House visit table */
.scb-details-title.kept {
    border-bottom-color: #a5d6a7;
}
.scb-details-title.kept i { color: #2e7d32; }
.scb-table-kept { border-color: #a5d6a7; }
.scb-kept-row { background: #e8f5e9; }
.scb-kept-row:hover { background: #c8e6c9 !important; }
.scb-kept-row em { color: #2e7d32; font-style: normal; font-weight: 500; }

/* Actions row */
.scb-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
    justify-content: flex-end;
}

.scb-ok-btn {
    min-width: 70px;
}
