
/* ================= GLOBAL ================= */
* {
  box-sizing: border-box;
}

body {
  overflow-y: auto !important;
  overflow-x: hidden;
}

/* Nút mũi tên dropdown người dùng trên navbar: bỏ khung outline/viền đen mọi trạng thái */
#btn-user-dropdown,
#btn-user-dropdown:focus,
#btn-user-dropdown:focus-visible,
#btn-user-dropdown:active {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
  -webkit-tap-highlight-color: transparent;
}

/* ================= TABS ================= */
.app-tabs {
  background: #fff;
  border-radius: 14px;
  padding: 5px;
}

.app-tabs .nav-link {
  border: none !important;
  border-radius: 10px !important;
  color: #555;
  font-weight: 500;
}

.app-tabs .nav-link.active {
  background: #0d6efd;
  color: #fff !important;
}

/* ================= CARDS ================= */
.app-card,
.job-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.job-card {
  padding: 12px;
  margin-bottom: 12px;
}

/* Prevent flex overflow bugs */
.job-card,
.task-card,
.card,
.modal-body {
  min-width: 0;
}

/* Clip overflow where needed */
.job-card,
.task-card,
.card,
.modal-content {
  overflow: hidden;
}

/* ================= IMAGES ================= */

/* Base rule */
img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 10px;
}

/* Card images */
.job-card-img,
.task-card-img {
  max-height: 400px;
}

/* Modal images */
#modalImage,
.modal-content img {
  max-height: 50vh;
  object-fit: contain;
}

/* Preview images */
#beforePreview,
#modalFilePreview {
  max-height: 150px;
  width: auto;
  margin: 0.5rem 0;
}

/* Table images */
.table img,
table img {
  max-width: 80px;
  max-height: 60px;
  width: auto;
}

/* Force inline styles to behave */
img[style*="width: auto"],
img[style*="max-width"] {
  width: 100% !important;
  max-width: 100% !important;
}

/* ================= FORM ================= */
.form-control,
.form-select {
  border-radius: 10px;
  border: 1px solid #ddd;
}

.form-control:focus,
.form-select:focus {
  box-shadow: none;
  border-color: #0d6efd;
}

/* ================= BUTTONS ================= */
.btn {
  border-radius: 10px;
  font-weight: 500;
}

.fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #0d6efd;
  color: #fff;
  font-size: 26px;
  border: none;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}

/* ================= BADGES ================= */
.badge {
  border-radius: 8px;
  font-size: 0.75rem;
  padding: 5px 8px;
}

/* ================= MODAL ================= */
.modal-content {
  border-radius: 16px;
}

.modal-body {
  overflow-y: auto;
  max-height: 75vh;
}

/* ================= LAYOUT FIXES ================= */
.tab-content,
.tab-pane,
.main-content {
  overflow: visible !important;
}

.table-responsive {
  overflow-x: auto;
}

/* ================= MOBILE ================= */
@media (max-width: 700px) {
  .job-card-img,
  .task-card-img {
    max-height: 300px;
  }

  #modalImage,
  .modal-content img {
    max-height: 40vh;
  }

  #beforePreview {
    max-height: 120px;
    max-width: 80vw;
  }
}

@media (max-width: 420px) {
  .job-card-img,
  .task-card-img {
    max-height: 300px;
  }

  #modalImage,
  .modal-content img {
    max-height: 35vh;
  }
}

/* ================= EXISTING STYLES ================= */
/* ... keep all existing CSS ... */

/* ================= SIDEBAR NAVIGATION ================= */
.sidebar {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  z-index: 1050;
  transition: left 0.3s ease-in-out;
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar.show {
  left: 0;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  justify-content: between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.2);
}

.sidebar-body {
  padding: 20px 0;
}

.sidebar-nav-link {
  display: block !important;
  width: 100% !important;
  text-align: left !important;
  padding: 15px 25px !important;
  color: rgba(255,255,255,0.8) !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  font-size: 16px !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  transition: all 0.3s ease !important;
  margin: 2px 0 !important;
}

.sidebar-nav-link:hover {
  background: rgba(255,255,255,0.1) !important;
  color: #fff !important;
  transform: translateX(10px);
}

.sidebar-nav-link.active {
  background: rgba(255,255,255,0.2) !important;
  color: #fff !important;
  border-left: 4px solid #fff !important;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.5);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease-in-out;
}

.sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* HAMBURGER MENU BUTTON */
#sidebarToggle {
  border: none;
  padding: 8px 12px;
  font-size: 18px;
  border-radius: 8px;
}

#sidebarToggle:hover {
  background: #0d6efd;
  color: white;
}

/* ================= DESKTOP RESPONSIVENESS ================= */
@media (min-width: 768px) {
  .sidebar,
  .sidebar-overlay {
    display: none !important;
  }
  
  #sidebarToggle {
    display: none !important;
  }
}

/* ================= MOBILE ADJUSTMENTS ================= */
@media (max-width: 767px) {
  .nav-container {
    display: none !important;
  }
  
  .main-content {
    padding-left: 0;
  }
  
  h3.text-primary {
    font-size: 1.2rem;
  }
}

/* ================= PAGE LAYOUT ================= */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px;
}

/* Header cải thiện */
.page-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 16px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* ================= TASK CARD LAYOUT ================= */
.task-grid {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

/* Mobile: 1 column */
.task-grid {
  grid-template-columns: 1fr;
}

/* Tablet: 2 columns */
@media (min-width: 768px) {
  .task-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop: 3 columns */
@media (min-width: 1200px) {
  .task-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Large Desktop: 4 columns */
@media (min-width: 1400px) {
  .task-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ================= ENHANCED TASK CARDS ================= */
.task-card {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
  border: 1px solid #f0f0f0;
}

.task-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  border-color: #e0e0e0;
}

.task-card-header {
  padding: 16px 16px 8px 16px;
  border-bottom: 1px solid #f5f5f5;
}

.task-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #2d3748;
  margin: 0 0 8px 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.8rem;
  color: #718096;
}

.task-card-body {
  padding: 12px 16px;
}

.task-card-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.task-card-image:hover {
  opacity: 0.9;
}

.task-card-content {
  font-size: 0.85rem;
  color: #4a5568;
  line-height: 1.4;
  margin-bottom: 12px;
}

.task-card-footer {
  padding: 12px 16px;
  background: #fafbfc;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* ================= ENHANCED BADGES & STATUS ================= */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.chua-xong {
  background: #fef5e7;
  color: #d69e2e;
  border: 1px solid #f6e05e;
}

.status-badge.xong {
  background: #f0fff4;
  color: #38a169;
  border: 1px solid #9ae6b4;
}

.status-badge.huy {
  background: #fed7d7;
  color: #e53e3e;
  border: 1px solid #fc8181;
}

.priority-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.priority-badge.cao {
  background: #fed7d7;
  color: #c53030;
}

.priority-badge.trung-binh {
  background: #fef5e7;
  color: #d69e2e;
}

.priority-badge.thap {
  background: #e6fffa;
  color: #319795;
}

/* ================= ACTION BUTTONS ================= */
.task-actions {
  display: flex;
  gap: 6px;
}

.btn-task-action {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 8px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-task-primary {
  background: #4299e1;
  color: white;
}

.btn-task-primary:hover {
  background: #3182ce;
  transform: translateY(-1px);
}

.btn-task-secondary {
  background: #e2e8f0;
  color: #4a5568;
}

.btn-task-secondary:hover {
  background: #cbd5e0;
}

/* ================= TABLE IMPROVEMENTS ================= */
.enhanced-table {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid #e2e8f0;
}

.enhanced-table thead {
  background: linear-gradient(90deg, #f7fafc 0%, #edf2f7 100%);
}

.enhanced-table th {
  font-weight: 600;
  color: #2d3748;
  padding: 16px 12px;
  border: none;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.enhanced-table td {
  padding: 12px;
  border-color: #f0f0f0;
  vertical-align: middle;
}

.enhanced-table tbody tr:hover {
  background: #f8f9fa;
}

/* ================= FILTER COMPONENT OVERFLOW FIX ================= */
/* .card has overflow:hidden globally — override for filter so the
   autocomplete dropdown can escape the card boundary */
.filter-component,
.filter-component .card-body,
.filter-component .filter-body {
  overflow: visible !important;
}

/* ================= FILTER SECTION ================= */
.filter-section {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid #e2e8f0;
}

.filter-title {
  font-size: 1rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ================= LOADING & EMPTY STATES ================= */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #718096;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top: 3px solid #4299e1;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #718096;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ================= MOBILE OPTIMIZATIONS ================= */
@media (max-width: 767px) {
  .main-content {
    padding: 12px;
  }
  
  .page-header {
    padding: 16px;
    margin-bottom: 16px;
  }
  
  .page-title {
    font-size: 1.3rem;
  }
  
  .task-card {
    margin-bottom: 16px;
  }
  
  .task-card-header {
    padding: 14px 14px 6px 14px;
  }
  
  .task-card-body,
  .task-card-footer {
    padding: 10px 14px;
  }
  
  .task-actions {
    flex-direction: column;
    gap: 4px;
  }
  
  .btn-task-action {
    width: 100%;
    justify-content: center;
  }
}
/* ================= CLICKABLE TASK CARDS ================= */
.task-card {
  transition: all 0.3s ease;
  border: 1px solid #e0e0e0;
}

.task-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.15) !important;
  border-color: #4299e1;
}

.task-card:active {
  transform: translateY(-1px);
}

/* Visual hint cho clickable */
.task-card::before {
  content: "👁️";
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(66, 153, 225, 0.1);
  color: #4299e1;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.task-card:hover::before {
  opacity: 1;
}

/* Make sure task-card is positioned relative for absolute positioning of ::before */
.task-card {
  position: relative;
}
/* ================= CLICKABLE TABLE ROWS ================= */
#historyTable tbody tr {
  transition: all 0.2s ease;
}

#historyTable tbody tr:hover {
  background-color: #f8f9fa !important;
  transform: scale(1.01);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#historyTable tbody tr:active {
  background-color: #e9ecef !important;
}

/* Áp dụng cho tất cả table rows clickable */
.clickable-row {
  cursor: pointer;
  transition: all 0.2s ease;
}

.clickable-row:hover {
  background-color: #f8f9fa !important;
  transform: scale(1.01);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.modal img[src]:not([src=""]) {
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.modal img[src]:not([src=""]):hover {
  opacity: 0.9;
  transform: scale(1.02);
}

/* Visual hint cho clickable images */
.modal img[src]:not([src=""]):hover::after {
  content: "🔍";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 8px;
  border-radius: 50%;
  font-size: 16px;
}

/* Task card images */
.task-card-img {
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.task-card-img:hover {
  opacity: 0.8;
}

/* Table images */
table img {
  cursor: pointer;
  transition: opacity 0.3s ease;
}

table img:hover {
  opacity: 0.8;
}
.selectable-item {
  cursor: pointer;
  transition: all 0.2s ease;
  border: none !important;
  padding: 12px 16px;
}

.selectable-item:hover {
  background: #f8f9fa !important;
  transform: translateX(2px);
}

.selectable-item.selected {
  background: linear-gradient(90deg, #e3f2fd 0%, #f3e5f5 100%) !important;
  border-left: 4px solid #2196f3 !important;
  font-weight: 600;
}

.selectable-item.selected .item-icon {
  transform: scale(1.1);
}

.item-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
}

.item-icon {
  transition: transform 0.2s ease;
}

.selected-tag {
  background: #e3f2fd;
  border: 1px solid #2196f3;
  color: #1976d2;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.selected-tag .remove-btn {
  cursor: pointer;
  color: #1976d2;
  font-weight: bold;
}

.selected-tag .remove-btn:hover {
  color: #d32f2f;
}

#bulkAssignBtn:disabled {
  opacity: 0.5;
}

.assignment-preview-item {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 4px 0;
  font-size: 0.85rem;
}
/* ... existing styles ... */

/* ================= ASSIGNMENT TABLE IMPROVEMENTS ================= */
.staff-list-container {
  max-width: 250px;
  line-height: 1.8;
}

.staff-list-container .badge {
  font-size: 0.7rem;
  padding: 3px 6px;
  border-radius: 8px;
  white-space: nowrap;
}

.btn-group-sm > .btn {
  padding: 0.25rem 0.4rem;
  font-size: 0.8rem;
}

/* Better spacing for assignment section */
.assignment-section-spacing {
  margin-bottom: 3rem;
}

/* Mobile responsive badges */
@media (max-width: 768px) {
  .staff-list-container {
    max-width: 180px;
  }
  
  .staff-list-container .badge {
    font-size: 0.65rem;
    padding: 2px 4px;
  }
}

/* Table column widths */
#assignTable th:nth-child(1) { width: 25%; } /* Công việc */
#assignTable th:nth-child(2) { width: 15%; } /* Chi nhánh */
#assignTable th:nth-child(3) { width: 35%; } /* Người thực hiện */
#assignTable th:nth-child(4) { width: 15%; } /* Trạng thái */
#assignTable th:nth-child(5) { width: 10%; } /* Hành động */

/* ================= ENHANCED BUTTON STYLING ================= */
#bulkAssignBtn {
  min-width: 200px;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(25, 135, 84, 0.3);
  transition: all 0.3s ease;
}

#bulkAssignBtn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(25, 135, 84, 0.4);
}

#bulkAssignBtn:disabled {
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

/* ================= SPACING UTILITIES ================= */
.mb-5 {
  margin-bottom: 3rem !important;
}

.task-card-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.job-name-cell {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-name-cell:hover {
  white-space: normal;
  word-break: break-word;
  max-width: none;
}

/* Assignment selection improvements */
.selectable-item strong {
  display: inline-block;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: top;
}

.selectable-item:hover strong {
  max-width: none;
  white-space: normal;
  word-break: break-word;
}

/* Selected tag improvements */
.selected-tag {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
}

/* Staff list container improvements */
.staff-list-container {
  max-width: 250px;
  line-height: 1.8;
}

.staff-list-container .badge {
  font-size: 0.7rem;
  padding: 3px 6px;
  border-radius: 8px;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clickable-row {
  transition: all 0.2s ease;
}

.clickable-row:hover {
  background-color: #f8f9fa !important;
  transform: scale(1.01);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.clickable-row:active {
  background-color: #e9ecef !important;
  transform: scale(1.005);
}

/* Visual hint cho clickable rows */
.clickable-row::after {
  content: "👁️";
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  font-size: 14px;
  color: #6c757d;
}

.clickable-row:hover::after {
  opacity: 1;
}

/* Make sure table rows are positioned relative */
#assignTable tr {
  position: relative;
}

/* Increase job name column width since we removed action column */
#assignTable th:nth-child(1) { width: 35%; } /* Công việc */
#assignTable th:nth-child(2) { width: 15%; } /* Chi nhánh */
#assignTable th:nth-child(3) { width: 35%; } /* Người thực hiện */
#assignTable th:nth-child(4) { width: 15%; } /* Trạng thái */

/* ================= FLATPICKR / DATETIME SPLIT PICKER ================= */

/* Date + time split wrapper layout — equal flex so neither dominates */
.dt-split-wrapper {
  align-items: center;
}

.dt-split-wrapper .dt-date-part,
.dt-split-wrapper .dt-time-part {
  flex: 1;
  min-width: 0;
}

/* Flatpickr calendar overflow fix on small screens */
@media (max-width: 576px) {
  .flatpickr-calendar {
    left: 0.5rem !important;
    right: 0.5rem !important;
    width: auto !important;
    max-width: calc(100vw - 1rem) !important;
  }
}

/* ================= MONTHLY SCHEDULE SPECIFIC STYLES ================= */
.monthly-schedule-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
}

.monthly-schedule-header {
    background: white;
    border-radius: 8px 8px 0 0;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.monthly-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.monthly-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
}

.monthly-year-display {
    font-size: 0.9rem;
    color: #718096;
    margin-top: 4px;
}

.monthly-nav-buttons {
    display: flex;
    gap: 6px;
}

.monthly-nav-btn {
    background: #4299e1;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.monthly-nav-btn:hover {
    background: #3182ce;
}

.monthly-nav-btn.current-month {
    background: #48bb78;
}

.monthly-stats {
    display: flex;
    gap: 20px;
    font-size: 0.85rem;
    color: #4a5568;
    flex-wrap: wrap;
}

.monthly-stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.monthly-calendar-wrapper {
    background: white;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
    border-top: none;
}

.monthly-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(120px, auto);
}

.monthly-day-header {
    background: #4299e1;
    color: white;
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    border-right: 1px solid rgba(255,255,255,0.2);
}

.monthly-day-header:last-child {
    border-right: none;
}

.monthly-day-cell {
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    background: #fafbfc;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 120px;
}

.monthly-day-cell:nth-child(7n) {
    border-right: none;
}

.monthly-day-cell.other-month {
    background: #f8f9fa;
    color: #a0aec0;
}

.monthly-day-cell.today {
    background: #fffaf0;
    border: 2px solid #ffc107;
}

.monthly-day-cell.weekend {
    background: #f8f9fa;
}

.monthly-day-cell.weekend.today {
    background: #fffaf0;
}

.monthly-day-number {
    padding: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #2d3748;
    text-align: right;
    background: white;
    border-bottom: 1px solid #f0f0f0;
}

.monthly-day-cell.other-month .monthly-day-number {
    color: #a0aec0;
    background: #f8f9fa;
}

.monthly-day-cell.today .monthly-day-number {
    background: #ffc107;
    color: #1a202c;
}

.monthly-tasks-area {
    flex: 1;
    padding: 4px;
    overflow: hidden;
}

.monthly-task-dot {
    display: inline-block;
    width: 100%;
    padding: 1px 4px;
    margin-bottom: 2px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
    color: white;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid rgba(255,255,255,0.3);
}

.monthly-task-dot:hover {
    transform: scale(1.02);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.monthly-task-dot:last-child {
    margin-bottom: 0;
}

/* Priority Colors for Monthly Tasks */
.monthly-task-dot.priority-high {
    background: #e53e3e;
    border-left-color: #c53030;
}

.monthly-task-dot.priority-medium {
    background: #dd6b20;
    border-left-color: #c05621;
}

.monthly-task-dot.priority-low {
    background: #38a169;
    border-left-color: #2f855a;
}

.monthly-task-dot.priority-none {
    background: #4299e1;
    border-left-color: #3182ce;
}

.monthly-task-dot.status-completed {
    opacity: 0.6;
    text-decoration: line-through;
}

.monthly-task-dot.status-cancelled {
    opacity: 0.4;
    text-decoration: line-through;
}

.monthly-task-dot.overdue {
    background: #e53e3e !important;
    animation: pulse-monthly 2s infinite;
}

@keyframes pulse-monthly {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.monthly-more-tasks {
    background: #718096;
    color: white;
    font-size: 0.65rem;
    text-align: center;
    padding: 1px 4px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.monthly-more-tasks:hover {
    background: #4a5568;
}

.monthly-empty-day {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #cbd5e0;
    font-size: 0.7rem;
    font-style: italic;
}

/* ================= MONTHLY MOBILE RESPONSIVE ================= */
@media (max-width: 768px) {
    .monthly-schedule-container {
        padding: 8px;
    }

    .monthly-schedule-header {
        padding: 15px;
    }

    .monthly-title {
        font-size: 1.2rem;
    }

    .monthly-year-display {
        font-size: 0.8rem;
    }

    .monthly-nav-buttons {
        flex-direction: row;
        gap: 4px;
    }

    .monthly-nav-btn {
        font-size: 0.7rem;
        padding: 6px 8px;
        flex: 1;
    }

    .monthly-navigation {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        align-items: center;
    }

    .monthly-stats {
        justify-content: center;
        gap: 15px;
        font-size: 0.8rem;
    }

    .monthly-calendar-grid {
        grid-auto-rows: minmax(80px, auto);
    }

    .monthly-day-header {
        padding: 8px 4px;
        font-size: 0.75rem;
    }

    .monthly-day-cell {
        min-height: 80px;
    }

    .monthly-day-number {
        padding: 4px;
        font-size: 0.8rem;
    }

    .monthly-tasks-area {
        padding: 2px;
    }

    .monthly-task-dot {
        font-size: 0.65rem;
        padding: 1px 3px;
        margin-bottom: 1px;
    }

    .monthly-more-tasks {
        font-size: 0.6rem;
    }

    .monthly-empty-day {
        font-size: 0.65rem;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .monthly-nav-btn {
        font-size: 0.65rem;
        padding: 5px 6px;
    }

    .monthly-stats {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }

    .monthly-stat-item {
        font-size: 0.75rem;
    }

    .monthly-calendar-grid {
        grid-auto-rows: minmax(70px, auto);
    }

    .monthly-day-cell {
        min-height: 70px;
    }

    .monthly-day-number {
        font-size: 0.75rem;
    }

    .monthly-task-dot {
        font-size: 0.6rem;
    }
}
/* ================= WEEKLY SCHEDULE SPECIFIC STYLES ================= */
.weekly-schedule-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
}

.weekly-schedule-header {
    background: white;
    border-radius: 8px 8px 0 0;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.weekly-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.weekly-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
}

.weekly-date-range {
    font-size: 0.85rem;
    color: #718096;
    margin-top: 4px;
}

.weekly-nav-buttons {
    display: flex;
    gap: 6px;
}

.weekly-nav-btn {
    background: #4299e1;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.weekly-nav-btn:hover {
    background: #3182ce;
}

.weekly-nav-btn.today {
    background: #48bb78;
}

.weekly-stats {
    display: flex;
    gap: 20px;
    font-size: 0.85rem;
    color: #4a5568;
    flex-wrap: wrap;
}

.weekly-stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.weekly-calendar-wrapper {
    background: white;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
    border-top: none;
}

.weekly-calendar-header {
    display: none;
}

.weekly-time-spacer {
    display: none;
}

.weekly-day-header {
    padding: 12px 8px;
    text-align: center;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    border-right: 1px solid rgba(255,255,255,0.2);
}

.weekly-day-header:last-child {
    border-right: none;
}

.weekly-day-header.today {
    background: #ffc107;
    color: #1a202c;
}

.weekly-day-header.weekend {
    background: #718096;
}

.weekly-day-name {
    font-weight: 600;
}

.weekly-day-date {
    font-size: 0.7rem;
    font-weight: normal;
    opacity: 0.9;
    margin-top: 2px;
}

.weekly-calendar-body {
    display: block;
    min-height: 400px;
}

/* ================= WEEKLY TIME GRID ================= */
.weekly-time-grid-wrapper {
    /* Mở rộng hết chiều cao tới giờ cuối — cuộn dọc theo cả trang, chỉ giữ cuộn ngang cho 7 cột ngày */
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    min-height: 300px;
}

.weekly-time-grid {
    display: grid;
    grid-template-columns: 55px repeat(7, minmax(110px, 1fr));
    width: 100%;
    min-width: 700px;
}

/* Sticky time labels (left column) */
.time-label {
    padding: 4px 2px;
    text-align: center;
    font-size: 0.7rem;
    color: #718096;
    font-weight: 600;
    background: #f7fafc;
    border-right: 2px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    position: sticky;
    left: 0;
    z-index: 2;
}

.time-label.no-time-label {
    background: #edf2f7;
    color: #a0aec0;
    min-height: 36px;
    font-size: 0.9rem;
}

/* Sticky top-left corner (header row, time column) */
.time-grid-corner {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 4;
    background: #3a85cc;
    border-right: 2px solid rgba(255,255,255,0.3);
    border-bottom: 2px solid rgba(255,255,255,0.3);
    min-height: 44px;
}

/* Sticky day-header cells (top row) */
.time-grid-day-header {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #4299e1;
    color: white;
    text-align: center;
    padding: 6px 4px;
    font-size: 0.78rem;
    font-weight: 600;
    border-right: 1px solid rgba(255,255,255,0.2);
    border-bottom: 2px solid rgba(0,0,0,0.1);
    min-height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.time-grid-day-header:last-child {
    border-right: none;
}

.time-grid-day-header.today {
    background: #ffc107;
    color: #1a202c;
}

.time-grid-day-header.weekend {
    background: #718096;
}

.tg-day-name {
    font-weight: 600;
    line-height: 1.2;
}

.tg-day-date {
    font-size: 0.68rem;
    opacity: 0.9;
    margin-top: 1px;
}

.time-slot-cell {
    padding: 3px;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    background: #fafbfc;
    min-height: 60px;
    overflow: hidden;
}

.time-slot-cell.today {
    background: #fffaf0;
}

.time-slot-cell.weekend {
    background: #f5f5f5;
}

/* Remove right border on last column of each row (9th child counts corner+7headers=8, then label+7cells=8 per row) */
.time-grid-day-header:nth-child(8n),
.time-slot-cell:nth-child(8n) {
    border-right: none;
}

.weekly-day-column {
    border-right: 1px solid #e2e8f0;
    background: #fafbfc;
    display: flex;
    flex-direction: column;
}

.weekly-day-column:last-child {
    border-right: none;
}

.weekly-day-column.today {
    background: #fffaf0;
    border: #ffc107;
}

.weekly-day-column.weekend {
    background: #f8f9fa;
}

.weekly-day-info {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    background: white;
}

.weekly-day-number {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
}

.weekly-task-count {
    background: #4299e1;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.7rem;
    margin-top: 4px;
    display: inline-block;
    font-weight: 500;
}

.weekly-task-count.empty {
    background: #e2e8f0;
    color: #718096;
}

.weekly-tasks-container {
    flex: 1;
    padding: 6px;
    overflow-y: auto;
    max-height: 350px;
}

.weekly-task-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid #4299e1;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.weekly-task-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.weekly-task-card:last-child {
    margin-bottom: 0;
}

.weekly-task-card.priority-high {
    border-left-color: #e53e3e;
}

.weekly-task-card.priority-medium {
    border-left-color: #dd6b20;
}

.weekly-task-card.priority-low {
    border-left-color: #38a169;
}

.weekly-task-card.status-completed {
    opacity: 0.6;
    background: #f7fafc;
    text-decoration: line-through;
}

.weekly-task-card.status-cancelled {
    opacity: 0.4;
    background: #fffaf0;
    text-decoration: line-through;
}

.weekly-task-card.overdue {
    border-left-color: #e53e3e;
    background: #fff5f5;
}

.weekly-task-title {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.8rem;
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.weekly-task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: #718096;
}

.weekly-task-branch {
    background: #edf2f7;
    color: #4a5568;
    padding: 1px 4px;
    border-radius: 8px;
    font-weight: 500;
}

.weekly-task-staff {
    color: #805ad5;
    font-weight: 500;
}

.weekly-task-time {
    color: #a0aec0;
    font-size: 0.65rem;
}

.weekly-overdue-badge {
    background: #e53e3e;
    color: white;
    padding: 1px 3px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
}

.weekly-empty-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 120px;
    color: #a0aec0;
    font-style: italic;
    text-align: center;
    font-size: 0.75rem;
}

.weekly-empty-icon {
    font-size: 1.5rem;
    margin-bottom: 6px;
    opacity: 0.6;
}

/* ================= WEEKLY MOBILE RESPONSIVE ================= */
@media (max-width: 768px) {
    .weekly-schedule-container {
        padding: 8px;
    }

    .weekly-schedule-header {
        padding: 15px;
    }

    .weekly-title {
        font-size: 1.1rem;
    }

    .weekly-date-range {
        font-size: 0.8rem;
    }

    .weekly-nav-buttons {
        flex-direction: row;
        gap: 4px;
    }

    .weekly-nav-btn {
        font-size: 0.7rem;
        padding: 6px 8px;
        flex: 1;
    }

    .weekly-navigation {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        align-items: center;
    }

    .weekly-stats {
        justify-content: center;
        gap: 15px;
        font-size: 0.8rem;
    }

    .weekly-calendar-header {
        display: none;
    }

    .weekly-calendar-body {
        min-height: auto;
    }

    .weekly-time-grid-wrapper {
        /* Cuộn NGANG trong lưới giờ + cuộn DỌC theo cả trang.
           `pan-x pan-y` cho phép cả hai chiều (pan-x đơn lẻ trước đây KHÓA cuộn dọc). */
        max-height: none;
        overflow-x: auto;
        overflow-y: visible;
        touch-action: pan-x pan-y;
    }

    /* Day headers no longer sticky on mobile — page scroll owns vertical */
    .time-grid-day-header {
        position: relative;
        top: auto;
    }

    /* Corner only needs sticky-left, not sticky-top */
    .time-grid-corner {
        position: sticky;
        top: auto;
        left: 0;
        z-index: 3;
    }

    .weekly-time-grid {
        min-width: 460px;
        grid-template-columns: 40px repeat(7, minmax(62px, 1fr));
    }

    .time-label {
        font-size: 0.6rem;
        padding: 2px 1px;
        min-height: 50px;
    }

    .time-label.no-time-label {
        min-height: 30px;
    }

    .time-grid-corner {
        min-height: 36px;
    }

    .time-grid-day-header {
        min-height: 36px;
        padding: 4px 2px;
        font-size: 0.68rem;
    }

    .tg-day-date {
        font-size: 0.6rem;
    }

    .time-slot-cell {
        min-height: 50px;
        padding: 2px;
    }

    /* Compress task cards inside the time-slot grid on mobile */
    .time-slot-cell .weekly-task-card {
        padding: 3px 4px;
        margin-bottom: 2px;
    }

    .time-slot-cell .weekly-task-title {
        font-size: 0.68rem;
        -webkit-line-clamp: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
        margin-bottom: 0;
    }

    .time-slot-cell .weekly-task-meta {
        display: none;
    }

    .time-slot-cell .weekly-overdue-badge {
        font-size: 0.55rem;
        padding: 1px 2px;
    }

    .time-slot-cell .drag-handle {
        display: none;
    }

    .time-slot-cell .view-only-badge {
        display: none;
    }

    .weekly-day-column {
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        min-height: auto;
        margin-bottom: 10px;
        border-radius: 6px;
        overflow: hidden;
    }

    .weekly-day-column:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }

    .weekly-day-info {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        padding: 12px;
        background: #4299e1;
        color: white;
        font-weight: 600;
    }

    .weekly-day-column.today .weekly-day-info {
        background: #ffc107;
        color: #1a202c;
    }

    .weekly-day-column.weekend .weekly-day-info {
        background: #718096;
        color: white;
    }

    .weekly-day-number-mobile {
        display: flex;
        align-items: center;
        gap: 8px;
        font-weight: 600;
    }

    .weekly-day-number {
        font-size: 1rem;
    }

    .weekly-task-count {
        background: rgba(255,255,255,0.2);
        color: white;
        border: 1px solid rgba(255,255,255,0.3);
    }

    .weekly-day-column.today .weekly-task-count {
        background: rgba(0,0,0,0.1);
        color: #1a202c;
        border-color: rgba(0,0,0,0.2);
    }

    .weekly-task-count.empty {
        background: rgba(255,255,255,0.15);
        color: rgba(255,255,255,0.8);
        border-color: rgba(255,255,255,0.2);
    }

    .weekly-day-column.today .weekly-task-count.empty {
        background: rgba(0,0,0,0.05);
        color: rgba(0,0,0,0.6);
        border-color: rgba(0,0,0,0.1);
    }

    .weekly-tasks-container {
        max-height: none;
        padding: 8px;
    }

    .weekly-task-card {
        margin-bottom: 6px;
        padding: 10px;
    }

    .weekly-task-title {
        font-size: 0.85rem;
        -webkit-line-clamp: 3;
        margin-bottom: 6px;
    }

    .weekly-task-meta {
        font-size: 0.75rem;
        flex-wrap: wrap;
        gap: 8px;
    }

    .weekly-empty-day {
        height: 80px;
        font-size: 0.8rem;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .weekly-nav-btn {
        font-size: 0.65rem;
        padding: 5px 6px;
    }

    .weekly-stats {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }

    .weekly-stat-item {
        font-size: 0.75rem;
    }
}
/* Basic drag & drop styles */
.draggable-task {
    cursor: grab;
    transition: transform 0.2s;
}

.draggable-task:hover {
    transform: scale(1.02);
}

.draggable-task.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.drop-zone {
    border: 2px dashed transparent;
    transition: all 0.3s;
}/* ================= DRAG & DROP ENHANCEMENTS ================= */
.draggable-task {
    cursor: grab !important;
    position: relative;
    transition: all 0.2s ease;
}

.draggable-task:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.draggable-task.dragging {
    opacity: 0.6;
    cursor: grabbing !important;
    transform: rotate(2deg);
    z-index: 1000;
}

.drag-handle {
    position: absolute;
    top: 5px;
    right: 5px;
    color: #999;
    font-size: 0.8rem;
    pointer-events: none;
}

.drop-zone.drag-over, 
.monthly-day-cell.drag-over,
.weekly-day-column.drag-over {
    background: linear-gradient(135deg, rgba(66, 153, 225, 0.1), rgba(66, 153, 225, 0.2)) !important;
    border: 2px dashed #4299e1 !important;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

/* Better visual feedback for monthly cells */
.monthly-day-cell.drag-over .monthly-day-number {
    background: #4299e1 !important;
    color: white !important;
}

/* Better visual feedback for weekly columns */
.weekly-day-column.drag-over .weekly-day-info {
    background: #4299e1 !important;
    color: white !important;
}

.drop-zone.drag-over {
    border-color: #007bff;
    background-color: rgba(0, 123, 255, 0.1);
}
/* ================= MOBILE TOUCH DRAG & DROP ================= */

/* Better touch targets for mobile */
@media (max-width: 768px) {
    .draggable-task {
        min-height: 80px !important;
        padding: 12px !important;
        /* Đã bỏ `touch-action: none` để CHO PHÉP cuộn chạm trên bảng lịch tuần (xem full trang).
           Kéo-thả vẫn hoạt động nhờ SortableJS giữ-rồi-kéo (delay 200ms, delayOnTouchOnly). */
    }
    
    .mobile-drag-handle {
        position: absolute;
        bottom: 4px;
        right: 4px;
        font-size: 0.7rem;
        opacity: 0.7;
        color: #666;
        pointer-events: none;
    }
    
    /* Visual feedback during touch drag */
    .draggable-task.touch-dragging {
        opacity: 0.7 !important;
        transform: scale(1.05) !important;
        z-index: 1000;
        box-shadow: 0 8px 20px rgba(0,0,0,0.3) !important;
    }
    
    /* Better drop zone highlighting on mobile */
    .monthly-day-cell.drag-over,
    .weekly-day-column.drag-over {
        background: linear-gradient(135deg, #4299e1, #63b3ed) !important;
        transform: scale(1.05);
        box-shadow: 0 4px 15px rgba(66, 153, 225, 0.4);
        border: 3px solid #2b6cb0 !important;
    }
    
    /* Drag preview styles */
    .mobile-drag-preview {
        animation: dragBounce 0.6s ease-in-out infinite alternate;
    }
    
    @keyframes dragBounce {
        0% { transform: rotate(-2deg) scale(1); }
        100% { transform: rotate(-2deg) scale(1.1); }
    }
}

/* Prevent text selection during drag */
.draggable-task {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
/* Add to your HTML <style> section */

/* ================= SORTABLEJS STYLES ================= */
.sortable-ghost {
    opacity: 0.4;
    background: #e3f2fd !important;
}

.sortable-chosen {
    cursor: grabbing !important;
}

.sortable-drag {
    opacity: 0.8;
    transform: rotate(5deg);
    z-index: 9999;
}

body.is-dragging {
    cursor: grabbing;
}

body.is-dragging * {
    cursor: grabbing !important;
}

/* Drop zone highlights */
.monthly-tasks-area:hover,
.weekly-tasks-container:hover {
    background: rgba(66, 153, 225, 0.1);
    border-radius: 4px;
}
/* ================= REMOVE SORTABLEJS TILT ANIMATION ================= */

/* Remove rotation/tilt from dragged elements */
.sortable-ghost {
    opacity: 0.4;
    background: #e3f2fd !important;
    transform: none !important; /* ✅ Remove any rotation */
}

.sortable-chosen {
    cursor: grabbing !important;
    transform: none !important; /* ✅ Remove any rotation */
}

.sortable-drag {
    opacity: 0.8;
    transform: none !important; /* ✅ Remove rotation, keep only opacity */
    z-index: 9999;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3) !important;
}

/* Override any SortableJS transform styles */
.weekly-task-card.sortable-drag,
.monthly-task-dot.sortable-drag {
    transform: none !important;
    animation: none !important;
}

/* Better drag feedback without rotation */
.weekly-task-card:hover {
    transform: scale(1.02) !important; /* ✅ Only scale, no rotation */
    transition: transform 0.2s ease;
}

.monthly-task-dot:hover {
    transform: scale(1.1) !important; /* ✅ Only scale, no rotation */
    transition: transform 0.2s ease;
}

/* Remove mobile rotation as well */
.mobile-drag-preview {
    animation: none !important;
    transform: scale(1.1) !important; /* ✅ Only scale */
}

/* Ensure draggable tasks don't rotate */
.draggable-task.dragging {
    transform: scale(1.05) !important; /* ✅ Only scale */
}

/* Clean drag state */
body.is-dragging .weekly-task-card,
body.is-dragging .monthly-task-dot {
    transform: none !important;
}
/* ================= ENHANCED CALENDAR FILTERS ================= */
.calendar-filters {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 16px;
}

.calendar-filters .form-label {
    font-weight: 600;
    color: #495057;
}

.calendar-filters .form-select-sm {
    font-size: 0.85rem;
    padding: 6px 8px;
}

.calendar-filters .btn-sm {
    font-size: 0.8rem;
    padding: 6px 12px;
}

/* Mobile responsive for calendar filters */
@media (max-width: 768px) {
    .calendar-filters .row {
        flex-direction: column;
        gap: 8px;
    }
    
    .calendar-filters .col-sm-3,
    .calendar-filters .col-sm-2,
    .calendar-filters .col-auto {
        width: 100%;
    }
    
    .calendar-filters .form-select-sm {
        font-size: 0.8rem;
    }
    
    .calendar-filters .btn-sm {
        width: 100%;
        margin-top: 8px;
    }
}

/* Status indicator colors in filters */
.calendar-filters option[value="active"] {
    color: #d69e2e;
}

.calendar-filters option[value="completed"] {
    color: #38a169;
}

.calendar-filters option[value="cancelled"] {
    color: #e53e3e;
}
/* ================= SIDEBAR DROPDOWN STYLES ================= */
.sidebar-dropdown-toggle {
  position: relative;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}

.dropdown-arrow {
  font-size: 12px;
  transition: transform 0.3s ease;
}

.sidebar-dropdown-toggle.expanded .dropdown-arrow {
  transform: rotate(180deg);
}

.sidebar-submenu {
  background: rgba(0,0,0,0.1);
  border-left: 3px solid rgba(255,255,255,0.2);
  margin-left: 10px;
  margin-top: 5px;
  border-radius: 0 8px 8px 0;
  transition: all 0.3s ease;
  overflow: hidden;
}

.sidebar-submenu.show {
  display: block !important;
}

.sidebar-nav-sublink {
  display: block !important;
  width: 100% !important;
  text-align: left !important;
  padding: 12px 20px !important;
  color: rgba(255,255,255,0.7) !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  text-decoration: none !important;
  transition: all 0.3s ease !important;
  margin: 1px 0 !important;
  border-left: 2px solid transparent !important;
}

.sidebar-nav-sublink:hover {
  background: rgba(255,255,255,0.15) !important;
  color: #fff !important;
  transform: translateX(5px);
  border-left-color: rgba(255,255,255,0.5) !important;
}

.sidebar-nav-sublink.active {
  background: rgba(255,255,255,0.25) !important;
  color: #fff !important;
  border-left-color: #fff !important;
  font-weight: 500 !important;
}

/* Smooth animation for submenu */
.sidebar-submenu {
  max-height: 0;
  transition: max-height 0.3s ease-out;
}

.sidebar-submenu.show {
  max-height: 200px;
}

/* Hover effect for main calendar button */
.sidebar-nav-link:hover .dropdown-arrow {
  color: #fff !important;
}

/* Active state for main calendar button when submenu is open */
.sidebar-dropdown-toggle.expanded {
  background: rgba(255,255,255,0.1) !important;
  color: #fff !important;
}
/* ================= TASK COUNT BADGES ================= */
.task-count-badge {
  background: rgba(255,255,255,0.2);
  color: white;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 8px;
  min-width: 20px;
  text-align: center;
  display: inline-block;
  border: 1px solid rgba(255,255,255,0.3);
}

.sidebar-nav-sublink:hover .task-count-badge {
  background: rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.5);
}

.sidebar-nav-sublink.active .task-count-badge {
  background: rgba(255,255,255,0.4);
  color: #fff;
  border-color: #fff;
}

/* Different colors for different counts */
.task-count-badge.high-count {
  background: #e53e3e;
  border-color: #c53030;
}

.task-count-badge.medium-count {
  background: #dd6b20;
  border-color: #c05621;
}

.task-count-badge.low-count {
  background: #38a169;
  border-color: #2f855a;
}

.task-count-badge.zero-count {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  border-color: rgba(255,255,255,0.2);
}
/* ================= SIDEBAR SUBMENU BRANCH DISPLAY FIX ================= */
.sidebar-submenu {
    max-height: none !important; /* Remove height restrictions */
    overflow: visible !important;
    background: rgba(0,0,0,0.1);
    border-left: 3px solid rgba(255,255,255,0.2);
    margin-left: 10px;
    margin-top: 5px;
    border-radius: 0 8px 8px 0;
    transition: all 0.3s ease;
}

.sidebar-submenu.show {
    display: block !important;
    max-height: 500px !important; /* Increase max height */
}

/* Ensure all branch items are visible */
.sidebar-submenu .nav-item {
    width: 100%;
    margin-bottom: 2px;
}

.sidebar-nav-sublink {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    text-align: left !important;
    padding: 10px 15px !important;
    color: rgba(255,255,255,0.8) !important;
    background: transparent !important;
    border: none !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    border-left: 2px solid transparent !important;
    white-space: nowrap;
    overflow: visible;
}

.sidebar-nav-sublink:hover {
    background: rgba(255,255,255,0.15) !important;
    color: #fff !important;
    transform: translateX(3px);
    border-left-color: rgba(255,255,255,0.5) !important;
}

.sidebar-nav-sublink.active {
    background: rgba(255,255,255,0.25) !important;
    color: #fff !important;
    border-left-color: #fff !important;
    font-weight: 500 !important;
}

/* Task count badges - ensure visibility */
.task-count-badge {
    background: rgba(255,255,255,0.2) !important;
    color: white !important;
    border-radius: 10px !important;
    padding: 2px 8px !important;
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    min-width: 25px !important;
    text-align: center !important;
    display: inline-block !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
    margin-left: 8px !important;
    flex-shrink: 0 !important; /* Prevent shrinking */
}

/* Different colors for different counts */
.task-count-badge.high-count {
    background: #e53e3e !important;
    border-color: #c53030 !important;
    color: white !important;
}

.task-count-badge.medium-count {
    background: #dd6b20 !important;
    border-color: #c05621 !important;
    color: white !important;
}

.task-count-badge.low-count {
    background: #38a169 !important;
    border-color: #2f855a !important;
    color: white !important;
}

.task-count-badge.zero-count {
    background: rgba(255,255,255,0.1) !important;
    color: rgba(255,255,255,0.6) !important;
    border-color: rgba(255,255,255,0.2) !important;
}

/* Mobile responsive fixes */
@media (max-width: 768px) {
    .sidebar-submenu {
        margin-left: 5px;
        padding-right: 10px;
    }
    
    .sidebar-nav-sublink {
        padding: 12px 10px !important;
        font-size: 14px !important;
    }
    
    .task-count-badge {
        min-width: 20px !important;
        font-size: 0.65rem !important;
        padding: 1px 6px !important;
    }
}

/* Ensure parent container doesn't clip */
#giaoViecSubmenu {
    overflow: visible !important;
    position: relative;
    z-index: 100;
}

/* Animation for smooth expand */
.sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.3s ease;
    padding-top: 0;
    padding-bottom: 0;
}

.sidebar-submenu.show {
    max-height: 600px; /* Enough for all branches */
    padding-top: 8px;
    padding-bottom: 8px;
    overflow: visible;
}
/* ================= DESKTOP DROPDOWN ENHANCEMENTS ================= */

/* Desktop nav tabs container */
.nav-container {
    background: white;
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

/* Dropdown menu styling */
.nav-item.dropdown .dropdown-menu {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 1px solid #e2e8f0;
    padding: 8px 0;
    min-width: 250px;
    margin-top: 4px;
}

.nav-item.dropdown .dropdown-item {
    padding: 10px 20px;
    font-size: 0.9rem;
    color: #4a5568;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-item.dropdown .dropdown-item:hover {
    background: #f7fafc;
    color: #2d3748;
    transform: translateX(3px);
}

.nav-item.dropdown .dropdown-item .badge {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 10px;
}

/* Dropdown toggle button */
.nav-link.dropdown-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link.dropdown-toggle::after {
    margin-left: 4px;
}

/* Active dropdown button */
.nav-link.dropdown-toggle.active,
.nav-link.dropdown-toggle.show {
    background: #0d6efd !important;
    color: #fff !important;
}

/* Dropdown divider */
.dropdown-divider {
    margin: 8px 0;
    border-color: #e2e8f0;
}

/* Badge colors for different counts */
.dropdown-item .badge.bg-secondary {
    background: #e2e8f0 !important;
    color: #4a5568 !important;
}

.dropdown-item:hover .badge.bg-secondary {
    background: #cbd5e0 !important;
    color: #2d3748 !important;
}

/* Ensure dropdowns work properly */
.nav-item.dropdown {
    position: relative;
}

.nav-item.dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
}

/* ✅ FIX: Ensure select tasks modal appears above project details modal */
#selectExistingTasksModal {
  z-index: 1060 !important; /* Higher than default modal z-index (1055) */
}

#selectExistingTasksModal .modal-backdrop {
  z-index: 1059 !important;
}

/* Ensure project details modal stays below */
#projectDetailsModal {
  z-index: 1055 !important;
}

#projectDetailsModal .modal-backdrop {
  z-index: 1054 !important;
}
    /* ===== GRID / TILE LAYOUT ===== */
    .job-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      gap: 12px;
    }

    .job-grid .alert {
      grid-column: 1 / -1;
    }

    /* ===== TILE CARD ===== */
    .job-tile {
      background: #fff;
      border: 1px solid #e0e0e0;
      border-radius: 8px;
      overflow: hidden;
      cursor: pointer;
      transition: box-shadow 0.2s, transform 0.15s;
      display: flex;
      flex-direction: column;
      position: relative;
    }

    .job-tile:hover {
      box-shadow: 0 6px 20px rgba(0,0,0,0.12);
      transform: translateY(-2px);
    }

    /* Priority left stripe */
    .job-tile.priority-cao    { border-left: 4px solid #dc3545; }
    .job-tile.priority-tb     { border-left: 4px solid #ffc107; }
    .job-tile.priority-thap   { border-left: 4px solid #28a745; }

    /* Overdue glow */
    .job-tile.overdue {
      border-color: #dc3545;
      box-shadow: 0 0 0 1px rgba(220,53,69,0.3);
    }

    /* Done state */
    .job-tile.status-xong {
      opacity: 0.7;
      background: #f8fff8;
    }
    .job-tile.status-huy {
      opacity: 0.6;
      background: #fff8f8;
    }

    /* Image banner */
    .job-tile-img {
      width: 100%;
      height: 100px;
      object-fit: cover;
      border-bottom: 1px solid #eee;
    }

    .job-tile-img-placeholder {
      width: 100%;
      height: 60px;
      background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.5rem;
      color: #a0aec0;
      border-bottom: 1px solid #eee;
    }

    /* Body */
    .job-tile-body {
      padding: 10px 12px;
      flex: 1;
      display: flex;
      flex-direction: column;
    }

    .job-tile-title {
      font-size: 0.9rem;
      font-weight: 600;
      margin-bottom: 6px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      color: #1a202c;
    }

    .job-tile-meta {
      font-size: 0.75rem;
      color: #718096;
      margin-bottom: 4px;
    }

    /* Footer row */
    .job-tile-footer {
      padding: 6px 12px;
      background: #f7fafc;
      border-top: 1px solid #edf2f7;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 0.75rem;
    }

    /* Overdue badge */
    .job-tile .overdue-badge {
      position: absolute;
      top: 6px;
      right: 6px;
      background: #dc3545;
      color: #fff;
      font-size: 0.65rem;
      padding: 2px 6px;
      border-radius: 3px;
      font-weight: 700;
      z-index: 1;
    }

    /* Project badge */
    .job-tile .project-badge {
      position: absolute;
      top: 6px;
      left: 6px;
      z-index: 1;
    }

    /* Staff chips */
    .job-tile-staff {
      display: flex;
      flex-wrap: wrap;
      gap: 3px;
      margin-top: 4px;
    }

    .job-tile-staff .chip {
      background: #edf2f7;
      color: #4a5568;
      font-size: 0.7rem;
      padding: 1px 6px;
      border-radius: 10px;
      white-space: nowrap;
    }

    /* ===== RESPONSIVE: smaller on mobile ===== */
    @media (max-width: 576px) {
      .job-grid {
        grid-template-columns: 1fr;
        gap: 8px;
      }
      .job-tile-img {
        height: 80px;
      }
    }

    @media (min-width: 577px) and (max-width: 991px) {
      .job-grid {
        grid-template-columns: repeat(2, 1fr);
      }
    }

    @media (min-width: 1400px) {
      .job-grid {
        grid-template-columns: repeat(4, 1fr);
      }
    }

    /* ===== VIEW TOGGLE ACTIVE ===== */
    .btn-group .btn.active {
      background-color: #0d6efd;
      color: #fff;
      border-color: #0d6efd;
    }

    /* Table row clickable */
    #jobTable tr:hover {
      background-color: #f0f7ff !important;
      cursor: pointer;
    }
     .myjob-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
  }

  .myjob-grid .alert {
    grid-column: 1 / -1;
  }

  /* ===== MY JOB TILE ===== */
  .myjob-tile {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
    display: flex;
    flex-direction: column;
    position: relative;
  }

  .myjob-tile:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
  }

  .myjob-tile.priority-cao    { border-left: 4px solid #dc3545; }
  .myjob-tile.priority-tb     { border-left: 4px solid #ffc107; }
  .myjob-tile.priority-thap   { border-left: 4px solid #28a745; }

  .myjob-tile.overdue {
    border-color: #dc3545;
    box-shadow: 0 0 0 1px rgba(220,53,69,0.3);
  }

  .myjob-tile.status-xong {
    opacity: 0.7;
    background: #f8fff8;
  }
  .myjob-tile.status-huy {
    opacity: 0.6;
    background: #fff8f8;
  }

  .myjob-tile-img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-bottom: 1px solid #eee;
  }

  .myjob-tile-img-placeholder {
    width: 100%;
    height: 50px;
    background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #a0aec0;
    border-bottom: 1px solid #eee;
  }

  .myjob-tile-body {
    padding: 8px 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .myjob-tile-title {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #1a202c;
  }

  .myjob-tile-meta {
    font-size: 0.73rem;
    color: #718096;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .myjob-tile-footer {
    padding: 5px 10px;
    background: #f7fafc;
    border-top: 1px solid #edf2f7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.73rem;
  }

  .myjob-tile .overdue-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #dc3545;
    color: #fff;
    font-size: 0.63rem;
    padding: 2px 5px;
    border-radius: 3px;
    font-weight: 700;
    z-index: 1;
  }

  .myjob-tile .img-pair {
    display: flex;
    gap: 4px;
    margin-top: 4px;
  }

  .myjob-tile .img-pair img {
    width: 50%;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
  }

  .myjob-tile .img-pair .img-empty {
    width: 50%;
    height: 50px;
    background: #f0f4f8;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #a0aec0;
  }

  @media (max-width: 576px) {
    .myjob-grid {
      grid-template-columns: 1fr;
      gap: 8px;
    }
  }

  @media (min-width: 577px) and (max-width: 991px) {
    .myjob-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  @media (min-width: 1400px) {
    .myjob-grid {
      grid-template-columns: repeat(4, 1fr);
    }
  }
    /* ===== HISTORY GRID ===== */
  .history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
  }

  .history-grid .alert {
    grid-column: 1 / -1;
  }

  /* ===== HISTORY TILE ===== */
  .history-tile {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
    display: flex;
    flex-direction: column;
    position: relative;
  }

  .history-tile:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
  }

  .history-tile.status-xong {
    border-left: 4px solid #28a745;
    background: #f8fff8;
  }
  .history-tile.status-huy {
    border-left: 4px solid #dc3545;
    background: #fff8f8;
    opacity: 0.75;
  }

  .history-tile-body {
    padding: 8px 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .history-tile-title {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #1a202c;
  }

  .history-tile-meta {
    font-size: 0.73rem;
    color: #718096;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .history-tile-footer {
    padding: 5px 10px;
    background: #f7fafc;
    border-top: 1px solid #edf2f7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.73rem;
  }

  .history-tile .img-pair {
    display: flex;
    gap: 4px;
    margin-top: 4px;
  }

  .history-tile .img-pair img {
    width: 50%;
    height: 55px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
  }

  .history-tile .img-pair .img-empty {
    width: 50%;
    height: 55px;
    background: #f0f4f8;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #a0aec0;
  }

  .history-tile .ql-feedback {
    font-size: 0.72rem;
    color: #6b46c1;
    background: #f3f0ff;
    padding: 3px 6px;
    border-radius: 4px;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .btn-group .btn.active {
    background-color: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
  }

  @media (max-width: 576px) {
    .history-grid {
      grid-template-columns: 1fr;
      gap: 8px;
    }
  }

  @media (min-width: 577px) and (max-width: 991px) {
    .history-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  @media (min-width: 1400px) {
    .history-grid {
      grid-template-columns: repeat(4, 1fr);
    }
  }