:root {
    --slot-height: 50px;
    --header-height: 41px;
    --bg-primary: #030712; /* gray-950 */
    --bg-secondary: #111827; /* gray-900 */
    --bg-tertiary: #1f2937; /* gray-800 */
    --border-primary: #374151; /* gray-700 */
    --text-primary: #f9fafb; /* gray-50 */
    --text-secondary: #d1d5db; /* gray-300 */
    --text-muted: #9ca3af; /* gray-400 */
    --accent-primary: #4f46e5; /* indigo-600 */
    --accent-primary-hover: #4338ca; /* indigo-700 */
    --accent-secondary: #7c3aed; /* purple-600 */
    --accent-secondary-hover: #6d28d9; /* purple-700 */
    --danger-primary: #be123c; /* rose-700 */
}
::selection {
    background-color: var(--accent-primary);
    color: white;
}
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    overscroll-behavior: none;
    cursor: default;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: #4b5563; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #6b7280; }

/* --- Focus Styles --- */
:focus-visible {
     outline: 2px solid var(--accent-primary);
     outline-offset: 2px;
     border-radius: 6px;
}

/* --- Input Styles --- */
.dot { transform: translateX(0); transition: transform 0.2s ease-in-out; }
#hide-off-duty-toggle:checked ~ .dot { transform: translateX(1.25rem); } /* 20px */

/* --- Scheduler Grid --- */
.time-ruler { background-color: var(--bg-primary); position: sticky; left: 0; z-index: 20; }
.time-line { height: var(--slot-height); position: relative; border-top: 1px solid var(--border-primary); }
.time-label { position: absolute; top: -0.5rem; right: 0.5rem; font-size: 0.75rem; color: var(--text-muted); }

.day-column { position: relative; border-left: 1px solid var(--border-primary); }
.day-column-inactive { background-color: var(--bg-secondary) !important; pointer-events: none; }
.header-inactive { color: #4b5563; }

.hour-slot { height: var(--slot-height); position: relative; display: flex; flex-direction: column; }
.sub-slot {
    flex: 1;
    cursor: pointer;
    position: relative;
    transition: background-color 0.15s, box-shadow 0.15s;
    overflow: hidden;
    font-size: 0.8rem;
    font-weight: 500;
}
.sub-slot:first-child { border-bottom: 1px dashed rgba(107, 114, 128, 0.2); }
.sub-slot:hover:not(.selected) { background-color: rgba(255,255,255,0.05); }
.sub-slot.hovered { background-color: rgba(96, 165, 250, 0.1) !important; box-shadow: inset 0 0 0 1px #60a5fa; }
.sub-slot.selected {
    background-color: rgba(96, 165, 250, 0.2) !important;
    box-shadow: inset 0 0 0 1px #60a5fa;
    z-index: 5;
    animation: pulse-selection 1.5s infinite;
}
@keyframes pulse-selection {
    0% { background-color: rgba(96, 165, 250, 0.2); }
    50% { background-color: rgba(96, 165, 250, 0.4); }
    100% { background-color: rgba(96, 165, 250, 0.2); }
}
.sub-slot.keyboard-cursor {
    box-shadow: inset 0 0 0 2px #facc15, inset 0 0 0 4px var(--bg-primary); /* yellow-400 */
    z-index: 10;
}
.sub-slot.disabled {
    background-color: #881337 !important;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(0, 0, 0, 0.4) 5px, rgba(0, 0, 0, 0.4) 10px);
    cursor: not-allowed;
}
.sub-slot.drop-target { background-color: rgba(79, 70, 229, 0.2); transition-duration: 50ms; } /* indigo-600/20 */
.sub-slot.drop-target-add { background-color: rgba(34, 197, 94, 0.3); transition-duration: 200ms; } /* green-500/30 */
.sub-slot.drop-target-sup { background-color: rgba(124, 58, 237, 0.2); } /* purple-600/20 */

/* --- Shift & Day Colors --- */
.sub-slot-workday-day { background-color: rgba(55, 65, 81, 0.1); }
.sub-slot-workday-night { background-color: rgba(55, 65, 81, 0.3); }
.day-column-weekend { background-color: rgba(55, 48, 163, 0.05); }
.sub-slot-weekend-day { background-color: rgba(55, 48, 163, 0.1); }
.sub-slot-weekend-night { background-color: rgba(55, 48, 163, 0.25); }


/* --- Agent Panel --- */
.agent-card { transition: background-color 0.2s, box-shadow 0.2s, opacity 0.2s, transform 0.2s ease-in-out; cursor: grab; }
.agent-card:hover:not(.dragging) {
    background-color: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.agent-card.dragging { opacity: 0.5; transform: scale(0.95); background-color: var(--bg-tertiary); }
.agent-card.selected-for-highlight { box-shadow: 0 0 0 2px var(--accent-primary); background-color: var(--bg-tertiary); }
.agent-card.selected-for-touch-assign {
    transform: scale(1.05);
    box-shadow: 0 0 15px 3px var(--accent-secondary);
    background-color: var(--bg-tertiary);
}
.glow-red { animation: glow-red 2s infinite; }
.glow-green { animation: glow-green 2s infinite; }
@keyframes glow-red {
    0%, 100% { background-color: var(--glow-color); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    70% { background-color: var(--glow-color); box-shadow: 0 0 10px 3px rgba(239, 68, 68, 0); }
}
@keyframes glow-green {
    0%, 100% { background-color: var(--glow-color); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.3); }
    70% { background-color: var(--glow-color); box-shadow: 0 0 10px 3px rgba(34, 197, 94, 0); }
}

/* Snooze Animation */
.snooze-container { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; }
.snooze-face { display: inline-block; animation: snooze-bob 3s infinite ease-in-out; font-size: 1.25rem; }
.snooze-z { position: absolute; font-size: 0.8rem; font-weight: bold; color: var(--text-muted); opacity: 0; animation: float-z 3s infinite ease-in-out; }
.snooze-z:nth-child(2) { top: 0; left: 100%; animation-delay: 0.5s; }
.snooze-z:nth-child(3) { top: -10px; left: 80%; animation-delay: 1.2s; }
.snooze-z:nth-child(4) { top: 5px; left: 110%; animation-delay: 2.1s; }
@keyframes snooze-bob { 50% { transform: translateY(-4px) rotate(3deg); } }
@keyframes float-z { 10% { opacity: 1; } 80% { opacity: 0; transform: translateY(-20px) scale(1.2); } }

/* --- Pop-in Animation for Shift Blocks --- */
.shift-block { animation: pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); transition: box-shadow 0.3s, background 0.3s; }
.shift-block.highlighted {
    animation: none;
    box-shadow: inset 0 0 15px 3px rgba(250, 204, 21, 0.8); /* amber-400 */
}
/* Supervisor/Supervised text styles */
.shift-block-names { font-size: 0.9em; line-height: 1.2; }
.supervisor-line { display: block; font-size: 0.85em; margin-top: 2px; opacity: 0.9; }
.supervisor-text { color: #d8b4fe; font-style: italic; font-weight: 600; } /* purple-300 */
.supervised-text { color: #a5b4fc; } /* indigo-300 */
.agent-summary-role {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    font-weight: 600;
    margin-left: 0.25rem;
    vertical-align: middle;
}
.role-supervising { background-color: rgba(167, 139, 250, 0.2); color: #d8b4fe; }
.role-supervised { background-color: rgba(129, 140, 248, 0.2); color: #a5b4fc; }

@keyframes pop-in {
    0% { opacity: 0; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

/* --- Mobile Responsiveness & UI Overhaul --- */
@media (max-width: 768px) {
    #main-container { display: flex; flex-direction: column; }
    #agent-panel {
        position: fixed; top: 0; left: 0; bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 100; height: 100vh; width: 80vw; max-width: 320px;
    }
    #agent-panel.visible { transform: translateX(0); }
    #mobile-overlay {
        position: fixed; inset: 0; background: rgba(0,0,0,0.5);
        z-index: 99; transition: opacity 0.3s;
    }
    #mobile-overlay.hidden { opacity: 0; pointer-events: none; }
    header { flex-direction: column; align-items: flex-start; gap: 1rem; padding: 0.75rem; }
    #header-left, #header-right-controls { width: 100%; }
    #header-left { order: 2; flex-wrap: wrap; }
    #header-right-controls { order: 1; justify-content: space-between;}

    /* Mobile Action Bar */
    #action-bar {
        left: 0; right: 0; bottom: 0;
        transform: translateY(100%);
        border-radius: 0;
        border-width: 1px 0 0 0;
        padding: 0.5rem;
        justify-content: space-around;
    }
    #action-bar.visible { transform: translateY(0); }
    #action-bar .separator { display: none; }
    #action-bar > * { flex-grow: 1; text-align: center; justify-content: center; font-size: 0.9rem; }
    .sub-slot { min-height: 40px; } /* Larger touch targets */
    .day-column { min-width: 120px; }
    #date-picker-container { width: 100%; }
    .agent-card { padding: 1rem; } /* Larger cards for touch */
}

#action-bar {
    opacity: 0; visibility: hidden; transform: translateY(20px) translateX(-50%);
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
}
#action-bar.visible {
    opacity: 1; visibility: visible;
    transform: translateY(0) translateX(-50%);
}
@media (max-width: 768px) {
     #action-bar.visible { transform: translateY(0); }
}

#selection-tooltip {
    position: fixed;
    background-color: rgba(17, 24, 39, 0.85); /* gray-900 */
    backdrop-filter: blur(4px);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    z-index: 1000;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    transition: left 0.1s, top 0.1s;
}

/* --- Agent Quick Assign Input --- */
#agent-input-container {
    backdrop-filter: blur(8px);
    transition: top 0.1s, left 0.1s, transform 0.2s ease-out, opacity 0.2s ease-out;
    transform: scale(0.95);
    opacity: 0;
}
#agent-input-container.visible {
    transform: scale(1);
    opacity: 1;
}
#agent-input-mirror, #agent-input-typed, #agent-input-suggestion {
    font-size: 1.125rem; /* text-lg */
    font-weight: 600; /* font-semibold */
    padding: 0.25rem 0.5rem;
}


/* --- Litepicker Dark Mode Redesign --- */
.litepicker {
    background-color: var(--bg-secondary) !important;
    border: 1px solid var(--border-primary) !important;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05) !important;
    border-radius: 0.5rem !important;
}
.litepicker .container__months { background-color: var(--bg-secondary) !important; }
.litepicker .month-item-header, .litepicker .month-item-weekdays {
    color: var(--text-secondary) !important; font-weight: 600 !important;
}
.litepicker .month-item-header .button-previous-month,
.litepicker .month-item-header .button-next-month { color: var(--text-muted) !important; }
.litepicker .month-item-header .button-previous-month:hover,
.litepicker .month-item-header .button-next-month:hover {
    background-color: var(--border-primary) !important; border-radius: 9999px !important;
}
.litepicker .day-item { color: var(--text-secondary) !important; font-weight: 500 !important; }
.litepicker .day-item:hover {
    background-color: var(--accent-primary) !important; color: var(--text-primary) !important; border-radius: 9999px !important;
}
.litepicker .day-item.is-today {
    color: #f59e0b !important; font-weight: 700 !important;
    border: 1px solid #b45309 !important; border-radius: 9999px !important;
}
.litepicker .day-item.is-start-date, .litepicker .day-item.is-end-date {
    background-color: var(--accent-primary) !important; color: var(--text-primary) !important; border-radius: 9999px !important;
}
.litepicker .day-item.is-in-range {
    background-color: #312e81 !important; color: #c7d2fe !important; border-radius: 0 !important;
}
.litepicker .day-item.is-start-date.is-in-range { border-top-left-radius: 9999px !important; border-bottom-left-radius: 9999px !important; }
.litepicker .day-item.is-end-date.is-in-range { border-top-right-radius: 9999px !important; border-bottom-right-radius: 9999px !important; }
.litepicker .day-item.is-disabled, .litepicker .day-item.is-previous-month, .litepicker .day-item.is-next-month {
    color: #4b5563 !important;
}
.litepicker .day-item.is-previous-month:hover, .litepicker .day-item.is-next-month:hover {
    background-color: var(--accent-primary) !important; border-radius: 9999px !important; color: #e5e7eb !important;
}
.litepicker .container__tooltip {
    background-color: var(--bg-secondary) !important; border: 1px solid var(--border-primary) !important; color: #fff !important;
}
.week-number {
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}
.week-number:hover {
    color: var(--text-primary);
}

/* Modal Styles */
.modal-base { transition: opacity 0.3s, visibility 0.3s; }
.modal-content-base { transition: transform 0.3s; }
kbd {
    background-color: #374151;
    border: 1px solid #4b5563;
    border-bottom-width: 2px;
    color: #d1d5db;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    font-family: monospace;
}
/* Pulse animation for save button */
@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
}
.btn-pulse { animation: pulse-green 2s infinite; }
