.task-manager-module {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: calc(100vh - 100px);
    height: 100%;
    padding: 20px;
    gap: 20px;
    box-sizing: border-box;
    overflow: hidden;
}

#schedule-manager-view,
#bulk-task-builder-view {
    flex: 1 1 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.class-hidden {
    display: none !important;
}

.tm-split-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    min-height: 0;
    width: 100%;
}

.tm-window {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tm-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
}

.tm-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

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

/* Library Styling */
.task-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    transition: transform 0.2s;
}

.task-card:hover {
    transform: translateX(5px);
    border-color: var(--accent-primary);
}

/* Table Styling */
.tm-table-wrapper {
    flex: 1 1 auto;
    overflow-y: auto;
    width: 100%;
}

#tm-schedule-table {
    width: 100%;
    border-collapse: collapse;
}

#tm-schedule-table th {
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
}

#tm-schedule-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

#tm-schedule-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Center alignment for specific task data columns */
#tm-schedule-table th:nth-child(4), #tm-schedule-table td:nth-child(4), /* Frequency */
#tm-schedule-table th:nth-child(7), #tm-schedule-table td:nth-child(7), /* Hrs */
#tm-schedule-table th:nth-child(8), #tm-schedule-table td:nth-child(8), /* Rate */
.task-grid th:nth-child(5), .task-grid td:nth-child(5),                 /* Hours (Bulk) */
.task-grid th:nth-child(6), .task-grid td:nth-child(6),                 /* Rate Type (Bulk) */
.task-grid th:nth-child(7), .task-grid td:nth-child(7),                 /* Schedule (Bulk) */
#inst-schedule-table th:nth-child(3), #inst-schedule-table td:nth-child(3), /* Status (Execution) */
#inst-schedule-table th:nth-child(6), #inst-schedule-table td:nth-child(6)  /* Shift (Execution) */
{
    text-align: center;
}

.tm-actions {
    display: flex;
    gap: 10px;
}

#tm-search {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    color: white;
}

/* Grid Table Expansion */
.task-grid {
    width: 100%;
    flex: 1;
    border-collapse: separate;
    border-spacing: 0 10px;
    table-layout: auto; /* allow columns to grow */
}

.task-grid thead, 
.task-grid tbody {
    width: 100%;
}

.task-grid th, 
.task-grid td {
    padding: 12px;
    white-space: nowrap; /* keep labels on one line where possible */
    overflow: visible;
}

.task-grid th:nth-child(1),
.task-grid td:nth-child(1) {
    min-width: 200px; /* Title needs room */
}

.task-grid th:nth-child(2),
.task-grid td:nth-child(2) {
    min-width: 300px; /* Description needs more room */
}

.task-grid th {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    text-align: left;
}

.task-grid select, 
.task-grid input {
    width: 100%;
    box-sizing: border-box;
}


/* --- Date Picker Overrides --- */
.task-manager-module input[type="date"] {
    cursor: pointer;
}
.task-manager-module input[type="date"]::-webkit-calendar-picker-indicator {
    display: block !important;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}
html.carbon .task-manager-module input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}
html:not(.carbon) .task-manager-module input[type="date"]::-webkit-calendar-picker-indicator {
    filter: none;
}
.task-manager-module input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* --- Schedule Frequency Modal Overhaul --- */
.rrule-builder {
    padding: 10px 0;
}
.rrule-builder .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    align-items: center;
}
.rrule-builder .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.rrule-builder label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}
/* Style the Days of Week Checkboxes as modern pills */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
}
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-main);
}
.checkbox-group label:has(input:checked) {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary-color);
    color: white;
}
.checkbox-group input[type="checkbox"] {
    accent-color: var(--primary-color);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ─────────────────────────────────────────────
   SCOPED DARK THEME — Form inputs within the
   task manager module and all its modals.
   Overrides core-theme's `background: transparent`
   which renders as white in browser default styles.
   ───────────────────────────────────────────── */

/* Selectors cover:
   - The main module view
   - All task manager modals (rates, locations, rrule, bulk edit, edit task, docs) */
.task-manager-module input:not([type="checkbox"]):not([type="radio"]),
.task-manager-module select,
.task-manager-module textarea,
#modal-manage-rates input:not([type="checkbox"]):not([type="radio"]),
#modal-manage-rates select,
#location-manager-modal input:not([type="checkbox"]):not([type="radio"]),
#location-manager-modal select,
#modal-rrule-builder input:not([type="checkbox"]):not([type="radio"]),
#modal-rrule-builder select,
#modal-bulk-edit input:not([type="checkbox"]):not([type="radio"]),
#modal-bulk-edit select,
#modal-edit-task input:not([type="checkbox"]):not([type="radio"]),
#modal-edit-task select,
#modal-task-docs select,
#modal-view-docs select {
    background: var(--bg-surface, #1f1f1f);
    color: var(--text-primary, #f5f5f5);
    border: 1px solid var(--border-color, #2e2e2e);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.9rem;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.task-manager-module input:not([type="checkbox"]):not([type="radio"]):focus,
.task-manager-module select:focus,
.task-manager-module textarea:focus,
#modal-manage-rates input:not([type="checkbox"]):not([type="radio"]):focus,
#modal-manage-rates select:focus,
#location-manager-modal input:not([type="checkbox"]):not([type="radio"]):focus,
#location-manager-modal select:focus,
#modal-rrule-builder input:not([type="checkbox"]):not([type="radio"]):focus,
#modal-rrule-builder select:focus,
#modal-bulk-edit input:not([type="checkbox"]):not([type="radio"]):focus,
#modal-bulk-edit select:focus,
#modal-edit-task input:not([type="checkbox"]):not([type="radio"]):focus,
#modal-edit-task select:focus,
#modal-task-docs select:focus {
    border-color: var(--accent, #38bdf8);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

.task-manager-module input::placeholder,
.task-manager-module textarea::placeholder,
#modal-manage-rates input::placeholder,
#location-manager-modal input::placeholder,
#modal-rrule-builder input::placeholder,
#modal-bulk-edit input::placeholder,
#modal-edit-task input::placeholder {
    color: var(--text-secondary, #a3a3a3);
}

/* Preserve the existing #tm-search override */
#tm-search {
    background: var(--bg-surface, #1f1f1f) !important;
    color: var(--text-primary, #f5f5f5) !important;
    border: 1px solid var(--border-color, #2e2e2e) !important;
}

/* Ensure nested modals (like the RRule Builder) appear above primary modals */
#modal-rrule-builder {
    z-index: 2010 !important;
}

/* ─────────────────────────────────────────────
   DARK MODE BUTTON FIXES
   Prevent browser defaults from rendering
   button text as black in dark mode.
   ───────────────────────────────────────────── */

/* Generic icon/action button used in location & rate manager lists */
.btn-icon {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main, #f8fafc);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}



