.timeline-container {
  --timeline-track-height: 40px;
}

.timeline-container {
  overflow: hidden;
  padding-bottom: 0.5rem;
}

.timeline-layout {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 46px;
  gap: 8px;
  align-items: start;
}

.timeline-center-scroll {
  overflow-x: auto;
  overflow-y: hidden;
}

.timeline-col-spacer {
  height: 48px;
}

.admin-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  height: var(--timeline-track-height);
}

.admin-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
}

.timeline-track {
  position: relative;
  flex: 0 0 auto;
  height: var(--timeline-track-height);
  border-radius: 10px;
  background: var(--bs-light-bg-subtle);
  border: 1px solid var(--bs-border-color);
}

.timeline-row-action {
  height: var(--timeline-track-height);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.timeline-scale {
  height: 48px;
}

.time-marker {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
  font-size: 0.72rem;
  color: var(--bs-secondary-color);
  white-space: nowrap;
}

.time-marker-end {
  transform: translateX(-100%);
}

.day-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--bs-border-color);
}

.shift-block {
  position: absolute;
  top: 5px;
  bottom: 5px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  color: #fff;
  font-size: 0.74rem;
  border: none;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: transform 0.15s ease;
}

.shift-block:hover {
  transform: translateY(-1px);
}

.shift-block-conflict {
  border: 2px solid #dc3545 !important;
  box-shadow: 0 0 8px rgba(220, 53, 69, 0.4), inset 0 0 4px rgba(220, 53, 69, 0.3);
  animation: pulse-conflict 2s infinite;
}

@keyframes pulse-conflict {
  0%, 100% {
    box-shadow: 0 0 8px rgba(220, 53, 69, 0.4), inset 0 0 4px rgba(220, 53, 69, 0.3);
  }
  50% {
    box-shadow: 0 0 12px rgba(220, 53, 69, 0.6), inset 0 0 6px rgba(220, 53, 69, 0.5);
  }
}

.add-shift-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px dashed var(--bs-border-color);
  background: transparent;
  color: var(--bs-secondary-color);
}

.add-shift-btn:hover {
  border-color: var(--bs-primary);
  color: var(--bs-primary);
  background: var(--bs-primary-bg-subtle);
}

.week-nav {
  flex-wrap: nowrap;
}

.week-nav .btn {
  white-space: nowrap;
}

.admin-nav {
  width: 100%;
  justify-content: flex-end;
}

@media (max-width: 992px) {
  .timeline-container {
    --timeline-track-height: 36px;
  }

  .timeline-layout {
    grid-template-columns: 145px minmax(0, 1fr) 40px;
    gap: 6px;
  }

  .shift-block {
    font-size: 0.7rem;
    padding: 0 7px;
  }
}

@media (max-width: 768px) {
  .timeline-container {
    --timeline-track-height: 32px;
  }

  .top-toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .top-toolbar h1 {
    width: 100%;
    font-size: 1.2rem;
  }

  .toolbar-actions {
    width: 100%;
    align-items: stretch !important;
  }

  .week-nav {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem !important;
  }

  .week-nav .btn {
    width: 100%;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    font-size: 0.76rem;
  }

  .admin-nav {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem !important;
  }

  .admin-nav .btn {
    width: 100%;
  }

  .timeline-layout {
    grid-template-columns: 120px minmax(0, 1fr) 40px;
    gap: 4px;
  }

  .admin-label {
    font-size: 0.9rem;
  }

  .admin-avatar {
    width: 22px;
    height: 22px;
    font-size: 0.72rem;
  }

  .timeline-track {
    border-radius: 8px;
  }

  .timeline-scale {
    height: 40px;
  }

  .time-marker {
    font-size: 0.66rem;
  }

  .timeline-col-spacer {
    height: 40px;
  }

  .add-shift-btn {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }
}

@media (max-width: 576px) {
  .week-nav {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    grid-template-columns: 1fr;
  }

  .week-nav .btn {
    font-size: 0.8rem;
  }

  .timeline-layout {
    grid-template-columns: 110px minmax(0, 1fr) 36px;
  }
}
