:root {
  --sidebar-width: 240px;
}

#wrapper {
  min-height: 100vh;
}

#sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

#sidebar .nav-link {
  color: var(--bs-body-color);
  border-radius: 0.5rem;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.2rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
}

#sidebar .nav-link:hover {
  background: var(--bs-primary-bg-subtle);
}

#sidebar .nav-link.active {
  background: var(--bs-primary);
  color: #fff;
  font-weight: 500;
}

#sidebar .nav-link.active .badge {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

#content {
  margin-left: var(--sidebar-width);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.task-card {
  border-left: 4px solid var(--bs-border-color);
  transition: transform 0.15s, box-shadow 0.15s;
}

.task-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.task-card.priority-1 { border-left-color: var(--bs-danger); }
.task-card.priority-2 { border-left-color: var(--bs-warning); }
.task-card.priority-3 { border-left-color: var(--bs-secondary); }
.task-card.status-paused { opacity: 0.55; }

.task-card .form-check-input {
  width: 1.3rem;
  height: 1.3rem;
  cursor: pointer;
  margin-top: 0.15rem;
}

.task-card .form-check-input:checked {
  background-color: var(--bs-success);
  border-color: var(--bs-success);
}

.task-card .task-title {
  font-weight: 500;
  font-size: 0.95rem;
}

.task-card .task-meta {
  font-size: 0.8rem;
}

.task-card .task-meta .badge {
  font-weight: 400;
  font-size: 0.75rem;
}

.task-card .btn-action {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
}

.category-badge {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--bs-secondary-color);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
  }
  #sidebar.show {
    transform: translateX(0);
  }
  #content {
    margin-left: 0;
  }
  #mobile-toggle {
    display: inline-flex !important;
  }
}

@media (min-width: 769px) {
  #mobile-toggle {
    display: none !important;
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  backdrop-filter: blur(2px);
}

/* ── Gantt Chart ── */
.gantt-scroll-container {
  overflow: auto;
  max-height: 500px;
  border-top: 1px solid var(--bs-border-color);
}

.gantt-header {
  display: flex;
  height: 40px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bs-tertiary-bg);
}

.gantt-sticky-prio {
  width: 50px;
  min-width: 50px;
  position: sticky;
  left: 0;
  z-index: 13;
  background: var(--bs-tertiary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
  border-right: 1px solid var(--bs-border-color);
  border-bottom: 1px solid var(--bs-border-color);
}

.gantt-sticky-cat {
  width: 100px;
  min-width: 100px;
  position: sticky;
  left: 50px;
  z-index: 12;
  background: var(--bs-tertiary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
  border-right: 2px solid var(--bs-border-color);
  border-bottom: 1px solid var(--bs-border-color);
}

.gantt-sticky-name {
  width: 200px;
  min-width: 200px;
  position: sticky;
  left: 150px;
  z-index: 11;
  background: var(--bs-tertiary-bg);
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
  border-right: 2px solid var(--bs-border-color);
  border-bottom: 1px solid var(--bs-border-color);
}

.gantt-timeline {
  display: flex;
  flex: 1;
  border-bottom: 1px solid var(--bs-border-color);
}

.gantt-day-header {
  min-width: var(--gantt-day-width, 60px);
  width: var(--gantt-day-width, 60px);
  text-align: center;
  font-size: 0.7rem;
  color: var(--bs-secondary-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  border-right: 1px solid var(--bs-border-color-translucent);
}

.gantt-day-header .day-name {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.6rem;
}

.gantt-day-header .day-num {
  font-weight: 500;
  font-size: 0.8rem;
}

.gantt-day-header.today {
  background: var(--bs-primary-bg-subtle);
  color: var(--bs-primary);
}

.gantt-day-header.weekend {
  background: var(--bs-tertiary-bg);
}

.gantt-row {
  display: flex;
  height: 34px;
}

.gantt-row-prio {
  width: 50px;
  min-width: 50px;
  position: sticky;
  left: 0;
  z-index: 7;
  background: var(--bs-body-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  border-right: 1px solid var(--bs-border-color);
  border-bottom: 1px solid var(--bs-border-color-translucent);
}

.gantt-row-prio.prio-1 { color: #dc3545; }
.gantt-row-prio.prio-2 { color: #ffc107; }
.gantt-row-prio.prio-3 { color: #6c757d; }

.gantt-row-cat {
  width: 100px;
  min-width: 100px;
  position: sticky;
  left: 50px;
  z-index: 6;
  background: var(--bs-body-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: capitalize;
  border-right: 2px solid var(--bs-border-color);
  border-bottom: 1px solid var(--bs-border-color-translucent);
}

.gantt-row-name {
  width: 200px;
  min-width: 200px;
  position: sticky;
  left: 150px;
  z-index: 5;
  background: var(--bs-body-bg);
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-right: 2px solid var(--bs-border-color);
  border-bottom: 1px solid var(--bs-border-color-translucent);
}

.gantt-row-name:hover {
  background: var(--bs-primary-bg-subtle);
}

.gantt-row-track {
  flex: 1;
  position: relative;
  border-bottom: 1px solid var(--bs-border-color-translucent);
}

.gantt-row-track:hover {
  background: var(--bs-primary-bg-subtle);
}

.gantt-day-cell {
  position: absolute;
  top: 0;
  bottom: 0;
  border-right: 1px solid var(--bs-border-color-translucent);
}

.gantt-day-cell.today {
  background: var(--bs-primary-bg-subtle);
  opacity: 0.3;
}

.gantt-day-cell.weekend {
  background: var(--bs-tertiary-bg);
  opacity: 0.4;
}

.gantt-bar {
  position: absolute;
  height: 22px;
  top: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding-left: 6px;
  font-size: 0.7rem;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: filter 0.1s;
  z-index: 2;
}

.gantt-bar:hover {
  filter: brightness(1.15);
}

.gantt-bar.priority-1 {
  background: rgba(220,53,69,0.9);
}

.gantt-bar.priority-2 {
  background: rgba(255,193,7,0.9);
  color: #333;
}

.gantt-bar.priority-3 {
  background: rgba(108,117,125,0.7);
}

.gantt-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #dc3545;
  z-index: 3;
  pointer-events: none;
}

.gantt-empty {
  padding: 2rem;
  text-align: center;
  color: var(--bs-secondary-color);
  font-size: 0.85rem;
}

/* Dark mode adjustments */
[data-bs-theme="dark"] .gantt-bar.priority-2 {
  background: rgba(255,193,7,0.9);
}

[data-bs-theme="dark"] .gantt-bar.priority-3 {
  background: rgba(108,117,125,0.7);
}
