/* K2 Hub CRM — Task Manager Styles */

/* ========================
   TASK MANAGER LAYOUT
   ======================== */
.page-content:has(.tm-layout),
.page-content.tm-page-content {
    padding: 0 !important;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}

.tm-layout {
    display: flex;
    gap: 0;
    height: 100%;
    margin: 0;
    overflow: hidden;
    min-width: 0;
    width: 100%;
}

/* ========================
   SIDEBAR (Departments/Projects tree)
   ======================== */
.tm-sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--k2-surface);
    border-right: 1px solid var(--k2-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tm-sidebar-header {
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--k2-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tm-sidebar-header h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--k2-text-muted);
}

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

.tm-sidebar-actions button {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: var(--k2-text-muted);
    border-radius: var(--k2-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--k2-transition);
}

.tm-sidebar-actions button:hover {
    background: var(--k2-bg-secondary);
    color: var(--k2-orange);
}

.tm-sidebar-actions button svg {
    width: 16px;
    height: 16px;
}

/* Sidebar sections container */
.tm-sidebar-sections {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.tm-sidebar-sections::-webkit-scrollbar {
    width: 4px;
}

.tm-sidebar-sections::-webkit-scrollbar-thumb {
    background: var(--k2-border);
    border-radius: 2px;
}

/* Sidebar section items (Проєктні задачі, Позапроєктні задачі) */
.tm-sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin: 2px 8px;
    cursor: pointer;
    border-radius: var(--k2-radius);
    transition: var(--k2-transition);
    font-size: 13px;
    font-weight: 600;
    color: var(--k2-text-secondary);
    user-select: none;
}

.tm-sidebar-item:hover {
    background: var(--k2-surface-hover);
}

.tm-sidebar-item.active {
    background: var(--k2-blue-50);
    color: var(--k2-blue);
}

.tm-sidebar-item-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tm-sidebar-item-icon svg {
    width: 16px;
    height: 16px;
}

.tm-sidebar-item-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar divider */
.tm-sidebar-divider {
    height: 1px;
    background: var(--k2-border-light);
    margin: 8px 16px;
}

/* Project items in sidebar (flat list, no department nesting) */
.tm-sidebar-project {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 8px 16px;
    cursor: pointer;
    transition: var(--k2-transition);
    border-left: 3px solid transparent;
    user-select: none;
}

.tm-sidebar-project:hover {
    background: var(--k2-surface-hover);
}

.tm-sidebar-project.active {
    background: var(--k2-orange-50);
    border-left-color: var(--k2-orange);
}

.tm-project-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tm-project-name {
    flex: 1;
    font-size: 13px;
    color: var(--k2-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tm-sidebar-project.active .tm-project-name {
    color: var(--k2-text);
    font-weight: 600;
}

.tm-project-count {
    font-size: 11px;
    color: var(--k2-text-muted);
    background: var(--k2-bg-secondary);
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

.tm-project-menu {
    width: 22px;
    height: 22px;
    border: none;
    background: none;
    color: var(--k2-text-muted);
    border-radius: var(--k2-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--k2-transition);
    flex-shrink: 0;
}

.tm-sidebar-project:hover .tm-project-menu {
    opacity: 1;
}

.tm-project-menu:hover {
    background: var(--k2-bg-tertiary);
    color: var(--k2-text);
}

.tm-project-menu svg {
    width: 13px;
    height: 13px;
}

/* ========================
   MAIN CONTENT AREA
   ======================== */
.tm-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--k2-bg-secondary);
}

.tm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--k2-surface);
    border-bottom: 1px solid var(--k2-border);
    gap: 12px;
    flex-wrap: nowrap;
    min-width: 0;
}

.tm-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.tm-toolbar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--k2-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tm-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* View toggle */
.tm-view-toggle {
    display: flex;
    background: var(--k2-bg-secondary);
    border-radius: var(--k2-radius);
    padding: 3px;
    gap: 2px;
}

.tm-view-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: none;
    background: none;
    border-radius: var(--k2-radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--k2-text-muted);
    cursor: pointer;
    transition: var(--k2-transition);
    white-space: nowrap;
}

.tm-view-btn:hover {
    color: var(--k2-text);
}

.tm-view-btn.active {
    background: var(--k2-surface);
    color: var(--k2-text);
    font-weight: 600;
    box-shadow: var(--k2-shadow-sm);
}

.tm-view-btn svg {
    width: 15px;
    height: 15px;
}

/* Filters row */
.tm-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--k2-surface);
    border-bottom: 1px solid var(--k2-border-light);
    flex-wrap: wrap;
}

.tm-filter-project-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.tm-filter-project-edit-btn {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    max-width: 18px;
    max-height: 18px;
    padding: 0;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--k2-text-muted, #94a3b8);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
    box-sizing: border-box;
}

.tm-filter-project-edit-btn:hover {
    color: var(--k2-primary, #005c9a);
    background: rgba(0, 92, 154, 0.08);
    border-color: rgba(0, 92, 154, 0.2);
}

.tm-filter-project-edit-btn svg {
    width: 10px !important;
    height: 10px !important;
    stroke-width: 2.2 !important;
}

.tm-filter-select {
    height: 32px;
    padding: 0 28px 0 11px;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 32px;
    border: 1px solid var(--k2-border, #e2e8f0);
    border-radius: 6px;
    background: #ffffff;
    color: var(--k2-text, #1e293b);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.15s ease;
}

.tm-filter-select:hover {
    border-color: #cbd5e1;
    background-color: #f8fafc;
}

.tm-filter-select:focus {
    outline: none;
    border-color: var(--k2-primary, #005c9a);
    box-shadow: 0 0 0 3px rgba(0, 92, 154, 0.12);
}

/* ========================
   TASK LIST VIEW
   ======================== */
.tm-task-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.tm-task-list::-webkit-scrollbar {
    width: 6px;
}

.tm-task-list::-webkit-scrollbar-thumb {
    background: var(--k2-border);
    border-radius: 3px;
}

.tm-task-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--k2-surface);
    border: 1px solid var(--k2-border);
    border-radius: var(--k2-radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--k2-transition);
    position: relative;
}

.tm-task-card:hover {
    box-shadow: var(--k2-shadow-md);
    border-color: var(--k2-border);
    transform: translateY(-1px);
}


.tm-task-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--k2-border);
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
    transition: var(--k2-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tm-task-checkbox:hover {
    border-color: var(--k2-success);
}

.tm-task-checkbox.checked {
    background: var(--k2-success);
    border-color: var(--k2-success);
}

.tm-task-checkbox.checked svg {
    width: 12px;
    height: 12px;
    color: white;
}

.tm-task-card.status-done {
    opacity: 0.6;
}

.tm-task-card.status-done .tm-task-title {
    text-decoration: line-through;
    color: var(--k2-text-muted);
}

.tm-task-body {
    flex: 1;
    min-width: 0;
}

.tm-task-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.tm-task-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--k2-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tm-task-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.tm-task-row-bottom {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.tm-task-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tm-task-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--k2-text-muted);
}

.tm-task-meta-item svg {
    width: 12px;
    height: 12px;
}

.tm-task-meta-item.overdue {
    color: var(--k2-error);
    font-weight: 600;
}

/* People display in task cards */
.tm-task-people {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-left: auto;
}

.tm-task-people-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.tm-task-people-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--k2-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-right: 2px;
}

/* Mini Avatar (universal) */
.tm-mini-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50% !important;
    background: var(--k2-blue);
    color: #fff;
    font-size: 9.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
    line-height: 1;
    letter-spacing: -0.2px;
    overflow: hidden;
    user-select: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.tm-person-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 9px 2px 3px;
    border-radius: 9999px;
    background: var(--k2-bg-secondary, #f8fafc);
    border: 1px solid var(--k2-border-light, #e2e8f0);
    font-size: 12px;
    font-weight: 500;
    color: var(--k2-text, #1e293b);
    white-space: nowrap;
    transition: all 0.15s ease;
}

.tm-person-chip:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.tm-person-chip .tm-mini-avatar {
    width: 20px;
    height: 20px;
    font-size: 9px;
    border-radius: 50% !important;
}

.tm-person-chip-muted {
    background: transparent;
    border: 1px dashed var(--k2-border, #cbd5e1);
    color: var(--k2-text-secondary, #64748b);
}

/* Department Section in Task List */
.tm-dept-section {
    margin-bottom: 24px;
}

.tm-dept-section:last-child {
    margin-bottom: 8px;
}

.tm-dept-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    margin-bottom: 10px;
    background: var(--k2-surface, #ffffff);
    border: 1px solid var(--k2-border, #e2e8f0);
    border-radius: var(--k2-radius, 8px);
    border-left: 4px solid var(--k2-blue);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.tm-dept-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tm-dept-section-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tm-dept-section-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--k2-text, #1e293b);
    letter-spacing: -0.2px;
}

.tm-dept-section-badge {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--k2-text-muted, #64748b);
    background: var(--k2-bg-secondary, #f1f5f9);
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid var(--k2-border-light, #e2e8f0);
}

.tm-dept-section-tasks {
    display: flex;
    flex-direction: column;
}

/* Department + Project breadcrumb badge inside task cards */
.tm-task-meta-item.tm-meta-dept-proj {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--k2-bg-secondary, #f8fafc);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid var(--k2-border-light, #e2e8f0);
    font-size: 11.5px;
}

.tm-meta-dept {
    font-weight: 600;
}

.tm-meta-slash {
    color: var(--k2-text-muted, #94a3b8);
    font-size: 10px;
}

.tm-meta-proj {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--k2-text, #1e293b);
    font-weight: 500;
}

/* Priority badge */
.tm-priority {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--k2-radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tm-priority-low { background: var(--k2-success-bg); color: var(--k2-success); }
.tm-priority-medium { background: var(--k2-blue-50); color: var(--k2-blue); }
.tm-priority-high { background: var(--k2-warning-bg); color: var(--k2-warning); }
.tm-priority-critical { background: var(--k2-error-bg); color: var(--k2-error); }

/* Status badge */
.tm-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--k2-radius-full);
    font-size: 11px;
    font-weight: 600;
}

.tm-status-new { background: var(--k2-bg-secondary); color: var(--k2-text-muted); }
.tm-status-in_progress { background: var(--k2-blue-50); color: var(--k2-blue); }
.tm-status-review { background: var(--k2-warning-bg); color: var(--k2-warning); }
.tm-status-done { background: var(--k2-success-bg); color: var(--k2-success); }
.tm-status-rejected { background: var(--k2-error-bg); color: var(--k2-error); }

/* Interactive status select dropdown */
select.tm-status-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    padding: 2px 20px 2px 9px;
    border-radius: var(--k2-radius-full);
    background-repeat: no-repeat;
    background-position: right 7px center;
    background-size: 8px 5px;
    transition: all 0.15s ease;
    outline: none;
}

select.tm-status-select:hover {
    filter: brightness(0.96);
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

select.tm-status-select:focus {
    border-color: var(--k2-primary);
    box-shadow: 0 0 0 2px rgba(243, 86, 9, 0.2);
}

select.tm-status-select.tm-status-new {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
select.tm-status-select.tm-status-in_progress {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23005c9a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
select.tm-status-select.tm-status-review {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23b45309' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
select.tm-status-select.tm-status-done {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23047857' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
select.tm-status-select.tm-status-rejected {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23b91c1c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

select.tm-status-select option {
    background: #ffffff;
    color: #1e293b;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 10px;
}

/* Assignee avatars stack */
.tm-assignees {
    display: flex;
    flex-shrink: 0;
}

.tm-assignee-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--k2-blue);
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--k2-surface);
    margin-left: -6px;
    position: relative;
    cursor: default;
}

.tm-assignee-avatar:first-child {
    margin-left: 0;
}

.tm-assignee-avatar:hover {
    z-index: 1;
    transform: scale(1.1);
}

.tm-task-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: var(--k2-transition);
}

.tm-task-card:hover .tm-task-actions {
    opacity: 1;
}

.tm-task-actions button {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: var(--k2-text-muted);
    border-radius: var(--k2-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--k2-transition);
}

.tm-task-actions button:hover {
    background: var(--k2-bg-secondary);
    color: var(--k2-text);
}

.tm-task-actions button.delete-btn:hover {
    background: var(--k2-error-bg);
    color: var(--k2-error);
}

.tm-task-actions button svg {
    width: 14px;
    height: 14px;
}

/* ========================
   GANTT CHART
   ======================== */
.tm-gantt {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.tm-gantt-container {
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

:root {
    --tm-gantt-labels-width: 480px;
    --tm-cell-width: 32px;
}

.tm-gantt-header {
    display: flex;
    align-items: stretch;
    padding: 0;
    background: var(--k2-surface);
    border-bottom: 1px solid var(--k2-border);
    flex-shrink: 0;
    z-index: 10;
    min-height: 52px;
}

.tm-gantt-header-left {
    width: var(--tm-gantt-labels-width);
    min-width: var(--tm-gantt-labels-width);
    max-width: var(--tm-gantt-labels-width);
    border-right: 1px solid var(--k2-border);
    flex-shrink: 0;
    box-sizing: border-box;
    background: var(--k2-surface);
    display: flex;
    align-items: center;
    padding: 0 12px;
}

.tm-gantt-header-left .tm-filters {
    display: flex !important;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
    min-width: 0;
}

.tm-gantt-header-left .tm-filter-select {
    min-width: 0;
    height: 32px;
    font-size: 12px;
    font-weight: 500;
    padding: 0 20px 0 8px;
    border: 1px solid var(--k2-border);
    border-radius: var(--k2-radius-sm, 6px);
    background-color: var(--k2-surface);
    color: var(--k2-text);
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    box-sizing: border-box;
    transition: var(--k2-transition);
}

.tm-gantt-header-left .tm-filter-select:hover {
    border-color: var(--k2-blue);
    background-color: var(--k2-bg-secondary);
}

.tm-gantt-header-left .tm-filter-select:focus {
    border-color: var(--k2-blue);
    box-shadow: 0 0 0 2px rgba(0, 92, 154, 0.15);
    outline: none;
}

.tm-gantt-header-left #tmFilterProject {
    flex: 1.35;
}

.tm-gantt-header-left .tm-filter-project-wrap {
    flex: 1.35;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.tm-gantt-header-left .tm-filter-project-wrap #tmFilterProject {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.tm-gantt-header-left #tmFilterStatus {
    flex: 0.95;
}

.tm-gantt-header-left #tmFilterAssignee {
    flex: 1.25;
}

.tm-gantt-header-right {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    min-width: 0;
}

.tm-gantt-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tm-gantt-nav button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--k2-border);
    background: var(--k2-surface);
    border-radius: var(--k2-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--k2-text-secondary);
    transition: var(--k2-transition);
}

.tm-gantt-nav button:hover {
    background: var(--k2-bg-secondary);
    border-color: var(--k2-text-muted);
}

.tm-gantt-nav button svg {
    width: 16px;
    height: 16px;
}

.tm-gantt-period {
    font-size: 15px;
    font-weight: 700;
    color: var(--k2-text);
    white-space: nowrap;
    min-width: 130px;
    text-align: center;
}

.tm-gantt-today-btn {
    height: 32px;
    padding: 0 14px;
    border: 1px solid var(--k2-border);
    background: var(--k2-surface);
    border-radius: var(--k2-radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--k2-text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--k2-transition);
}

.tm-gantt-today-btn:hover {
    background: var(--k2-blue-50);
    border-color: var(--k2-blue);
    color: var(--k2-blue);
}

.tm-gantt-grid {
    display: flex;
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.tm-gantt-labels {
    width: var(--tm-gantt-labels-width);
    min-width: var(--tm-gantt-labels-width);
    max-width: var(--tm-gantt-labels-width);
    background: var(--k2-surface);
    border-right: 1px solid var(--k2-border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.tm-gantt-labels-header {
    height: 68px;
    min-height: 68px;
    max-height: 68px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--k2-text-muted);
    border-bottom: 1px solid var(--k2-border);
    background: var(--k2-bg-secondary);
    box-sizing: border-box;
    flex-shrink: 0;
}

.tm-gantt-labels-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 24px;
}

.tm-gantt-labels-body::-webkit-scrollbar {
    display: none;
}

.tm-gantt-label-row {
    box-sizing: border-box;
    height: 50px;
    min-height: 50px;
    max-height: 50px;
    flex-shrink: 0;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--k2-border-light);
    font-size: 13px;
    color: var(--k2-text);
    cursor: pointer;
    transition: var(--k2-transition);
}

.tm-gantt-label-row:hover {
    background: var(--k2-surface-hover);
}

.tm-gantt-label-row.status-done .tm-gantt-label-text {
    text-decoration: line-through;
    opacity: 0.55;
}

.tm-gantt-label-priority {
    display: none !important;
}

.tm-gantt-label-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    justify-content: center;
}

.tm-gantt-label-text {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--k2-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
    letter-spacing: -0.15px;
}

.tm-gantt-label-sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 11px;
    color: var(--k2-text-muted);
    min-height: 20px;
    line-height: 1.2;
}

.tm-gantt-sub-left {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.62;
    transition: opacity 0.15s ease;
}

.tm-gantt-label-row:hover .tm-gantt-sub-left {
    opacity: 0.95;
}

.tm-gantt-sub-crumb {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tm-gantt-sub-client {
    color: var(--k2-blue);
    font-weight: 500;
}

.tm-gantt-sub-client svg {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
}

.tm-gantt-sub-proj {
    font-weight: 500;
}

.tm-gantt-sub-proj-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tm-gantt-people-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.tm-gantt-avatar-group {
    display: flex;
    align-items: center;
}

.tm-gantt-avatar-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: -10px;
    position: relative;
    cursor: default;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), z-index 0.15s ease, box-shadow 0.15s ease;
}

.tm-gantt-avatar-item:first-child {
    margin-left: 0;
}

.tm-gantt-avatar-item.can-edit {
    cursor: pointer;
}

.tm-gantt-avatar-item.can-edit:hover {
    transform: scale(1.15);
    z-index: 10;
}

.tm-gantt-avatar-item .tm-mini-avatar {
    width: 38px !important;
    height: 38px !important;
    font-size: 13px !important;
    font-weight: 700;
    border: 2px solid var(--k2-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
}

.tm-gantt-watchers-group {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-left: 6px;
    border-left: 1px solid var(--k2-border-light);
}

.tm-gantt-watchers-icon {
    display: inline-flex;
    align-items: center;
    color: var(--k2-text-muted);
    opacity: 0.7;
    margin-right: 1px;
}

.tm-gantt-watchers-icon svg {
    width: 12px;
    height: 12px;
}

.tm-gantt-avatar-item.is-watcher .tm-mini-avatar {
    opacity: 0.9;
    border: 2px dashed var(--k2-text-muted) !important;
    box-shadow: none;
}


.tm-gantt-timeline {
    flex: 1;
    min-width: 0;
    overflow: auto;
    position: relative;
    min-height: 0;
}

.tm-gantt-timeline-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--k2-bg-secondary);
    height: 68px;
    min-height: 68px;
    max-height: 68px;
    box-sizing: border-box;
    flex-shrink: 0;
    width: max-content;
    min-width: 100%;
}

.tm-gantt-months-header {
    display: flex;
    height: 28px;
    border-bottom: 1px solid var(--k2-border-light);
    background: #f8fafc;
    width: max-content;
    min-width: 100%;
}

.tm-gantt-month {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 4px;
    border-right: 1.5px solid #cbd5e1;
    box-sizing: border-box;
    background: #f8fafc;
    overflow: visible;
}

.tm-gantt-month:nth-child(even) {
    background: #f1f5f9;
}

.tm-gantt-month-label {
    position: sticky;
    left: 8px;
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    font-size: 11.5px;
    font-weight: 700;
    color: #334155;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    white-space: nowrap;
    letter-spacing: 0.2px;
    z-index: 3;
    pointer-events: none;
}

.tm-gantt-days-header {
    display: flex;
    height: 40px;
    border-bottom: 1px solid var(--k2-border);
    background: #ffffff;
    width: max-content;
    min-width: 100%;
}

.tm-gantt-day {
    min-width: var(--tm-cell-width, 32px);
    width: var(--tm-cell-width, 32px);
    max-width: var(--tm-cell-width, 32px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--k2-border-light);
    font-size: 11px;
    color: var(--k2-text-muted);
    user-select: none;
    box-sizing: border-box;
}

.tm-gantt-day-name {
    font-weight: 600;
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #94a3b8;
    line-height: 1.1;
}

.tm-gantt-day-num {
    font-weight: 600;
    font-size: 12.5px;
    color: #334155;
    line-height: 1.1;
    margin-top: 1px;
}

.tm-gantt-day.today {
    background: #eff6ff;
}

.tm-gantt-day.today .tm-gantt-day-name {
    color: var(--k2-blue, #005c9a);
    font-weight: 800;
}

.tm-gantt-day.today .tm-gantt-day-num {
    background: var(--k2-blue, #005c9a);
    color: #ffffff !important;
    font-weight: 700;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    box-shadow: 0 1px 3px rgba(0, 92, 154, 0.35);
}

.tm-gantt-day.weekend {
    background: #e8edf4;
}

.tm-gantt-day.weekend .tm-gantt-day-name {
    color: #e11d48;
    font-weight: 700;
}

.tm-gantt-day.weekend .tm-gantt-day-num {
    color: #e11d48;
    font-weight: 700;
}

.tm-gantt-rows {
    position: relative;
    padding-bottom: 24px;
    width: max-content;
    min-width: 100%;
}

.tm-gantt-row {
    box-sizing: border-box;
    height: 50px;
    min-height: 50px;
    max-height: 50px;
    flex-shrink: 0;
    display: flex;
    border-bottom: 1px solid var(--k2-border-light);
    position: relative;
    width: max-content;
    min-width: 100%;
}

.tm-gantt-row-cell {
    min-width: var(--tm-cell-width, 32px);
    width: var(--tm-cell-width, 32px);
    max-width: var(--tm-cell-width, 32px);
    border-right: 1px solid var(--k2-border-light);
    box-sizing: border-box;
}

.tm-gantt-row-cell.today {
    background: rgba(0, 92, 154, 0.035);
}

.tm-gantt-row-cell.weekend {
    background: #e8edf4;
}

.tm-gantt-bar {
    position: absolute;
    top: 9px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 4px;
    font-size: 11.5px;
    font-weight: 600;
    color: white;
    cursor: grab;
    user-select: none;
    transition: box-shadow 0.15s ease;
    z-index: 2;
    min-width: 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.tm-gantt-bar:active {
    cursor: grabbing;
}

.tm-gantt-bar:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
    z-index: 6;
}

.tm-gantt-bar.is-dragging {
    cursor: grabbing !important;
    opacity: 0.88;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
    z-index: 30;
    transition: none !important;
}

.tm-gantt-bar-content {
    display: inline-flex;
    align-items: center;
    width: max-content;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
    padding: 0 6px;
    box-sizing: border-box;
    line-height: 1;
    will-change: transform;
    transition: none;
}

.tm-gantt-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 9px;
    cursor: col-resize;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.tm-gantt-handle::after {
    content: '';
    width: 3px;
    height: 14px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.7);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.tm-gantt-bar:hover .tm-gantt-handle::after,
.tm-gantt-handle:hover::after {
    opacity: 1;
}

.tm-gantt-handle-start {
    left: 0;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.tm-gantt-handle-end {
    right: 0;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.tm-gantt-bar.priority-low { background: var(--k2-success); }
.tm-gantt-bar.priority-medium { background: var(--k2-blue); }
.tm-gantt-bar.priority-high { background: var(--k2-warning); }
.tm-gantt-bar.priority-critical { background: var(--k2-error); }

.tm-gantt-bar.status-done {
    opacity: 0.55;
    text-decoration: line-through;
}

.tm-gantt-bar.status-done .tm-gantt-bar-content {
    text-decoration: line-through;
}

/* Gantt label row when task is done */
.tm-gantt-label-row.status-done {
    opacity: 0.6;
}

.tm-gantt-label-row.status-done .tm-gantt-label-text {
    text-decoration: line-through;
    color: var(--k2-text-muted);
}

.tm-gantt-label-row.status-done .tm-gantt-label-sub {
    text-decoration: line-through;
}

.tm-gantt-label-row.status-done .tm-status-tag {
    text-decoration: line-through;
}

.tm-gantt-label-row.status-done .tm-gantt-sub-assignee {
    text-decoration: line-through;
}

.tm-gantt-label-row.status-done .tm-gantt-label-priority {
    opacity: 0.4;
}

/* ========================
   GANTT PROJECT HIERARCHY & PROJECT BARS
   ======================== */

.tm-gantt-label-row.tm-gantt-project-label-row {
    background: var(--k2-bg-secondary);
    border-left: 3px solid var(--proj-color, var(--k2-blue));
    font-weight: 600;
}

.tm-gantt-label-row.tm-gantt-project-label-row:hover {
    background: var(--k2-surface-hover);
}

.tm-gantt-proj-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.tm-gantt-proj-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: rgba(0, 92, 154, 0.12);
    color: var(--k2-blue);
    padding: 1px 5px;
    border-radius: 4px;
    margin-right: 4px;
    vertical-align: middle;
    text-transform: uppercase;
    line-height: 1.3;
}

.tm-gantt-proj-dates-tag {
    font-size: 10.5px;
    color: var(--k2-text-secondary);
}

.tm-gantt-proj-dates-tag.no-dates {
    color: var(--k2-text-muted);
    font-style: italic;
}

.tm-gantt-label-row.tm-gantt-task-label-row.is-indented {
    padding-left: 28px;
}

.tm-gantt-tree-branch {
    color: var(--k2-text-muted);
    font-family: monospace;
    font-size: 12px;
    opacity: 0.6;
    flex-shrink: 0;
    margin-right: 2px;
}

.tm-gantt-sub-assignee {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tm-gantt-label-row.tm-gantt-orphan-header-row,
.tm-gantt-label-row.tm-gantt-section-header-row {
    background: var(--k2-bg-secondary);
    font-size: 12px;
    font-weight: 700;
    cursor: default;
    border-left: 3px solid var(--k2-blue);
}

.tm-gantt-label-row.tm-gantt-orphan-header-row {
    border-left-color: var(--k2-border);
}

.tm-gantt-row.tm-gantt-project-timeline-row {
    background: rgba(0, 92, 154, 0.02);
}

.tm-gantt-row.tm-gantt-orphan-timeline-row,
.tm-gantt-row.tm-gantt-section-timeline-row {
    background: rgba(0, 0, 0, 0.02);
}

.tm-list-super-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 4px 6px;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--k2-text-muted);
    border-bottom: 1px solid var(--k2-border-light);
}

.tm-list-super-badge {
    background: var(--k2-bg-tertiary);
    color: var(--k2-text-secondary);
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

/* Project Gantt Bar */
.tm-gantt-bar.tm-gantt-project-bar {
    height: 30px;
    top: 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    cursor: grab;
    z-index: 3;
}

.tm-gantt-bar.tm-gantt-project-bar .tm-gantt-handle {
    width: 9px;
    background: rgba(255, 255, 255, 0.25);
}

.tm-gantt-bar.tm-gantt-project-bar .tm-gantt-handle:hover {
    background: rgba(255, 255, 255, 0.5);
}

.tm-gantt-project-no-dates-label {
    position: absolute;
    top: 13px;
    left: 14px;
    font-size: 11px;
    color: var(--k2-text-muted);
    font-style: italic;
    cursor: pointer;
    padding: 2px 10px;
    border-radius: 4px;
    border: 1px dashed var(--k2-border);
    background: var(--k2-surface);
    transition: var(--k2-transition);
    user-select: none;
    z-index: 2;
}

.tm-gantt-project-no-dates-label:hover {
    color: var(--k2-blue);
    border-color: var(--k2-blue);
    background: var(--k2-surface-hover);
}

/* Floating drag feedback tooltip */
.tm-gantt-drag-tooltip {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    background: #0f172a;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.1s ease;
    white-space: nowrap;
}

.tm-gantt-drag-tooltip.visible {
    opacity: 1;
}

/* Gantt today line */
.tm-gantt-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--k2-error);
    z-index: 4;
    pointer-events: none;
}

.tm-gantt-today-line::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    width: 10px;
    height: 10px;
    background: var(--k2-error);
    border-radius: 50%;
}

/* ========================
   GANTT TOOLTIP & PREVIEW CARD
   ======================== */
.tm-gantt-tooltip {
    position: fixed;
    z-index: 1000;
    background: var(--k2-surface);
    border: 1px solid var(--k2-border);
    border-radius: var(--k2-radius);
    box-shadow: var(--k2-shadow-lg);
    padding: 12px 16px;
    max-width: 280px;
    pointer-events: none;
    animation: fadeIn 0.15s ease;
    display: none;
}

.tm-gantt-tooltip.visible {
    display: block;
}

.tm-gantt-tooltip-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--k2-text);
    margin-bottom: 6px;
}

.tm-gantt-tooltip-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--k2-text-secondary);
    margin-bottom: 3px;
}

.tm-gantt-tooltip-row svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

/* Organic Delayed Hover Preview Card for Tasks */
.tm-gantt-preview-card {
    position: fixed;
    z-index: 10000;
    width: 320px;
    max-width: 90vw;
    background: var(--k2-surface);
    border: 1px solid var(--k2-border);
    border-radius: 8px;
    box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.2), 0 6px 14px -2px rgba(0, 0, 0, 0.12);
    padding: 12px 14px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px) scale(0.98);
    transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    display: block;
}

.tm-gantt-preview-card.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.tm-gantt-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.tm-gantt-preview-crumb {
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

.tm-gantt-preview-crumb svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.tm-gantt-preview-status {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--k2-bg-secondary);
    color: var(--k2-text-secondary);
    white-space: nowrap;
}

.tm-gantt-preview-status.is-done {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.tm-gantt-preview-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--k2-text);
    line-height: 1.35;
    margin-bottom: 6px;
    word-break: break-word;
}

.tm-gantt-preview-desc {
    font-size: 12px;
    color: var(--k2-text-secondary);
    line-height: 1.45;
    margin-bottom: 8px;
    background: var(--k2-bg-secondary);
    padding: 6px 8px;
    border-radius: 6px;
    border-left: 2px solid var(--k2-blue);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.tm-gantt-preview-footer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    color: var(--k2-text-muted);
    border-top: 1px solid var(--k2-border-light);
    padding-top: 6px;
    margin-top: 4px;
}

.tm-gantt-preview-footer-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tm-gantt-preview-footer-row svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

/* =======================================================
   LARGE TALL & WIDE MODAL FOR TASKS AND PROJECTS (2X SIZE)
   ======================================================= */
.modal.modal-wide {
    max-width: 960px;
}

.modal.modal-large-form {
    width: min(1360px, 95vw) !important;
    max-width: 1360px !important;
    height: 85vh !important;
    min-height: 620px !important;
    max-height: 92vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

@media (min-width: 1700px) {
    .modal.modal-large-form {
        width: min(1460px, 92vw) !important;
        max-width: 1460px !important;
        height: 86vh !important;
        min-height: 680px !important;
    }
}

.modal.modal-large-form .modal-header {
    padding: 18px 28px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--k2-border-light);
}

.modal.modal-large-form .modal-header h3 {
    font-size: 19px;
    font-weight: 700;
}

.modal.modal-large-form .modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
}

.modal.modal-large-form .modal-footer {
    padding: 16px 28px;
    flex-shrink: 0;
    border-top: 1px solid var(--k2-border-light);
    background: var(--k2-bg-secondary, rgba(0, 0, 0, 0.02));
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

/* Two-column grid inside modal-large-form */
.modal.modal-large-form .tm-dept-modal-grid,
.modal.modal-large-form .tm-task-modal-grid {
    display: grid !important;
    grid-template-columns: minmax(380px, 1fr) minmax(500px, 1.35fr) !important;
    gap: 32px !important;
    align-items: stretch !important;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.modal.modal-large-form .tm-dept-modal-col-left {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    height: 100% !important;
    min-height: 0 !important;
}

.modal.modal-large-form .tm-dept-modal-col-left .tm-desc-grow {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.modal.modal-large-form .tm-dept-modal-col-left .tm-desc-grow textarea {
    flex: 1;
    min-height: 110px;
}

.modal.modal-large-form .tm-dept-modal-col-right {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    padding-left: 28px !important;
    border-left: 1px solid var(--k2-border-light) !important;
    height: 100% !important;
    min-height: 0 !important;
}

/* Member lists in modal-large-form */
.modal.modal-large-form .tm-members-list {
    flex: 1 !important;
    min-height: 0 !important;
    max-height: none !important;
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)) !important;
    gap: 8px !important;
    align-content: start !important;
    overflow-y: auto !important;
    padding-right: 6px;
    padding-bottom: 4px;
}

/* When Watchers section is open in Task modal */
.modal.modal-large-form #tmTaskAssigneeMembersList.watchers-open {
    flex: 1.1 !important;
    max-height: 290px !important;
}

.modal.modal-large-form #tmTaskWatcherMembersList {
    flex: 0.9 !important;
    max-height: 250px !important;
}

.modal.modal-large-form .tm-members-group-label,
.modal.modal-large-form [id$="EmptySearch"] {
    grid-column: 1 / -1 !important;
}

.modal.modal-large-form .tm-member-card {
    min-height: 52px;
    padding: 8px 10px;
}

.modal.modal-large-form .tm-member-role {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

/* Responsive queries */
@media (max-width: 1160px) {
    .modal.modal-large-form .tm-dept-modal-grid,
    .modal.modal-large-form .tm-task-modal-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 24px !important;
    }
}

@media (max-width: 860px) {
    .modal.modal-large-form {
        width: 96vw !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: 95vh !important;
    }
    .modal.modal-large-form .modal-header,
    .modal.modal-large-form .modal-body,
    .modal.modal-large-form .modal-footer {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    .modal.modal-large-form .tm-dept-modal-grid,
    .modal.modal-large-form .tm-task-modal-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        height: auto !important;
    }
    .modal.modal-large-form .tm-dept-modal-col-right {
        padding-left: 0 !important;
        border-left: none !important;
        border-top: 1px solid var(--k2-border-light) !important;
        padding-top: 20px !important;
    }
    .modal.modal-large-form .tm-members-list {
        max-height: 380px !important;
    }
}

.tm-modal-grid {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 24px;
}

.tm-modal-col-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tm-modal-col-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-left: 24px;
    border-left: 1px solid var(--k2-border-light);
}

.tm-modal-col-main .form-group,
.tm-modal-col-side .form-group {
    margin-bottom: 0;
}

/* ========================
   MODAL DEPT & PROJECT GRIDS & MODERN MEMBER CARDS
   ======================== */
.tm-dept-modal-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 28px;
    align-items: start;
}

@media (max-width: 860px) {
    .tm-dept-modal-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

.tm-dept-modal-col-left {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tm-dept-modal-col-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-left: 24px;
    border-left: 1px solid var(--k2-border-light);
}

@media (max-width: 860px) {
    .tm-dept-modal-col-right {
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--k2-border-light);
        padding-top: 20px;
    }
}

.tm-members-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tm-members-header-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--k2-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tm-members-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tm-members-search {
    position: relative;
    width: 100%;
}

.tm-members-search input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    font-size: 13px;
    background: var(--k2-bg-secondary);
    border: 1px solid var(--k2-border);
    border-radius: var(--k2-radius-sm);
    color: var(--k2-text);
    transition: var(--k2-transition);
}

.tm-members-search input:focus {
    outline: none;
    border-color: var(--k2-primary);
    background: var(--k2-surface);
}

.tm-members-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--k2-text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    font-size: 12px;
}

.tm-members-search-icon svg {
    width: 14px;
    height: 14px;
    stroke: var(--k2-text-muted);
}

.btn-xs {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: var(--k2-radius-sm);
    line-height: 1.2;
}

.tm-members-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 310px;
    overflow-y: auto;
    padding-right: 4px;
}

.tm-member-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--k2-surface);
    border: 1px solid var(--k2-border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.tm-member-card:hover {
    background: var(--k2-surface-hover);
    border-color: var(--k2-border);
    transform: translateY(-1px);
}

.tm-member-card.selected {
    background: rgba(243, 86, 9, 0.05);
    border-color: rgba(243, 86, 9, 0.4);
}

.tm-member-card.not-project-member {
    opacity: 0.45;
    background: var(--k2-bg-secondary, rgba(0, 0, 0, 0.02));
    border-style: dashed;
    border-color: var(--k2-border-light, #e2e8f0);
}

.tm-member-card.not-project-member:hover {
    opacity: 0.85;
    background: var(--k2-surface-hover);
    border-color: var(--k2-border);
}

.tm-member-card.not-project-member.selected {
    opacity: 1;
    background: rgba(243, 86, 9, 0.05);
    border-style: solid;
    border-color: rgba(243, 86, 9, 0.4);
}

.tm-member-card.disabled {
    cursor: default;
    opacity: 0.85;
    background: var(--k2-bg-secondary);
    transform: none;
}

.tm-member-avatar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tm-member-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tm-member-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--k2-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tm-member-role {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tm-member-check {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.tm-member-check input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--k2-primary);
    cursor: pointer;
}

@media (max-width: 768px) {
    .tm-modal-grid {
        grid-template-columns: 1fr;
    }
    .tm-modal-col-side {
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--k2-border-light);
        padding-top: 16px;
    }
}

.tm-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Multi-select people picker in task modal */
.tm-people-picker {
    border: 1px solid var(--k2-border);
    border-radius: 8px;
    padding: 6px;
    max-height: 175px;
    overflow-y: auto;
    background: var(--k2-surface);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tm-people-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    user-select: none;
}

.tm-people-option:hover {
    background: var(--k2-surface-hover);
    border-color: var(--k2-border-light);
}

.tm-people-option.selected {
    background: rgba(243, 86, 9, 0.06);
    border-color: rgba(243, 86, 9, 0.35);
}

.tm-people-option input[type="checkbox"] {
    accent-color: var(--k2-primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.tm-people-option label {
    flex: 1;
    font-size: 13px;
    color: var(--k2-text);
    cursor: pointer;
}

.tm-people-option .tm-mini-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--k2-primary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tm-people-empty-notice,
.tm-members-empty-notice {
    text-align: center;
    padding: 24px 14px;
    color: var(--k2-text-muted);
    font-size: 12.5px;
    line-height: 1.4;
    background: var(--k2-bg-secondary);
    border: 1px dashed var(--k2-border);
    border-radius: 8px;
    margin: 4px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ========================
   CONTEXT MENU
   ======================== */
.tm-context-menu {
    position: fixed;
    z-index: 1000;
    background: var(--k2-surface);
    border: 1px solid var(--k2-border);
    border-radius: var(--k2-radius);
    box-shadow: var(--k2-shadow-lg);
    padding: 6px;
    min-width: 160px;
    animation: fadeIn 0.1s ease;
}

.tm-context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--k2-text-secondary);
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    border-radius: var(--k2-radius-sm);
    transition: var(--k2-transition);
}

.tm-context-menu-item:hover {
    background: var(--k2-surface-hover);
    color: var(--k2-text);
}

.tm-context-menu-item.danger:hover {
    background: var(--k2-error-bg);
    color: var(--k2-error);
}

.tm-context-menu-item svg {
    width: 14px;
    height: 14px;
}

.tm-context-divider {
    height: 1px;
    background: var(--k2-border-light);
    margin: 4px 0;
}

/* ========================
   EMPTY STATE (tasks-specific)
   ======================== */
.tm-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--k2-text-muted);
    text-align: center;
}

.tm-empty-icon {
    width: 64px;
    height: 64px;
    background: var(--k2-bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.tm-empty-icon svg {
    width: 28px;
    height: 28px;
    color: var(--k2-text-muted);
    opacity: 0.5;
}

.tm-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--k2-text-secondary);
    margin-bottom: 8px;
}

.tm-empty-text {
    font-size: 13px;
    max-width: 320px;
    line-height: 1.5;
}

/* ========================
/* Responsive Gantt Left Labels & Header Breakpoints */
@media (max-width: 1440px) {
    :root {
        --tm-gantt-labels-width: 450px;
    }
}

@media (max-width: 1280px) {
    :root {
        --tm-gantt-labels-width: 410px;
    }
    .tm-gantt-header-left {
        padding: 0 8px;
    }
    .tm-gantt-header-left .tm-filters {
        gap: 5px;
    }
    .tm-gantt-header-left .tm-filter-select {
        font-size: 11.5px;
        padding: 0 16px 0 6px;
    }
}

@media (max-width: 1024px) {
    :root {
        --tm-gantt-labels-width: 350px;
    }
    .tm-gantt-header-left {
        padding: 0 6px;
    }
    .tm-gantt-header-left .tm-filters {
        gap: 4px;
    }
    .tm-gantt-header-left .tm-filter-select {
        font-size: 11px;
        height: 30px;
        padding: 0 14px 0 5px;
    }
}

@media (max-width: 768px) {
    :root {
        --tm-gantt-labels-width: 220px;
    }

    .tm-layout {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - var(--header-height) - 32px);
    }

    .tm-sidebar {
        width: 100%;
        min-width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--k2-border);
    }

    .tm-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .tm-toolbar-left, .tm-toolbar-right {
        width: 100%;
    }

    .tm-form-row {
        grid-template-columns: 1fr;
    }

    .tm-gantt-header-left {
        padding: 0 4px;
    }

    .tm-gantt-header-left .tm-filters {
        gap: 3px;
    }

    .tm-gantt-header-left .tm-filter-select {
        font-size: 10px;
        height: 28px;
        padding: 0 10px 0 4px;
    }

    .tm-gantt-day {
        min-width: 32px;
        width: 32px;
    }
}

/* ========================
   COLOR PICKER (simple)
   ======================== */
.tm-color-picker {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.tm-color-option {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--k2-transition);
    position: relative;
}

.tm-color-option:hover {
    transform: scale(1.15);
}

.tm-color-option.selected {
    border-color: var(--k2-text);
    box-shadow: 0 0 0 2px var(--k2-surface), 0 0 0 4px var(--k2-text);
}

.tm-color-option.selected::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    font-weight: 800;
}

/* ========================
   GANTT MONTH SEPARATORS
   ======================== */
.tm-gantt-day.month-start {
    border-left: 1.5px solid #94a3b8 !important;
}

.tm-gantt-row-cell.month-start {
    border-left: 1.5px solid #cbd5e1 !important;
}

/* ========================
   ENLARGED TASK DETAIL MODAL
   ======================== */
.modal.modal-task-detail {
    max-width: 1060px;
    width: 95vw;
    height: 86vh;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    background: var(--k2-surface);
    border-radius: var(--k2-radius-lg);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.22);
}

.modal.modal-task-detail .modal-header.tm-modal-header {
    flex-shrink: 0;
    padding: 18px 24px;
    border-bottom: 1px solid var(--k2-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--k2-surface);
}

.modal.modal-task-detail .modal-body.tm-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    min-height: 0;
}

.modal.modal-task-detail .modal-footer.tm-modal-footer {
    flex-shrink: 0;
    padding: 14px 24px;
    border-top: 1px solid var(--k2-border-light);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    background: var(--k2-bg-secondary);
}

/* Two-column layout */
.tm-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(320px, 1fr);
    min-height: 100%;
}

.tm-detail-main {
    padding: 24px 28px;
    border-right: 1px solid var(--k2-border-light);
    display: flex;
    flex-direction: column;
    gap: 26px;
    min-width: 0;
}

.tm-detail-sidebar {
    padding: 24px 20px;
    background: var(--k2-bg-secondary);
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.tm-detail-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tm-detail-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--k2-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tm-detail-section-title svg {
    width: 16px;
    height: 16px;
}

.tm-detail-desc-box {
    padding: 14px 16px;
    background: var(--k2-bg-secondary);
    border-radius: var(--k2-radius);
    border: 1px solid var(--k2-border-light);
    font-size: 14px;
    line-height: 1.6;
    color: var(--k2-text);
    min-height: 60px;
    text-align: justify;
    text-align-last: left;
    white-space: pre-wrap;
    word-break: break-word;
}

.tm-detail-desc-box.empty {
    color: var(--k2-text-muted);
    font-style: italic;
    background: transparent;
    border: 1px dashed var(--k2-border);
}

/* Comments Section */
.tm-comments-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}

.tm-comments-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--k2-blue-50);
    color: var(--k2-blue);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.tm-comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 6px;
}

.tm-comment-item {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    background: var(--k2-surface);
    border: 1px solid var(--k2-border-light);
    border-radius: var(--k2-radius);
    transition: background 0.15s, border-color 0.15s;
}

.tm-comment-item:hover {
    border-color: var(--k2-border);
}

.tm-comment-avatar {
    flex-shrink: 0;
    padding-top: 2px;
}

.tm-comment-body {
    flex: 1;
    min-width: 0;
}

.tm-comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.tm-comment-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--k2-text);
}

.tm-comment-time {
    font-size: 11px;
    color: var(--k2-text-muted);
    margin-left: 8px;
}

.tm-comment-delete-btn {
    opacity: 0;
    background: none;
    border: none;
    color: var(--k2-text-muted);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 16px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.15s;
}

.tm-comment-item:hover .tm-comment-delete-btn {
    opacity: 1;
}

.tm-comment-delete-btn:hover {
    color: var(--k2-error);
    background: rgba(239, 68, 68, 0.1);
}

.tm-comment-text {
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--k2-text);
    word-break: break-word;
    white-space: pre-wrap;
}

/* @mentions highlighting */
.tm-mention-tag {
    display: inline-block;
    background: rgba(0, 92, 154, 0.12);
    color: #005c9a;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    margin: 0 1px;
}

/* Comment Input */
.tm-comment-input-box {
    margin-top: 6px;
    border: 1px solid var(--k2-border);
    border-radius: var(--k2-radius);
    background: var(--k2-surface);
    overflow: visible;
    position: relative;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tm-comment-input-box:focus-within {
    border-color: var(--k2-blue);
    box-shadow: 0 0 0 3px rgba(0, 92, 154, 0.1);
}

.tm-comment-textarea {
    width: 100%;
    border: none;
    resize: vertical;
    min-height: 70px;
    padding: 12px 14px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--k2-text);
    background: transparent;
    outline: none;
    box-sizing: border-box;
    display: block;
}

.tm-comment-input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--k2-bg-secondary);
    border-top: 1px solid var(--k2-border-light);
    border-bottom-left-radius: var(--k2-radius);
    border-bottom-right-radius: var(--k2-radius);
}

.tm-mention-trigger-btn {
    font-weight: 600;
    color: var(--k2-blue);
    border-color: rgba(0, 92, 154, 0.25);
    background: var(--k2-surface);
    cursor: pointer;
}

.tm-mention-trigger-btn:hover {
    background: var(--k2-blue-50);
}

/* Mention Dropdown Autocomplete */
.tm-mention-dropdown {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 8px;
    width: 290px;
    max-height: 230px;
    overflow-y: auto;
    background: var(--k2-surface);
    border: 1px solid var(--k2-border);
    border-radius: var(--k2-radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    z-index: 1000;
    padding: 4px;
}

.tm-mention-dropdown.dropdown-below {
    bottom: auto;
    top: calc(100% + 4px);
}

.tm-mention-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--k2-radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.tm-mention-option:hover,
.tm-mention-option.active {
    background: var(--k2-blue-50);
}

.tm-mention-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tm-mention-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--k2-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tm-mention-email {
    font-size: 11px;
    color: var(--k2-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar attributes inside task detail */
.tm-sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--k2-border-light);
}

.tm-sidebar-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.tm-sidebar-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--k2-text-muted);
}

.tm-prop-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tm-prop-row.tm-prop-col {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.tm-prop-label {
    font-size: 12.5px;
    color: var(--k2-text-secondary);
    font-weight: 500;
}

.tm-prop-val {
    display: flex;
    align-items: center;
}

.tm-chips-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
}

.tm-project-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}

.tm-badge-overdue {
    display: inline-block;
    color: var(--k2-error);
    background: rgba(239, 68, 68, 0.1);
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

@media (max-width: 820px) {
    .tm-detail-layout {
        grid-template-columns: 1fr;
    }
    .tm-detail-main {
        border-right: none;
        border-bottom: 1px solid var(--k2-border-light);
    }
}

/* ========================================================
/* ========================================================
   TASK MANAGER TOP BAR (TABS + FILTERS)
   ======================================================== */

.tm-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 16px;
    background: var(--k2-surface, #ffffff);
    border-bottom: 1px solid var(--k2-border-light, #e2e8f0);
    min-height: 48px;
    flex-wrap: nowrap;
    overflow-x: auto;
    flex-shrink: 0;
}

.tm-top-bar::-webkit-scrollbar {
    height: 3px;
}

.tm-top-bar::-webkit-scrollbar-thumb {
    background: var(--k2-border, #cbd5e1);
    border-radius: 2px;
}

.tm-top-tabs {
    display: flex !important;
    align-items: center;
    gap: 4px;
    padding: 0;
    background: transparent;
    border-bottom: none;
    flex-shrink: 0;
}

.tm-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 48px;
    padding: 0 14px;
    border: none;
    background: transparent;
    border-bottom: 2.5px solid transparent;
    border-radius: 8px 8px 0 0;
    color: var(--k2-text-secondary, #64748b);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.tm-tab-btn:hover {
    color: var(--k2-text, #1e293b);
    background: rgba(0, 92, 154, 0.04);
}

.tm-tab-btn.active {
    color: var(--k2-blue, #005c9a);
    font-weight: 600;
    border-bottom: 2.5px solid var(--k2-blue, #005c9a);
    background: rgba(0, 92, 154, 0.09);
}

.tm-tab-btn.active:hover {
    background: rgba(0, 92, 154, 0.13);
}

.tm-tab-btn svg {
    width: 15px;
    height: 15px;
}

.tm-tab-count {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    background: var(--k2-bg-secondary, #f1f5f9);
    color: var(--k2-text-muted, #64748b);
    transition: all 0.15s ease;
}

.tm-tab-btn.active .tm-tab-count {
    background: rgba(0, 92, 154, 0.15);
    color: var(--k2-blue, #005c9a);
}

.tm-filters {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 0;
    background: transparent;
    border-bottom: none;
    margin-left: auto;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.tm-filter-select {
    max-width: 170px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tmFilterProject {
    display: inline-block !important;
    max-width: 210px;
    font-weight: 500;
    border-color: var(--k2-border, #e2e8f0);
    background-color: #ffffff;
}

.tm-top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-shrink: 0;
}

.tm-top-bar-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Project Button — identical to .btn-primary in size and style, solid non-bright yellow */
.btn-project {
    background: #e0a000;
    color: #ffffff;
}

.btn-project:hover {
    background: #cb9000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(224, 160, 0, 0.3);
}

.btn-project:active {
    background: #b58000;
    transform: translateY(0);
}

/* Task Search Input */
.tm-task-search-wrap {
    margin-left: auto;
    display: flex;
    align-items: center;
    position: relative;
    width: 250px;
    max-width: 100%;
    flex-shrink: 0;
}

.tm-task-search-icon {
    position: absolute;
    left: 10px;
    color: var(--k2-text-muted, #94a3b8);
    display: flex;
    align-items: center;
    pointer-events: none;
}

.tm-task-search-icon svg {
    width: 14px;
    height: 14px;
}

.tm-task-search-input {
    width: 100%;
    height: 32px;
    padding: 0 28px 0 32px;
    font-size: 13px;
    border: 1px solid var(--k2-border, #e2e8f0);
    border-radius: var(--k2-radius-sm, 6px);
    background: var(--k2-surface, #ffffff);
    color: var(--k2-text, #1e293b);
    transition: var(--k2-transition, all 0.15s ease);
    box-sizing: border-box;
}

.tm-task-search-input:hover {
    border-color: var(--k2-blue, #005c9a);
    background: var(--k2-bg-secondary, #f8fafc);
}

.tm-task-search-input:focus {
    border-color: var(--k2-blue, #005c9a);
    background: var(--k2-surface, #ffffff);
    box-shadow: 0 0 0 2px rgba(0, 92, 154, 0.15);
    outline: none;
}

.tm-task-search-clear {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--k2-text-muted, #94a3b8);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: var(--k2-transition, all 0.15s ease);
}

.tm-task-search-clear:hover {
    color: var(--k2-text, #1e293b);
    background: var(--k2-bg-secondary, #f1f5f9);
}

.tm-task-search-clear svg {
    width: 13px;
    height: 13px;
}

/* Avatar Upload Modal Styles */
.modal-avatar-upload {
    max-width: 440px !important;
    width: 100%;
}

.tm-avatar-upload-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.tm-avatar-preview-container {
    position: relative;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border: 3px solid var(--k2-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--k2-bg-secondary);
}

.tm-avatar-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.tm-avatar-preview-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 34px;
    font-weight: 700;
    text-transform: uppercase;
}

.tm-avatar-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    border-radius: 50%;
}

.tm-avatar-dropzone {
    width: 100%;
    box-sizing: border-box;
    border: 2px dashed var(--k2-border);
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    background: var(--k2-bg-secondary);
    transition: all 0.2s ease;
}

.tm-avatar-dropzone:hover,
.tm-avatar-dropzone.is-dragover {
    border-color: var(--k2-primary);
    background: rgba(0, 92, 154, 0.04);
}

.tm-avatar-drop-icon {
    color: var(--k2-primary);
    margin-bottom: 8px;
    display: flex;
    justify-content: center;
}

.tm-avatar-drop-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--k2-text);
    margin-bottom: 4px;
}

.tm-avatar-drop-sub {
    font-size: 11.5px;
    color: var(--k2-text-muted);
}

.tm-avatar-actions-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.tm-avatar-btn-delete {
    color: var(--k2-error) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

.tm-avatar-btn-delete:hover {
    background: rgba(239, 68, 68, 0.08) !important;
    border-color: var(--k2-error) !important;
}

/* Avatar Cropper Mini-Editor Styles */
.tm-crop-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.tm-crop-viewport-container {
    position: relative;
    width: 300px;
    height: 300px;
    border-radius: 16px;
    overflow: hidden;
    background: #090d16;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    user-select: none;
    touch-action: none;
    margin: 0 auto;
}

#tmCropCanvas {
    width: 300px;
    height: 300px;
    display: block;
    cursor: grab;
}

#tmCropCanvas:active {
    cursor: grabbing;
}

.tm-crop-circle-mask {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 210px;
    height: 210px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 9999px rgba(9, 13, 22, 0.72);
    pointer-events: none;
    transition: border-color 0.2s ease;
}

.tm-crop-circle-mask::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 50%;
    border: 1px dashed rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

.tm-crop-hint {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.tm-crop-controls {
    width: 100%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tm-crop-zoom-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--k2-bg-secondary, #f8fafc);
    border: 1px solid var(--k2-border-light, #e2e8f0);
    padding: 6px 12px;
    border-radius: 10px;
}

.tm-crop-zoom-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--k2-text, #1e293b);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.tm-crop-zoom-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.tm-crop-range {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--k2-border, #cbd5e1);
    border-radius: 4px;
    outline: none;
}

.tm-crop-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--k2-primary, #005c9a);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    transition: transform 0.1s ease;
}

.tm-crop-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.tm-crop-tools-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tm-crop-tool-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--k2-border-light, #e2e8f0);
    background: var(--k2-surface, #fff);
    font-size: 11.5px;
    font-weight: 500;
    color: var(--k2-text, #1e293b);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.tm-crop-tool-btn:hover {
    background: var(--k2-bg-secondary, #f8fafc);
    border-color: var(--k2-border, #cbd5e1);
}

/* =========================================================
   FLATPICKR WEEKEND HIGHLIGHTS (Calendar in Tasks & Projects)
   ========================================================= */

/* Weekday header: Saturday and Sunday */
.flatpickr-calendar .flatpickr-weekdays .flatpickr-weekday:nth-child(6),
.flatpickr-calendar .flatpickr-weekdays .flatpickr-weekday:nth-child(7),
.flatpickr-calendar .flatpickr-weekdays .flatpickr-weekday:nth-child(7n - 1),
.flatpickr-calendar .flatpickr-weekdays .flatpickr-weekday:nth-child(7n),
.flatpickr-calendar .flatpickr-weekday:nth-child(6),
.flatpickr-calendar .flatpickr-weekday:nth-child(7),
.flatpickr-calendar .flatpickr-weekday:nth-child(7n - 1),
.flatpickr-calendar .flatpickr-weekday:nth-child(7n) {
    color: #e11d48 !important;
    font-weight: 700 !important;
}

/* Weekend day cells (columns 6 and 7) */
.flatpickr-calendar .dayContainer .flatpickr-day.weekend,
.flatpickr-calendar .dayContainer .flatpickr-day:nth-child(7n - 1),
.flatpickr-calendar .dayContainer .flatpickr-day:nth-child(7n) {
    background: #e8edf4 !important;
    color: #e11d48 !important;
    font-weight: 600 !important;
    border-color: transparent !important;
}

/* Hover state on weekend days */
.flatpickr-calendar .dayContainer .flatpickr-day.weekend:hover,
.flatpickr-calendar .dayContainer .flatpickr-day:nth-child(7n - 1):hover,
.flatpickr-calendar .dayContainer .flatpickr-day:nth-child(7n):hover {
    background: #dbe4ef !important;
    color: #be123c !important;
    border-color: transparent !important;
}

/* Previous/next month weekend days */
.flatpickr-calendar .dayContainer .flatpickr-day.prevMonthDay.weekend,
.flatpickr-calendar .dayContainer .flatpickr-day.prevMonthDay:nth-child(7n - 1),
.flatpickr-calendar .dayContainer .flatpickr-day.prevMonthDay:nth-child(7n),
.flatpickr-calendar .dayContainer .flatpickr-day.nextMonthDay.weekend,
.flatpickr-calendar .dayContainer .flatpickr-day.nextMonthDay:nth-child(7n - 1),
.flatpickr-calendar .dayContainer .flatpickr-day.nextMonthDay:nth-child(7n) {
    background: #f1f5f9 !important;
    color: #fca5a5 !important;
    opacity: 0.65 !important;
    border-color: transparent !important;
}

/* Active selection: startRange, endRange, selected */
.flatpickr-calendar .dayContainer .flatpickr-day.selected,
.flatpickr-calendar .dayContainer .flatpickr-day.startRange,
.flatpickr-calendar .dayContainer .flatpickr-day.endRange {
    background: var(--k2-blue, #005c9a) !important;
    border-color: var(--k2-blue, #005c9a) !important;
    color: #ffffff !important;
}

/* Active range */
.flatpickr-calendar .dayContainer .flatpickr-day.inRange {
    background: #dbeafe !important;
    border-color: transparent !important;
    color: #1e40af !important;
}

/* Today on weekend */
.flatpickr-calendar .dayContainer .flatpickr-day.today.weekend,
.flatpickr-calendar .dayContainer .flatpickr-day.today:nth-child(7n - 1),
.flatpickr-calendar .dayContainer .flatpickr-day.today:nth-child(7n) {
    border-color: var(--k2-blue, #005c9a) !important;
}

/* ========================
   SEPARATE TASK FOR EACH ASSIGNEE OPTION
   ======================== */
.tm-separate-tasks-wrapper {
    margin: 8px 0 4px 0;
    padding: 9px 12px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease;
    user-select: none;
}

.tm-separate-tasks-wrapper:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.tm-separate-tasks-wrapper.active {
    background: #eff6ff;
    border-color: #3b82f6;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.15);
}

.tm-separate-tasks-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin: 0;
}

.tm-separate-tasks-label input[type="checkbox"] {
    display: none;
}

.tm-separate-tasks-custom-box {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border-radius: 5px;
    border: 1.5px solid #94a3b8;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.tm-separate-tasks-custom-box svg {
    width: 12px;
    height: 12px;
    stroke: #ffffff;
    opacity: 0;
    transform: scale(0.6);
    transition: all 0.15s ease;
}

.tm-separate-tasks-label input[type="checkbox"]:checked + .tm-separate-tasks-custom-box {
    background: #2563eb;
    border-color: #2563eb;
}

.tm-separate-tasks-label input[type="checkbox"]:checked + .tm-separate-tasks-custom-box svg {
    opacity: 1;
    transform: scale(1);
}

.tm-separate-tasks-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.tm-separate-tasks-title {
    font-size: 12.5px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.25;
}

.tm-separate-tasks-wrapper.active .tm-separate-tasks-title {
    color: #1d4ed8;
}

.tm-separate-tasks-desc {
    font-size: 11px;
    color: #64748b;
    line-height: 1.25;
}

.tm-separate-tasks-wrapper.active .tm-separate-tasks-desc {
    color: #2563eb;
    font-weight: 500;
}




